[docs] xmldocs - docelic modified 16 files
docs at icdevgroup.org
docs at icdevgroup.org
Wed Jul 21 16:24:52 EDT 2004
User: docelic
Date: 2004-07-21 20:24:52 GMT
Added: refs/init_page control description example synopsis
Added: refs/no_html_parse control description example notes
Added: synopsis
Added: refs/post_page control description example notes
Added: refs/pre_page control description synopsis
Log:
Documentation for few pragmas. The docs are complete and I'm using them
for "prototyping" the whole system.
Revision Changes Path
1.1 xmldocs/refs/init_page/control
rev 1.1, prev_rev 1.0
Index: control
===================================================================
# The usual comments can be used here.
# To override a field, supply a value
# To let it through unmodified, simply leave the fields empty
# id: name of the output file (defaults to <name>)
id:
# name: visible name in the pages
name:
# purpose: oneline description
purpose: custom subroutine to run before page Variable processing
# specify person(s). Defaults to icdevgroup
author:
# leave empty; GPL is the default
copyright:
see also: init_page, pre_page, post_page
1.1 xmldocs/refs/init_page/description
rev 1.1, prev_rev 1.0
Index: description
===================================================================
Defines a Sub or GlobalSub to run
<emphasis>before</emphasis> page Variable processing.
A <emphasis>reference</emphasis> to the contents of the
page is passed to the subroutine.
1.1 xmldocs/refs/init_page/example
rev 1.1, prev_rev 1.0
Index: example
===================================================================
<example>
<title>
Auto-wrapping pages in templates
</title>
<para>
We check the page to see if it contains any @_VARIABLE_@ strings.
If it does not, we consider it not to have a template and add the
definitions ourselves.
The following is needed in <filename>catalog.cfg</filename>:
</para>
<programlisting><![CDATA[
Pragma init_page=wrap_page
Sub <<EOS
sub wrap_page {
my $pref = shift;
return if $$pref =~ m{\@_[A-Z]\w+_\@};
$$pref =~ m{<!--+ title:\s*(.*?)\s+-->} and $Scratch->{page_title} = $1;
$$pref = <<EOF;
\@_MYTEMPLATE_TOP_\@
<!--BEGIN CONTENT -->
$$pref
<!-- END CONTENT -->
\@_MYTEMPLATE_BOTTOM_\@
EOF
return;
}
EOS
]]></programlisting>
</example>
1.1 xmldocs/refs/init_page/synopsis
rev 1.1, prev_rev 1.0
Index: synopsis
===================================================================
<synopsis><![CDATA[
Pragma init_page=<subroutine name>
]]></synopsis>
1.1 xmldocs/refs/no_html_parse/control
rev 1.1, prev_rev 1.0
Index: control
===================================================================
# The usual comments can be used here.
# To override a field, supply a value
# To let it through unmodified, simply leave the fields empty
# purpose: oneline description (MUST FILL IN)
purpose:
# Please take time to fill in the See Also line.
# Just name the related symbols. The system will work everything out.
# (Note that if you link some item from here, that item will auto-point
# back here (under "indirect links" section))
see also:
# Usually not needed to modify below
# id: name of the output file (defaults to <name>)
id:
# name: visible name in the pages
name:
# specify person(s). Defaults to icdevgroup
author:
# leave empty; GPL is the default
copyright:
1.1 xmldocs/refs/no_html_parse/description
rev 1.1, prev_rev 1.0
Index: description
===================================================================
Disallows tag parsing inside HTML tags. This was a <command>big</command>
parser performance gain and was enabled in the demo catalog shipping with
older Interchange releases.
1.1 xmldocs/refs/no_html_parse/example
rev 1.1, prev_rev 1.0
Index: example
===================================================================
<example>
<title>
Tag parsing
</title>
<para>
If you want to enable or disable this pragma for only a particular page,
do anywhere in the page:
</para>
<programlisting><![CDATA[
[pragma no_html_parse]
[pragma no_html_parse 0]
]]></programlisting>
</example>
1.1 xmldocs/refs/no_html_parse/notes
rev 1.1, prev_rev 1.0
Index: notes
===================================================================
The no_html_parse pragma itself, for which code has already been deleted in 4.8 series, was finally removed in Interchange 4.9.
1.1 xmldocs/refs/no_html_parse/synopsis
rev 1.1, prev_rev 1.0
Index: synopsis
===================================================================
<synopsis><![CDATA[
[pragma no_html_parse]
[pragma no_html_parse 0]
]]></synopsis>
1.1 xmldocs/refs/post_page/control
rev 1.1, prev_rev 1.0
Index: control
===================================================================
purpose: custom subroutine to run before Image substitution on a page
see also: init_page, pre_page, post_page
1.1 xmldocs/refs/post_page/description
rev 1.1, prev_rev 1.0
Index: description
===================================================================
Defines a Sub or GlobalSub to run
<emphasis>before</emphasis> Image substitution on a page. A
<emphasis>reference</emphasis> to the page contents
is passed to the subroutine.
1.1 xmldocs/refs/post_page/example
rev 1.1, prev_rev 1.0
Index: example
===================================================================
<example>
<title>
Treat URLs relative to current directory
</title>
<para>
It is possible to have URL links treated
as being relative to the current directory.
The following is needed in <filename>catalog.cfg</filename>:
</para>
<programlisting><![CDATA[
Pragma post_page=relative_urls
### Take hrefs like <A HREF="about.html"> and make relative to current
### directory
Sub <<EOR
sub relative_urls {
my $page = shift;
my @dirs = split "/", $Tag->var('MV_PAGE', 1);
pop @dirs;
my $basedir = join "/", @dirs;
$basedir ||= '';
$basedir .= '/' if $basedir;
my $sub = sub {
my ($entire, $pre, $url) = @_;
return $entire if $url =~ /^\w+:/;
my($page, $form) = split /\?/, $url, 2;
my $u = $Tag->area({
href => "$basedir$page",
form => $form,
});
return qq{$pre"$u"};
};
$$page =~ s{(
(
<a \s+ (?:[^>]+?\s+)?
href \s*=\s*
)
(["']) ([^\s"'>]+) \3
)}
{
$sub->($1,$2,$4)
}gsiex;
return;
}
EOR
]]></programlisting>
</example>
1.1 xmldocs/refs/post_page/notes
rev 1.1, prev_rev 1.0
Index: notes
===================================================================
The old documentation system improperly describes the phase at which post_page takes effect (it says it's after Variables and before Interpolation).
1.1 xmldocs/refs/pre_page/control
rev 1.1, prev_rev 1.0
Index: control
===================================================================
# The usual comments can be used here.
# To override a field, supply a value
# To let it through unmodified, simply leave the fields empty
# id: name of the output file (defaults to <name>)
id:
# name: visible name in the pages
name:
# purpose: oneline description (MUST FILL IN)
purpose: custom subroutine to run after Variable substitution, before interpolation
# specify person(s). Defaults to icdevgroup
author:
# leave empty; GPL is the default
copyright:
see also: init_page, pre_page, post_page
1.1 xmldocs/refs/pre_page/description
rev 1.1, prev_rev 1.0
Index: description
===================================================================
Defines a Sub or GlobalSub to run
<emphasis>after</emphasis> Variable substitution and
<emphasis>before</emphasis> Interpolation on a page.
<emphasis>reference</emphasis> to the page contents
is passed to the subroutine.
1.1 xmldocs/refs/pre_page/synopsis
rev 1.1, prev_rev 1.0
Index: synopsis
===================================================================
<synopsis><![CDATA[
Pragma pre_page=<subroutine name>
]]></synopsis>
More information about the docs
mailing list