#?SuikaWikiConfig/2.0 Plugin: @Name: SuikaWikiConst09 @Description: @@@: SuikaWikiConst/0.9 assosiative array format support @@lang:en @License: %%GPL%% @Author: @@Name: @@@@: Wakaba @@@lang:ja @@@script:Latn @@Mail[list]: w@suika.fam.cx @Date.RCS: $Date: 2004/02/01 12:09:01 $ @RequiredPlugin[list]: PlainText PluginConst: @NS_XHTML1: http://www.w3.org/1999/xhtml Format: @Name: SuikaWikiConst @Version: 0.9 @ModuleName: SuikaWikiConst::V0_9 @Inherit[list]: SuikaWiki::V0 @Description: @@@: SuikaWiki/0.9 document format (Standard document format for SuikaWiki 2) @@lang:en @Converter: @@Type: text/html @@IsFragment: 1 @@Description: @@@@: Converting SuikaWikiConst/0.9 to Hypertext Markup Language fragment @@@lang:en @@Main: my $data = {}; __FUNCPACK__->text_to_hash (text => $source, hash => $data); return unless keys %{$data}; my $dl = $opt->{-parent}->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dl'); $dl->set_attribute (class => 'SuikaWikiConst SuikaWikiConst-0-9'); for my $key (sort keys %$data) { ## TODO: Use resource $dl->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dt') ->append_text ($key); $dl->append_text ("\n"); $dl->append_new_node (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'dd') ->append_text ($data->{$key}); $dl->append_text ("\n"); } Format: @Name: SuikaWikiConst @Version: 1.0 @ModuleName: SuikaWikiConst::V1_0 @Inherit[list]: SuikaWikiConst::V0_9 @Description: @@@: SuikaWikiConst/0.9 text format. SuikaWikiConst/1.0 is formally not defined, but is incorrectly used to identfy SuikaWikiConst/0.9. \ New document SHOULD NOT use this label. Function: @Name: text_to_hash @Description: @@@: Converting SuikaWikiConst/0.9 text format to Perl hash @@lang:en @Main: my (undef, %opt) = @_; my $val = ''; my $s = ${$opt{text}}; $s =~ tr/\x0D//d; for my $line (grep {$_} split /\x0A/, $s) { next if substr ($line, 0, 1) eq '#'; if ($line =~ s/^\s+\\?//) { $opt{hash}->{$val} .= length $opt{hash}->{$val} ? "\x0A" . $line : $line; } elsif ($line =~ s/:\s*$//) { $opt{hash}->{$val = $line} = ''; } }