| 27 |
\ \( (\w+) \) ## id |
\ \( (\w+) \) ## id |
| 28 |
\ )? |
\ )? |
| 29 |
\ : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## input |
\ : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## input |
| 30 |
\ (?: : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## template |
\ (?> : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' ## template |
| 31 |
\ (?: : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' )? )? ## option |
\ (?> : ' ((?>[^\\']*)(?>(?>[^\\']+|\\.)*)) ' )? )? ## option |
| 32 |
}x; |
}x; |
| 33 |
my $Reg_Embed_Content_M = qr{ |
my $Reg_Embed_Content_M = qr{ |
| 34 |
\ \#([a-z-]+) |
\ \#([a-z-]+) |
| 48 |
\ )* |
\ )* |
| 49 |
\ ) |
\ ) |
| 50 |
}x; |
}x; |
| 51 |
my $WIKIRESOURCE; |
|
| 52 |
|
my ($WIKIRESOURCE, $WIKISTRUCT, $WIKIFORMCORE, $WIKILINKING); |
| 53 |
|
|
| 54 |
PluginConst: |
PluginConst: |
| 55 |
@NS_SW09: |
@NS_SW09: |
| 60 |
http://www.w3.org/1999/xhtml |
http://www.w3.org/1999/xhtml |
| 61 |
@NS_XHTML2: |
@NS_XHTML2: |
| 62 |
http://www.w3.org/2002/06/xhtml2 |
http://www.w3.org/2002/06/xhtml2 |
| 63 |
|
@WIKIFORMCORE: |
| 64 |
|
{($WIKIFORMCORE ||= SuikaWiki::Plugin->module_package ('WikiFormCore'))} |
| 65 |
|
@WIKILINKING: |
| 66 |
|
{($WIKILINKING ||= SuikaWiki::Plugin->module_package ('WikiLinking'))} |
| 67 |
@WIKIRESOURCE: |
@WIKIRESOURCE: |
| 68 |
{($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))} |
{($WIKIRESOURCE ||= SuikaWiki::Plugin->module_package ('WikiResource'))} |
| 69 |
|
@WIKISTRUCT: |
| 70 |
|
{($WIKISTRUCT ||= SuikaWiki::Plugin->module_package ('WikiStruct'))} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
|
| 74 |
Format: |
Format: |
| 75 |
@ModuleName: |
@ModuleName: |
| 241 |
} |
} |
| 242 |
} |
} |
| 243 |
} |
} |
| 244 |
CORE::die "Buggy implementation: no body element".$xml unless ref $parent; |
CORE::die "Buggy implementation: no body element".$xml |
| 245 |
|
unless ref $parent; |
| 246 |
|
|
| 247 |
$parent->append_new_node (type => '#element', |
$parent->append_new_node (type => '#element', |
| 248 |
namespace_uri => $NS_SW09, |
namespace_uri => $NS_SW09, |
| 328 |
$get_anchor_no = sub { |
$get_anchor_no = sub { |
| 329 |
my $node = shift; |
my $node = shift; |
| 330 |
for my $child (@{$node->child_nodes}) { |
for my $child (@{$node->child_nodes}) { |
| 331 |
if ($child->node_type eq '#element') { |
my $nt = $child->node_type; |
| 332 |
|
if ($nt eq '#element') { |
| 333 |
if ($child->namespace_uri => $NS_SW09 and |
if ($child->namespace_uri => $NS_SW09 and |
| 334 |
$child->local_name eq 'anchor-end') { |
$child->local_name eq 'anchor-end') { |
| 335 |
my $a = $child->get_attribute_value ('anchor', default => 0, |
my $a = $child->get_attribute_value ('anchor', default => 0, |
| 338 |
} else { |
} else { |
| 339 |
$get_anchor_no->($child); |
$get_anchor_no->($child); |
| 340 |
} |
} |
| 341 |
} elsif ($child->node_type eq '#document' or |
} elsif ($nt eq '#document' or $nt eq '#fragment') { |
|
$child->node_type eq '#fragment') { |
|
| 342 |
$get_anchor_no->($child); |
$get_anchor_no->($child); |
| 343 |
} |
} |
| 344 |
} |
} |
| 379 |
|
|
| 380 |
my ($apply_template, $apply_template_children); |
my ($apply_template, $apply_template_children); |
| 381 |
$apply_template_children = sub { |
$apply_template_children = sub { |
| 382 |
my ($parent, $result) = @_; |
for (@{$_[0]->child_nodes}) { |
| 383 |
for (@{$parent->child_nodes}) { |
$apply_template->($_ => $_[1]) unless $_->node_type eq '#attribute'; |
|
$apply_template->($_ => $result) unless $_->node_type eq '#attribute'; |
|
| 384 |
} |
} |
| 385 |
}; |
}; |
| 386 |
$apply_template = sub { |
$apply_template = sub { |
| 426 |
}; |
}; |
| 427 |
SuikaWiki::Plugin->module_package ('WikiLinking') |
SuikaWiki::Plugin->module_package ('WikiLinking') |
| 428 |
->to_wikipage_in_html ({ |
->to_wikipage_in_html ({ |
| 429 |
label => SuikaWiki::Plugin->module_package ('WikiResource') |
label => $WIKIRESOURCE->get_text |
|
->get_text |
|
| 430 |
(name => |
(name => |
| 431 |
'Link:SuikaWiki/0.9:toWikiPage:SourceLabel', |
'Link:SuikaWiki/0.9:toWikiPage:SourceLabel', |
| 432 |
param => $opt{o}, |
param => $opt{o}, |
| 463 |
->{ws__section_depth}); |
->{ws__section_depth}); |
| 464 |
} |
} |
| 465 |
$apply_template_children->($source => $node); |
$apply_template_children->($source => $node); |
| 466 |
SuikaWiki::Plugin->module_package ('WikiStruct') |
$WIKISTRUCT->set_section_id ($result, undef, $opt{o}->{wiki}, |
|
->set_section_id ($result, undef, $opt{o}->{wiki}, |
|
| 467 |
title => $source->inner_text); |
title => $source->inner_text); |
| 468 |
} elsif ($ln eq 'ruby' or $ln eq 'rubyb') { |
} elsif ($ln eq 'ruby' or $ln eq 'rubyb') { |
| 469 |
my @child; |
my @child; |
| 579 |
local $opt{o}->{var}->{sw09__anchor_content} = sub { |
local $opt{o}->{var}->{sw09__anchor_content} = sub { |
| 580 |
$apply_template_children->($source => shift); |
$apply_template_children->($source => shift); |
| 581 |
}; |
}; |
| 582 |
SuikaWiki::Plugin->module_package ('WikiLinking') |
$WIKILINKING |
| 583 |
->to_resource_in_html ( |
->to_resource_in_html ( |
| 584 |
{ |
{ |
| 585 |
label => SuikaWiki::Plugin->module_package ('WikiResource') |
label => $WIKIRESOURCE |
| 586 |
->get_text (name => |
->get_text (name => |
| 587 |
'Link:SuikaWiki/0.9:toResource:SourceLabel', |
'Link:SuikaWiki/0.9:toResource:SourceLabel', |
| 588 |
param => $opt{o}, |
param => $opt{o}, |
| 603 |
} elsif ($ln eq 'form') { |
} elsif ($ln eq 'form') { |
| 604 |
my $ref = $source->get_attribute_value ('ref', default => 'form'); |
my $ref = $source->get_attribute_value ('ref', default => 'form'); |
| 605 |
if ($ref eq 'form') { |
if ($ref eq 'form') { |
| 606 |
SuikaWiki::Plugin->module_package ('WikiFormCore') |
$WIKIFORMCORE->make_content_form_in_html |
|
->make_content_form_in_html |
|
| 607 |
($result, |
($result, |
| 608 |
$source->get_attribute_value |
$source->get_attribute_value |
| 609 |
('input', default => ''), |
('input', default => ''), |
| 616 |
page => $opt{page}, |
page => $opt{page}, |
| 617 |
}); |
}); |
| 618 |
} elsif ($ref eq 'comment') { |
} elsif ($ref eq 'comment') { |
| 619 |
SuikaWiki::Plugin->module_package ('WikiFormCore') |
$WIKIFORMCORE->make_content_form_in_html |
|
->make_content_form_in_html |
|
| 620 |
($result, |
($result, |
| 621 |
$WIKIRESOURCE->get |
$WIKIRESOURCE->get |
| 622 |
(name => 'SuikaWiki/0.9:form:comment:input', |
(name => 'SuikaWiki/0.9:form:comment:input', |
| 1443 |
namespace_uri => $NS_XHTML2, |
namespace_uri => $NS_XHTML2, |
| 1444 |
local_name => 'dd'); |
local_name => 'dd'); |
| 1445 |
__FUNCPACK__->inline_text_to_xml (\$line => $current, %opt); |
__FUNCPACK__->inline_text_to_xml (\$line => $current, %opt); |
| 1446 |
} elsif ($line =~ /^\[(INS|DEL)(\([^()\\]*\))?\[\s*$/) { |
} elsif ($line =~ /^\[(INS|DEL)(?>(\([^()\\]*\))?)\[\s*$/) { |
| 1447 |
$current->append_text ("\x0A"); |
$current->append_text ("\x0A"); |
| 1448 |
my $mod = $current->append_new_node |
my $mod = $current->append_new_node |
| 1449 |
(type => '#element', |
(type => '#element', |
| 1459 |
} else { |
} else { |
| 1460 |
## TODO: warn |
## TODO: warn |
| 1461 |
} |
} |
| 1462 |
} elsif ($line =~ /^\[PRE(\([^()\\]*\))?\[\s*$/) { |
} elsif ($line =~ /^\[PRE((?>\([^()\\]*\))?)\[\s*$/) { |
| 1463 |
$current->append_text ("\x0A"); |
$current->append_text ("\x0A"); |
| 1464 |
my $pre = $current->append_new_node (type => '#element', |
my $pre = $current->append_new_node (type => '#element', |
| 1465 |
namespace_uri => $NS_XHTML1, |
namespace_uri => $NS_XHTML1, |
| 1611 |
SuikaWiki/0.9 text format to XML representation - inline level elements |
SuikaWiki/0.9 text format to XML representation - inline level elements |
| 1612 |
@@lang:en |
@@lang:en |
| 1613 |
@Main: |
@Main: |
| 1614 |
|
my (undef, $source => $current, %opt) = @_; |
| 1615 |
|
|
| 1616 |
my $ElementDef = { |
my $ElementDef = { |
| 1617 |
ABBR => {ln => 'abbr', ns_uri => $NS_XHTML2}, |
ABBR => {ln => 'abbr', ns_uri => $NS_XHTML2}, |
| 1618 |
CODE => {ln => 'code', ns_uri => $NS_XHTML2}, |
CODE => {ln => 'code', ns_uri => $NS_XHTML2}, |
| 1636 |
rt => {ln => 'rt', ns_uri => $NS_XHTML2, is_nested => 1}, |
rt => {ln => 'rt', ns_uri => $NS_XHTML2, is_nested => 1}, |
| 1637 |
}; |
}; |
| 1638 |
|
|
|
my (undef, $source => $current, %opt) = @_; |
|
| 1639 |
if ($$source =~ /\G\[([0-9]+)\]/gc) { |
if ($$source =~ /\G\[([0-9]+)\]/gc) { |
| 1640 |
for ($current->append_new_node (type => '#element', |
for ($current->append_new_node (type => '#element', |
| 1641 |
namespace_uri => $NS_SW09, |
namespace_uri => $NS_SW09, |
| 1734 |
namespace_uri => $NS_XHTML2, |
namespace_uri => $NS_XHTML2, |
| 1735 |
local_name => $type); |
local_name => $type); |
| 1736 |
} |
} |
| 1737 |
} elsif ($$source =~ /\G<([0-9A-Za-z_+.%-]+):($Reg_URI_Opaque)>/gc) { |
} elsif ($$source =~ /\G<([0-9A-Za-z_+.%-]+):($Reg_URI_Opaque)>/gco) { |
| 1738 |
my ($scheme, $data) = ($1, $2); |
my ($scheme, $data) = ($1, $2); |
| 1739 |
my $link = $current->append_new_node |
my $link = $current->append_new_node |
| 1740 |
(type => '#element', |
(type => '#element', |
| 1802 |
if ($o->{var}->{sw09__anchor_content}) { |
if ($o->{var}->{sw09__anchor_content}) { |
| 1803 |
$o->{var}->{sw09__anchor_content}->($p->{-parent}); |
$o->{var}->{sw09__anchor_content}->($p->{-parent}); |
| 1804 |
} else { |
} else { |
| 1805 |
SuikaWiki::Plugin->module_package ('WikiResource') |
$WIKIRESOURCE->append_tree |
|
->append_tree |
|
| 1806 |
(name => 'Link:SuikaWiki/0.9:link-anchor-content:InvalidContext', |
(name => 'Link:SuikaWiki/0.9:link-anchor-content:InvalidContext', |
| 1807 |
param => $o, |
param => $o, |
| 1808 |
-parent => $p->{-parent}, |
-parent => $p->{-parent}, |