#?SuikaWikiConfig/2.0 Plugin: @Name: SuikaWikiConfig20 @Description: @@@: SuikaWikiConfig/2.0 configuration format @@lang:en @License: %%Perl%% @Author: @@Name: @@@@: Wakaba @@@lang:ja @@@script:Latn @@Mail[list]: w@suika.fam.cx @Date.RCS: $Date: 2004/07/25 06:54:29 $ @RequiredPackage[list]: Message::Markup::SuikaWikiConfig20::Node Message::Markup::SuikaWikiConfig20::Parser @RequiredPlugin[list]: PlainText @Namespace: @@edit: http://suika.fam.cx/~wakaba/-temp/2004/7/25/sw-edit# PluginConst: @NS_XHTML1: http://www.w3.org/1999/xhtml Format: @Name: SuikaWikiConfig @Version: 2.0 @Type: @@@: application/x.suikawiki.config @@version: 2.0 @ModuleName: SuikaWikiConfig::V2_0 @Inherit[list]: Text::Plain @Use: use Message::Markup::XML::QName qw(NS_xml_URI); @Converter: @@Name: SuikaWikiConfig @@Version: 2.0 @@Type: @@@@: application/x.suikawiki.config @@@version: 2.0 @@Main: __FUNCPACK__->get_tree (text => $source, opt => $opt, wiki => $self->{wiki}); @Converter: @@Type: text/html @@IsFragment: 1 @@Main: my $cfg = __FUNCPACK__->get_tree (text => $source, opt => $opt, wiki => $self->{wiki}); my $comment_node_dt = SuikaWiki::Plugin->module_package ('WikiResource') ->get (name => 'SuikaWikiConfig/2.0:Type:#comment', wiki => $self->{wiki}, o => $opt->{o}); my $to_str; $to_str = sub { my ($src, $parent) = @_; my $nt = $src->node_type; if ($nt eq '#element') { $parent->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dt') ->append_text ($src->local_name); my $node = $parent->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dd'); my $value = $src->inner_text; if (length $value) { my $val = $node->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'pre'); $val->set_attribute (class => 'value'); $val->set_attribute (space => 'preserve', namespace_uri => NS_xml_URI); $val->append_text ($value); } my $ol; for (@{$src->child_nodes}) { $ol ||= $node->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dl'); $to_str->($_ => $ol); } } elsif ($nt eq '#comment') { $parent->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dt') ->append_text ($comment_node_dt); my $node = $parent->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dd'); $node->set_attribute (class => 'comment'); $node->set_attribute (space => 'preserve', namespace_uri => NS_xml_URI); $node->append_text ($src->inner_text); } else { # #document or #fragment my $dl = $parent->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dl'); $dl->set_attribute (class => 'SuikaWikiConfig-2-0'); for (@{$src->child_nodes}) { $to_str->($_ => $dl); } } }; $to_str->($cfg => $opt->{-parent}); @Prop: @@edit:new-mode--edit: edit @@edit:new-mode--adminedit: adminedit Function: @Name: get_tree @Main: my (undef, %opt) = @_; require Message::Markup::SuikaWikiConfig20::Parser; if ($opt{opt}->{page}) { unless ($__FUNCPACK__::DBLoaded) { $opt{wiki}->{db}->_set_prop_db (swc20__tree => {-db_open => sub { require SuikaWiki::DB::Hash; new SuikaWiki::DB::Hash; }}); $__FUNCPACK__::DBLoaded++; } my $parser = Message::Markup::SuikaWikiConfig20::Parser->new; my $tree = $parser->parse_text (${$opt{text}}); $opt{wiki}->{db}->set (swc20__tree => $opt{opt}->{page} => $tree); $tree; } else { Message::Markup::SuikaWikiConfig20::Parser ->new ->parse_text (${$opt{text}}); } Resource: @SuikaWikiConfig/2.0:Type:#comment: (Comment) @WikiFormat:MediaType:Description:IMT:application/x.suikawiki.config;version="2.0"##: @@@: SuikaWikiConfig/2.0 (text format), standard configuration format for SuikaWiki 3 @@lang: en @WikiFormat:MediaType:Label:IMT:application/x.suikawiki.config;version="2.0"##: @@@: SuikaWikiConfig/2.0 (text format) @@lang: en