#?SuikaWikiConfig/2.0 Plugin: @Name: WikiView @Description: @@@: WikiView interface for template context @@lang:en @License: %%GPL%% @Author: @@Name: @@@@: Wakaba @@@lang:ja @@@script:Latn @@Mail[list]: w@suika.fam.cx @Date.RCS: $Date: 2003/12/29 13:02:25 $ @Use: use Message::Markup::XML::Node qw(SGML_HEX_CHAR_REF SGML_NCR); PluginConst: @NS_XHTML1: http://www.w3.org/1999/xhtml FormattingRule: @Category[list]: view @Name: template @Description: @@@: Instantiate template. \ In addition to normal parameters, parameter name prefixed by "-" can be specified to replace "%apply-template (name => (name w/o prefix));" in instantiated template. \ Warning: Attemplt to apply template which directly or indirectly referring "parent" template will make a infinite loop. @@lang: en @Parameter: @@Name: name @@Type: name @@Default: #REQUIRED @@Description: @@@@: Template name @@@lang:en @Formatting: local $o->{var}->{wv__children} = $p; my $formatter = $o->formatter ('view'); $formatter->replace ($o->{wiki}->{view}->assemble_template ($p->{name}), param => $o, -parent => $p->{-parent}); FormattingRule: @Category[list]: view @Name: apply-template @Description: @@@: Instantiate template defined as a "-" prefixed parameter of "parent" %template; rule. @@lang: en @Parameter: @@Name: name @@Type: name @@Default: #REQUIRED @@Description: @@@@: Name of parameter defining the template, without "-" prefix @@@lang:en @Formatting: my $template = $o->{var}->{wv__children}->{'_'.$p->{name}}; if (length $template) { $o->formatter ('view')->replace ($template, param => $o, -parent => $p->{-parent}); } FormattingRule: @Category[list]: view view-resource form-input @Name: -bare-text @Formatting: $p->{-parent}->append_text ($p->{-bare_text}); FormattingRule: @Category[list]: view view-resource form-input page-link link-to-wikipage we--edit @Name: -undef @Formatting: $p->{-parent}->append_text ("[$f->{-category_name}/$rule_name: not defined]"); FormattingRule: @Category[list]: view view-resource page-link @Name: char @Description: @@@: A character @@lang: en @Parameter: @@Name: ucs @@Type: "U+hhhh / U+hhhhhh / U-hhhhhhhh" @@Default: #REQUIRED @@Description: @@@@: UCS code position of the character @@@lang:en @Formatting: __ATTRTEXT:%ucs__; if ($p->{ucs} =~ /^U\+([0-9A-Fa-f]{4,6})$/) { my $char = hex $1; if ($o->{wiki}->{var}->{client}->{downgrade}->{html_no_latin1} and $char <= 0x00FF and 0x00A0 <= $char) { $p->{-parent}->append_text ({ 0xA0 => ' ', 0xA9 => '(C)', }->{$char} || sprintf '&#x%02X;', $char); } else { $p->{-parent}->append_new_node (type => '#reference', namespace_uri => SGML_NCR, value => hex $1); } ## Note: NC4 does not support hexdecimal character reference. } elsif ($p->{ucs} =~ /^U-([0-9A-Fa-f]{8})$/) { $p->{-parent}->append_new_node (type => '#reference', namespace_uri => SGML_HEX_CHAR_REF, value => hex $1); } else { $p->{-parent}->append_new_node (type => '#reference', namespace_uri => SGML_HEX_CHAR_REF, value => 0x0000FFFD); }