92 |
my $tokenize_text = sub { |
my $tokenize_text = sub { |
93 |
my $s = shift; # ref |
my $s = shift; # ref |
94 |
|
|
95 |
|
my $nest_level = 0; |
96 |
|
|
97 |
if ($$s =~ s/^\[([0-9]+)\]//) { |
if ($$s =~ s/^\[([0-9]+)\]//) { |
98 |
push @nt, {type => ELEMENT_TOKEN, |
push @nt, {type => ELEMENT_TOKEN, |
99 |
local_name => 'anchor-end', namespace => SW09_NS, |
local_name => 'anchor-end', namespace => SW09_NS, |
119 |
push @param, $n; |
push @param, $n; |
120 |
$column++ if $$s =~ s/\A\\\z//; |
$column++ if $$s =~ s/\A\\\z//; |
121 |
$column++ if $$s =~ s/^'//; |
$column++ if $$s =~ s/^'//; |
122 |
} elsif ($$s =~ s/^([^':][^:]*)//) { |
} elsif ($$s =~ s/^([^':\]][^:\]]*)//) { |
123 |
$column += 1 + $+[0] - $-[0]; |
$column += 1 + $+[0] - $-[0]; |
124 |
push @param, $1; |
push @param, $1; |
125 |
} |
} |
130 |
} elsif ($$s =~ s/^\[\[//) { |
} elsif ($$s =~ s/^\[\[//) { |
131 |
push @nt, {type => INLINE_START_TAG_TOKEN}; |
push @nt, {type => INLINE_START_TAG_TOKEN}; |
132 |
$column += 2; |
$column += 2; |
133 |
} elsif ($$s =~ s/^\[([A-Z]+)(?>\(([^()\\]*)\))?(?>\@[0-9A-Za-z-]*)?\[//) { |
$nest_level++; |
134 |
|
} elsif ($$s =~ s/^\[([A-Z]+)(?>\(([^()\\]*)\))?(?>\@([0-9A-Za-z-]*))?\[//) { |
135 |
push @nt, {type => INLINE_START_TAG_TOKEN, |
push @nt, {type => INLINE_START_TAG_TOKEN, |
136 |
tag_name => $1, classes => $2, language => $3, |
tag_name => $1, classes => $2, language => $3, |
137 |
line => $line, column => $column}; |
line => $line, column => $column}; |
138 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
139 |
|
$nest_level++; |
140 |
} elsif ($$s =~ s/^\]\]//) { |
} elsif ($$s =~ s/^\]\]//) { |
141 |
push @nt, {type => INLINE_END_TAG_TOKEN, |
push @nt, {type => INLINE_END_TAG_TOKEN, |
142 |
line => $line, column => $column}; |
line => $line, column => $column}; |
143 |
$column += 2; |
$column += 2; |
144 |
|
$nest_level-- if $nest_level > 0; |
145 |
} elsif ($$s =~ s/^(\]?)<([0-9A-Za-z%+._-]+)://) { |
} elsif ($$s =~ s/^(\]?)<([0-9A-Za-z%+._-]+)://) { |
146 |
my $t = {type => $1 ? INLINE_END_TAG_TOKEN : ELEMENT_TOKEN, |
my $t = {type => $1 ? INLINE_END_TAG_TOKEN : ELEMENT_TOKEN, |
147 |
res_scheme => $2, res_parameter => '', |
res_scheme => $2, res_parameter => '', |
156 |
$t->{res_parameter} .= $1; |
$t->{res_parameter} .= $1; |
157 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
158 |
$column++ if $$s =~ s/\A\\\z//; |
$column++ if $$s =~ s/\A\\\z//; |
159 |
$column++ if $$s =~ s/^"//; |
$t->{res_parameter} .= '"' and $column++ if $$s =~ s/^"//; |
160 |
} else { |
} else { |
161 |
last; |
last; |
162 |
} |
} |
172 |
|
|
173 |
if ($t->{type} == INLINE_END_TAG_TOKEN) { |
if ($t->{type} == INLINE_END_TAG_TOKEN) { |
174 |
$column++ if $$s =~ s/^\]//; |
$column++ if $$s =~ s/^\]//; |
175 |
|
$nest_level-- if $nest_level > 0; |
176 |
} else { |
} else { |
177 |
$t->{local_name} = 'anchor-external'; |
$t->{local_name} = 'anchor-external'; |
178 |
$t->{namespace} = SW09_NS; |
$t->{namespace} = SW09_NS; |
183 |
anchor => $1, |
anchor => $1, |
184 |
line => $line, column => $column}; |
line => $line, column => $column}; |
185 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
186 |
} elsif ($$s =~ s/^\][\x09\x20]*(?>\@([0-9a-zA-Z-]*))?\[//) { |
$nest_level-- if $nest_level > 0; |
187 |
|
} elsif ($nest_level > 0 and |
188 |
|
$$s =~ s/^\][\x09\x20]*(?>\@([0-9a-zA-Z-]*))?\[//) { |
189 |
push @nt, {type => INLINE_MIDDLE_TAG_TOKEN, |
push @nt, {type => INLINE_MIDDLE_TAG_TOKEN, |
190 |
language => $1, |
language => $1, |
191 |
line => $line, column => $column}; |
line => $line, column => $column}; |
192 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
193 |
} elsif ($$s =~ s/\^''('?)//) { |
} elsif ($$s =~ s/^''('?)//) { |
194 |
push @nt, {type => $1 ? STRONG_TOKEN : EMPHASIS_TOKEN, |
push @nt, {type => $1 ? STRONG_TOKEN : EMPHASIS_TOKEN, |
195 |
line => $line, column => $column}; |
line => $line, column => $column}; |
196 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
197 |
} elsif ($$s =~ s/^>>([0-9]+)//) { |
} elsif ($$s =~ s/^>>([0-9]+)//) { |
198 |
push @nt, {type => ELEMENT_TOKEN, |
push @nt, {type => ELEMENT_TOKEN, |
199 |
local_name => 'anchor-internal', namespace => SW09_NS, |
local_name => 'anchor-internal', namespace => SW09_NS, |
200 |
anchor => $1, |
anchor => $1, content => '>>' . $1, |
201 |
line => $line, column => $column}; |
line => $line, column => $column}; |
202 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
203 |
} elsif ($$s =~ s/^__&&//) { |
} elsif ($$s =~ s/^__&&//) { |
213 |
line => $line, column => $column}; |
line => $line, column => $column}; |
214 |
$column += 4; |
$column += 4; |
215 |
} |
} |
216 |
} elsif ($$s =~ s/^([^<>\['_]+)//) { |
} elsif ($$s =~ s/^([^<>\[\]'_]+)//) { |
217 |
push @nt, {type => CHARACTER_TOKEN, data => $1, |
push @nt, {type => CHARACTER_TOKEN, data => $1, |
218 |
line => $line, column => $column}; |
line => $line, column => $column}; |
219 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
296 |
$name =~ s/\A[\x09\x20]*//; |
$name =~ s/\A[\x09\x20]*//; |
297 |
$column += 1 + $+[0] - $-[0]; |
$column += 1 + $+[0] - $-[0]; |
298 |
$name =~ s/[\x09\x20]+\z//; |
$name =~ s/[\x09\x20]+\z//; |
299 |
$tokenize_text->(\$s); |
$tokenize_text->(\$name); |
300 |
$column = $real_column; |
$column = $real_column; |
301 |
push @nt, {type => LABELED_LIST_MIDDLE_TOKEN, |
push @nt, {type => LABELED_LIST_MIDDLE_TOKEN, |
302 |
line => $line, column => $column}; |
line => $line, column => $column}; |
313 |
if $continuous_line; |
if $continuous_line; |
314 |
$s = '>>' . $s; |
$s = '>>' . $s; |
315 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
316 |
|
$continuous_line = 1; |
317 |
} else { |
} else { |
318 |
push @nt, {type => QUOTATION_START_TOKEN, depth => $depth, |
push @nt, {type => QUOTATION_START_TOKEN, depth => $depth, |
319 |
line => $line, column => $column}; |
line => $line, column => $column}; |
323 |
push @nt, {type => EDITORIAL_NOTE_START_TOKEN, |
push @nt, {type => EDITORIAL_NOTE_START_TOKEN, |
324 |
line => $line, column => $column}; |
line => $line, column => $column}; |
325 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
326 |
|
$continuous_line = 1; |
327 |
} elsif ($s =~ s/^;;[\x09\x20]*//) { |
} elsif ($s =~ s/^;;[\x09\x20]*//) { |
328 |
push @nt, {type => COMMENT_PARAGRAPH_START_TOKEN, |
push @nt, {type => COMMENT_PARAGRAPH_START_TOKEN, |
329 |
line => $line, column => $column}; |
line => $line, column => $column}; |
330 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
331 |
|
$continuous_line = 1; |
332 |
|
} elsif (length $s) { |
333 |
|
$continuous_line = 1; |
334 |
|
} else { |
335 |
|
$continuous_line = 0; |
336 |
} |
} |
337 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
338 |
} |
} |
|
$continuous_line = 1; |
|
339 |
return shift @nt; |
return shift @nt; |
340 |
} elsif ($s =~ /\A\[(INS|DEL)(?>\(([^()\\]*)\))?\[[\x09\x20]*\z/) { |
} elsif ($s =~ /\A\[(INS|DEL)(?>\(([^()\\]*)\))?\[[\x09\x20]*\z/) { |
341 |
undef $continuous_line; |
undef $continuous_line; |
376 |
line => $line, column => $column}; |
line => $line, column => $column}; |
377 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
378 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
379 |
undef $continuous_line; |
$continuous_line = 1; |
380 |
return shift @nt; |
return shift @nt; |
381 |
} elsif ($s =~ /\A\](INS|DEL)\][\x09\x20]*\z/) { |
} elsif ($s =~ /\A\](INS|DEL)\][\x09\x20]*\z/) { |
382 |
$continuous_line = 1; |
$continuous_line = 1; |
449 |
}; # $get_next_token |
}; # $get_next_token |
450 |
|
|
451 |
## NOTE: The "initial" mode. |
## NOTE: The "initial" mode. |
452 |
if (@s and $s[0] =~ /^#\?/) { |
if (@s and $s[0] =~ s/^#\?//) { |
453 |
## NOTE: "Parse a magic line". |
## NOTE: "Parse a magic line". |
454 |
|
|
455 |
my $s = shift @s; |
my $s = shift @s; |
463 |
} |
} |
464 |
|
|
465 |
while (length $s) { |
while (length $s) { |
466 |
$column += $+[0] - $-[0] if $s =~ s/^[\x09\x20]+//; |
$column += $+[0] - $-[0] and next if $s =~ s/^[\x09\x20]+//; |
467 |
my $name = ''; |
my $name = ''; |
468 |
if ($s =~ s/^([^=]*)=//) { |
if ($s =~ s/^([^=]*)=//) { |
469 |
$name = $1; |
$name = $1; |
476 |
$head_el->append_child ($param); |
$head_el->append_child ($param); |
477 |
|
|
478 |
$column++ if $s =~ s/^"//; |
$column++ if $s =~ s/^"//; |
479 |
if ($s =~ s/^([^"]+)//) { |
if ($s =~ s/^([^"]*)//) { |
480 |
my $values = $1; |
my $values = $1; |
481 |
$column += length $values; |
$column += length $values; |
482 |
$values =~ tr/\\//d; |
$values =~ tr/\\//d; |
483 |
for (split /,/, $values, -1) { |
my @values = split /,/, $values, -1; |
484 |
|
push @values, '' unless length $values; |
485 |
|
for (@values) { |
486 |
my $value = $doc->create_element_ns (SW09_NS, [undef, 'value']); |
my $value = $doc->create_element_ns (SW09_NS, [undef, 'value']); |
487 |
$value->text_content ($_); |
$value->text_content ($_); |
488 |
$value->set_user_data (manakai_source_line => $line); |
$value->set_user_data (manakai_source_line => $line); |
544 |
Q => [HTML_NS, 'q'], |
Q => [HTML_NS, 'q'], |
545 |
QN => [SW10_NS, 'qn'], |
QN => [SW10_NS, 'qn'], |
546 |
RUBY => [HTML_NS, 'ruby'], |
RUBY => [HTML_NS, 'ruby'], |
547 |
RUBYB => [HTML_NS, 'rubyb'], |
RUBYB => [SW09_NS, 'rubyb'], |
548 |
SAMP => [HTML_NS, 'samp'], |
SAMP => [HTML_NS, 'samp'], |
549 |
SPAN => [HTML_NS, 'span'], |
SPAN => [HTML_NS, 'span'], |
550 |
SRC => [SW10_NS, 'src'], |
SRC => [SW10_NS, 'src'], |
554 |
VAR => [HTML_NS, 'var'], |
VAR => [HTML_NS, 'var'], |
555 |
WEAK => [SW09_NS, 'weak'], |
WEAK => [SW09_NS, 'weak'], |
556 |
}->{$token->{tag_name}} || [SW10_NS, $token->{tag_name}]; |
}->{$token->{tag_name}} || [SW10_NS, $token->{tag_name}]; |
557 |
my $el = $doc->create_element_ns (SW10_NS, [undef, 'td']); |
my $el = $doc->create_element_ns ($type->[0], [undef, $type->[1]]); |
558 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
559 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
push @$oe, {%{$oe->[-1]}, node => $el}; |
560 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
597 |
|
|
598 |
if ({%$structural_elements, |
if ({%$structural_elements, |
599 |
strong => 1, em => 1}->{$oe->[-1]->{node}->manakai_local_name}) { |
strong => 1, em => 1}->{$oe->[-1]->{node}->manakai_local_name}) { |
600 |
my $el = $doc->create_element_ns |
unless (defined $token->{res_scheme} or defined $token->{anchor}) { |
601 |
(SW09_NS, |
$oe->[-1]->{node}->manakai_append_text (']]'); |
602 |
[undef, defined $token->{res_scheme} |
push @$oe, $oe->[-1]; |
603 |
? 'anchor-external' : 'anchor-internal']); |
} else { |
604 |
$oe->[-1]->{node}->append_child ($el); |
my $el = $doc->create_element_ns |
605 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
(SW09_NS, |
606 |
$el->set_user_data (manakai_source_line => $token->{line}); |
[undef, defined $token->{res_scheme} |
607 |
$el->set_user_data (manakai_source_column => $token->{column}); |
? 'anchor-external' : 'anchor-internal']); |
608 |
$el->text_content (']]'); |
$oe->[-1]->{node}->append_child ($el); |
609 |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
610 |
|
$el->set_user_data (manakai_source_line => $token->{line}); |
611 |
|
$el->set_user_data (manakai_source_column => $token->{column}); |
612 |
|
$el->text_content (']]'); |
613 |
|
} |
614 |
} |
} |
615 |
|
|
616 |
$oe->[-1]->{node}->set_attribute_ns (SW09_NS, ['sw', 'anchor'], |
$oe->[-1]->{node}->set_attribute_ns (SW09_NS, ['sw', 'anchor'], |
628 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
629 |
redo A; |
redo A; |
630 |
} elsif ($token->{type} == STRONG_TOKEN) { |
} elsif ($token->{type} == STRONG_TOKEN) { |
631 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'strong']); |
if ($oe->[-1]->{node}->manakai_local_name eq 'strong') { |
632 |
$oe->[-1]->{node}->append_child ($el); |
pop @$oe; |
633 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
} else { |
634 |
$el->set_user_data (manakai_source_line => $token->{line}); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'strong']); |
635 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$oe->[-1]->{node}->append_child ($el); |
636 |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
637 |
|
$el->set_user_data (manakai_source_line => $token->{line}); |
638 |
|
$el->set_user_data (manakai_source_column => $token->{column}); |
639 |
|
} |
640 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
641 |
redo A; |
redo A; |
642 |
} elsif ($token->{type} == EMPHASIS_TOKEN) { |
} elsif ($token->{type} == EMPHASIS_TOKEN) { |
643 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'em']); |
if ($oe->[-1]->{node}->manakai_local_name eq 'em') { |
644 |
$oe->[-1]->{node}->append_child ($el); |
pop @$oe; |
645 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
} else { |
646 |
$el->set_user_data (manakai_source_line => $token->{line}); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'em']); |
647 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$oe->[-1]->{node}->append_child ($el); |
648 |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
649 |
|
$el->set_user_data (manakai_source_line => $token->{line}); |
650 |
|
$el->set_user_data (manakai_source_column => $token->{column}); |
651 |
|
} |
652 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
653 |
redo A; |
redo A; |
654 |
} elsif ($token->{type} == FORM_TOKEN) { |
} elsif ($token->{type} == FORM_TOKEN) { |
656 |
if ($token->{name} eq 'form') { |
if ($token->{name} eq 'form') { |
657 |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
658 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
659 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
660 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
661 |
|
|
663 |
=> $token->{id}) if defined $token->{id}; |
=> $token->{id}) if defined $token->{id}; |
664 |
$el->set_attribute_ns (undef, [undef, 'input'] |
$el->set_attribute_ns (undef, [undef, 'input'] |
665 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
666 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
667 |
$el->set_attribute_ns (undef, [undef, 'template'] |
$el->set_attribute_ns (undef, [undef, 'template'] |
668 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
669 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
670 |
$el->set_attribute_ns (undef, [undef, 'option'] |
$el->set_attribute_ns (undef, [undef, 'option'] |
671 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
672 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
673 |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
674 |
=> join ':', @{$token->{parameters}}) |
=> join ':', @{$token->{parameters}}) |
675 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
676 |
|
|
677 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
678 |
redo A; |
redo A; |
679 |
} else { |
} else { |
680 |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
681 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
682 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
683 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
684 |
|
|
688 |
=> $token->{id}) if defined $token->{id}; |
=> $token->{id}) if defined $token->{id}; |
689 |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
690 |
=> join ':', @{$token->{parameters}}) |
=> join ':', @{$token->{parameters}}) |
691 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
692 |
|
|
693 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
694 |
redo A; |
redo A; |
698 |
my $el = $doc->create_element_ns |
my $el = $doc->create_element_ns |
699 |
($token->{namespace}, [undef, $token->{local_name}]); |
($token->{namespace}, [undef, $token->{local_name}]); |
700 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
701 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
702 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
703 |
|
|
720 |
->{$oe->[-1]->{node}->manakai_local_name}; |
->{$oe->[-1]->{node}->manakai_local_name}; |
721 |
pop @$oe if $oe->[-1]->{node}->manakai_local_name eq 'dt'; |
pop @$oe if $oe->[-1]->{node}->manakai_local_name eq 'dt'; |
722 |
|
|
723 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'dt']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'dd']); |
724 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
725 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
push @$oe, {%{$oe->[-1]}, node => $el}; |
726 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
811 |
if not {body => 1, section => 1, insert => 1, delete => 1, |
if not {body => 1, section => 1, insert => 1, delete => 1, |
812 |
blockquote => 1} |
blockquote => 1} |
813 |
->{$oe->[-1]->{node}->manakai_local_name} or |
->{$oe->[-1]->{node}->manakai_local_name} or |
814 |
$token->{depth} <= $oe->[-1]->{quotation_depth}; |
$token->{depth} < $oe->[-1]->{quotation_depth}; |
815 |
if ($token->{depth} > $oe->[-1]->{quotation_depth} + 1) { |
if ($token->{depth} > $oe->[-1]->{quotation_depth}) { |
816 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'blockquote']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'blockquote']); |
817 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
818 |
push @$oe, {node => $el, section_depth => 0, |
push @$oe, {node => $el, section_depth => 0, |
822 |
} |
} |
823 |
} # B |
} # B |
824 |
|
|
|
my $el = $doc->create_element_ns (HTML_NS, [undef, 'blockquote']); |
|
|
$oe->[-1]->{node}->append_child ($el); |
|
|
push @$oe, {node => $el, section_depth => 0, |
|
|
quotation_depth => $oe->[-1]->{quotation_depth} + 1, |
|
|
list_depth => 0}; |
|
|
|
|
825 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
826 |
redo A; |
redo A; |
827 |
} elsif ($token->{type} == LIST_START_TOKEN) { |
} elsif ($token->{type} == LIST_START_TOKEN) { |
937 |
} else { |
} else { |
938 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
939 |
} |
} |
940 |
|
undef $continuous_line; |
941 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
942 |
redo A; |
redo A; |
943 |
} elsif ($token->{type} == FORM_TOKEN) { |
} elsif ($token->{type} == FORM_TOKEN) { |
945 |
if ($token->{name} eq 'form') { |
if ($token->{name} eq 'form') { |
946 |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
947 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
948 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
949 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
950 |
|
|
952 |
=> $token->{id}) if defined $token->{id}; |
=> $token->{id}) if defined $token->{id}; |
953 |
$el->set_attribute_ns (undef, [undef, 'input'] |
$el->set_attribute_ns (undef, [undef, 'input'] |
954 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
955 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
956 |
$el->set_attribute_ns (undef, [undef, 'template'] |
$el->set_attribute_ns (undef, [undef, 'template'] |
957 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
958 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
959 |
$el->set_attribute_ns (undef, [undef, 'option'] |
$el->set_attribute_ns (undef, [undef, 'option'] |
960 |
=> shift @{$token->{parameters}}) |
=> shift @{$token->{parameters}}) |
961 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
962 |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
963 |
=> join ':', @{$token->{parameters}}) |
=> join ':', @{$token->{parameters}}) |
964 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
965 |
|
|
966 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
967 |
redo A; |
redo A; |
968 |
} else { |
} else { |
969 |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
my $el = $doc->create_element_ns (SW09_NS, [undef, 'form']); |
970 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
971 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
972 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
973 |
|
|
976 |
=> $token->{id}) if defined $token->{id}; |
=> $token->{id}) if defined $token->{id}; |
977 |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
978 |
=> join ':', @{$token->{parameters}}) |
=> join ':', @{$token->{parameters}}) |
979 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
980 |
|
|
981 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
982 |
redo A; |
redo A; |
987 |
my $el = $doc->create_element_ns |
my $el = $doc->create_element_ns |
988 |
($token->{namespace}, [undef, $token->{local_name}]); |
($token->{namespace}, [undef, $token->{local_name}]); |
989 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
990 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
991 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
992 |
|
|
1015 |
TABLE_COLSPAN_CELL_TOKEN => 1}->{$token->{type}}) { |
TABLE_COLSPAN_CELL_TOKEN => 1}->{$token->{type}}) { |
1016 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
1017 |
} else { |
} else { |
1018 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'p']); |
unless ({dd => 1, |
1019 |
$oe->[-1]->{node}->append_child ($el); |
li => 1, |
1020 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
'comment-p' => 1, |
1021 |
|
ed => 1}->{$oe->[-1]->{node}->manakai_local_name}) { |
1022 |
|
my $el = $doc->create_element_ns (HTML_NS, [undef, 'p']); |
1023 |
|
$oe->[-1]->{node}->append_child ($el); |
1024 |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
1025 |
|
} |
1026 |
|
|
1027 |
$im = IN_PARAGRAPH_IM; |
$im = IN_PARAGRAPH_IM; |
1028 |
## Reprocess. |
## Reprocess. |
1029 |
redo A; |
redo A; |
1044 |
if ($lc and $lc->manakai_local_name eq 'td') { |
if ($lc and $lc->manakai_local_name eq 'td') { |
1045 |
$lc->set_attribute_ns |
$lc->set_attribute_ns |
1046 |
(undef, [undef, 'colspan'], |
(undef, [undef, 'colspan'], |
1047 |
($lc->get_attribute_ns (undef, 'colspan') || 0) + 1); |
($lc->get_attribute_ns (undef, 'colspan') || 1) + 1); |
1048 |
} else { |
} else { |
1049 |
my $el = $doc->create_element_ns (SW10_NS, [undef, 'td']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'td']); |
1050 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
1051 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
1052 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |