205 |
line => $line, column => $column}; |
line => $line, column => $column}; |
206 |
$column += 4; |
$column += 4; |
207 |
} |
} |
208 |
} elsif ($$s =~ s/^([^<>\['_]+)//) { |
} elsif ($$s =~ s/^([^<>\[\]'_]+)//) { |
209 |
push @nt, {type => CHARACTER_TOKEN, data => $1, |
push @nt, {type => CHARACTER_TOKEN, data => $1, |
210 |
line => $line, column => $column}; |
line => $line, column => $column}; |
211 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
288 |
$name =~ s/\A[\x09\x20]*//; |
$name =~ s/\A[\x09\x20]*//; |
289 |
$column += 1 + $+[0] - $-[0]; |
$column += 1 + $+[0] - $-[0]; |
290 |
$name =~ s/[\x09\x20]+\z//; |
$name =~ s/[\x09\x20]+\z//; |
291 |
$tokenize_text->(\$s); |
$tokenize_text->(\$name); |
292 |
$column = $real_column; |
$column = $real_column; |
293 |
push @nt, {type => LABELED_LIST_MIDDLE_TOKEN, |
push @nt, {type => LABELED_LIST_MIDDLE_TOKEN, |
294 |
line => $line, column => $column}; |
line => $line, column => $column}; |
305 |
if $continuous_line; |
if $continuous_line; |
306 |
$s = '>>' . $s; |
$s = '>>' . $s; |
307 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
308 |
|
$continuous_line = 1; |
309 |
} else { |
} else { |
310 |
push @nt, {type => QUOTATION_START_TOKEN, depth => $depth, |
push @nt, {type => QUOTATION_START_TOKEN, depth => $depth, |
311 |
line => $line, column => $column}; |
line => $line, column => $column}; |
315 |
push @nt, {type => EDITORIAL_NOTE_START_TOKEN, |
push @nt, {type => EDITORIAL_NOTE_START_TOKEN, |
316 |
line => $line, column => $column}; |
line => $line, column => $column}; |
317 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
318 |
|
$continuous_line = 1; |
319 |
} elsif ($s =~ s/^;;[\x09\x20]*//) { |
} elsif ($s =~ s/^;;[\x09\x20]*//) { |
320 |
push @nt, {type => COMMENT_PARAGRAPH_START_TOKEN, |
push @nt, {type => COMMENT_PARAGRAPH_START_TOKEN, |
321 |
line => $line, column => $column}; |
line => $line, column => $column}; |
322 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
323 |
|
$continuous_line = 1; |
324 |
|
} elsif (length $s) { |
325 |
|
$continuous_line = 1; |
326 |
|
} else { |
327 |
|
$continuous_line = 0; |
328 |
} |
} |
329 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
330 |
} |
} |
|
$continuous_line = 1; |
|
331 |
return shift @nt; |
return shift @nt; |
332 |
} elsif ($s =~ /\A\[(INS|DEL)(?>\(([^()\\]*)\))?\[[\x09\x20]*\z/) { |
} elsif ($s =~ /\A\[(INS|DEL)(?>\(([^()\\]*)\))?\[[\x09\x20]*\z/) { |
333 |
undef $continuous_line; |
undef $continuous_line; |
368 |
line => $line, column => $column}; |
line => $line, column => $column}; |
369 |
$column += $+[0] - $-[0]; |
$column += $+[0] - $-[0]; |
370 |
$tokenize_text->(\$s); |
$tokenize_text->(\$s); |
371 |
undef $continuous_line; |
$continuous_line = 1; |
372 |
return shift @nt; |
return shift @nt; |
373 |
} elsif ($s =~ /\A\](INS|DEL)\][\x09\x20]*\z/) { |
} elsif ($s =~ /\A\](INS|DEL)\][\x09\x20]*\z/) { |
374 |
$continuous_line = 1; |
$continuous_line = 1; |
441 |
}; # $get_next_token |
}; # $get_next_token |
442 |
|
|
443 |
## NOTE: The "initial" mode. |
## NOTE: The "initial" mode. |
444 |
if (@s and $s[0] =~ /^#\?/) { |
if (@s and $s[0] =~ s/^#\?//) { |
445 |
## NOTE: "Parse a magic line". |
## NOTE: "Parse a magic line". |
446 |
|
|
447 |
my $s = shift @s; |
my $s = shift @s; |
455 |
} |
} |
456 |
|
|
457 |
while (length $s) { |
while (length $s) { |
458 |
$column += $+[0] - $-[0] if $s =~ s/^[\x09\x20]+//; |
$column += $+[0] - $-[0] and next if $s =~ s/^[\x09\x20]+//; |
459 |
my $name = ''; |
my $name = ''; |
460 |
if ($s =~ s/^([^=]*)=//) { |
if ($s =~ s/^([^=]*)=//) { |
461 |
$name = $1; |
$name = $1; |
468 |
$head_el->append_child ($param); |
$head_el->append_child ($param); |
469 |
|
|
470 |
$column++ if $s =~ s/^"//; |
$column++ if $s =~ s/^"//; |
471 |
if ($s =~ s/^([^"]+)//) { |
if ($s =~ s/^([^"]*)//) { |
472 |
my $values = $1; |
my $values = $1; |
473 |
$column += length $values; |
$column += length $values; |
474 |
$values =~ tr/\\//d; |
$values =~ tr/\\//d; |
475 |
for (split /,/, $values, -1) { |
my @values = split /,/, $values, -1; |
476 |
|
push @values, '' unless length $values; |
477 |
|
for (@values) { |
478 |
my $value = $doc->create_element_ns (SW09_NS, [undef, 'value']); |
my $value = $doc->create_element_ns (SW09_NS, [undef, 'value']); |
479 |
$value->text_content ($_); |
$value->text_content ($_); |
480 |
$value->set_user_data (manakai_source_line => $line); |
$value->set_user_data (manakai_source_line => $line); |
546 |
VAR => [HTML_NS, 'var'], |
VAR => [HTML_NS, 'var'], |
547 |
WEAK => [SW09_NS, 'weak'], |
WEAK => [SW09_NS, 'weak'], |
548 |
}->{$token->{tag_name}} || [SW10_NS, $token->{tag_name}]; |
}->{$token->{tag_name}} || [SW10_NS, $token->{tag_name}]; |
549 |
my $el = $doc->create_element_ns (SW10_NS, [undef, 'td']); |
my $el = $doc->create_element_ns ($type->[0], [undef, $type->[1]]); |
550 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
551 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
push @$oe, {%{$oe->[-1]}, node => $el}; |
552 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
671 |
=> $token->{id}) if defined $token->{id}; |
=> $token->{id}) if defined $token->{id}; |
672 |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
$el->set_attribute_ns (undef, [undef, 'parameter'] |
673 |
=> join ':', @{$token->{parameters}}) |
=> join ':', @{$token->{parameters}}) |
674 |
if @{$token->{parameter}}; |
if @{$token->{parameters}}; |
675 |
|
|
676 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
677 |
redo A; |
redo A; |
681 |
my $el = $doc->create_element_ns |
my $el = $doc->create_element_ns |
682 |
($token->{namespace}, [undef, $token->{local_name}]); |
($token->{namespace}, [undef, $token->{local_name}]); |
683 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
|
684 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
685 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |
686 |
|
|
703 |
->{$oe->[-1]->{node}->manakai_local_name}; |
->{$oe->[-1]->{node}->manakai_local_name}; |
704 |
pop @$oe if $oe->[-1]->{node}->manakai_local_name eq 'dt'; |
pop @$oe if $oe->[-1]->{node}->manakai_local_name eq 'dt'; |
705 |
|
|
706 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'dt']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'dd']); |
707 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
708 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
push @$oe, {%{$oe->[-1]}, node => $el}; |
709 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
794 |
if not {body => 1, section => 1, insert => 1, delete => 1, |
if not {body => 1, section => 1, insert => 1, delete => 1, |
795 |
blockquote => 1} |
blockquote => 1} |
796 |
->{$oe->[-1]->{node}->manakai_local_name} or |
->{$oe->[-1]->{node}->manakai_local_name} or |
797 |
$token->{depth} <= $oe->[-1]->{quotation_depth}; |
$token->{depth} < $oe->[-1]->{quotation_depth}; |
798 |
if ($token->{depth} > $oe->[-1]->{quotation_depth} + 1) { |
if ($token->{depth} > $oe->[-1]->{quotation_depth}) { |
799 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'blockquote']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'blockquote']); |
800 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
801 |
push @$oe, {node => $el, section_depth => 0, |
push @$oe, {node => $el, section_depth => 0, |
805 |
} |
} |
806 |
} # B |
} # B |
807 |
|
|
|
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}; |
|
|
|
|
808 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
809 |
redo A; |
redo A; |
810 |
} elsif ($token->{type} == LIST_START_TOKEN) { |
} elsif ($token->{type} == LIST_START_TOKEN) { |
920 |
} else { |
} else { |
921 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
922 |
} |
} |
923 |
|
undef $continuous_line; |
924 |
$token = $get_next_token->(); |
$token = $get_next_token->(); |
925 |
redo A; |
redo A; |
926 |
} elsif ($token->{type} == FORM_TOKEN) { |
} elsif ($token->{type} == FORM_TOKEN) { |
1001 |
TABLE_COLSPAN_CELL_TOKEN => 1}->{$token->{type}}) { |
TABLE_COLSPAN_CELL_TOKEN => 1}->{$token->{type}}) { |
1002 |
## NOTE: Ignore the token. |
## NOTE: Ignore the token. |
1003 |
} else { |
} else { |
1004 |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'p']); |
unless ({dd => 1, |
1005 |
$oe->[-1]->{node}->append_child ($el); |
li => 1, |
1006 |
push @$oe, {%{$oe->[-1]}, node => $el}; |
'comment-p' => 1, |
1007 |
|
ed => 1}->{$oe->[-1]->{node}->manakai_local_name}) { |
1008 |
|
my $el = $doc->create_element_ns (HTML_NS, [undef, 'p']); |
1009 |
|
$oe->[-1]->{node}->append_child ($el); |
1010 |
|
push @$oe, {%{$oe->[-1]}, node => $el}; |
1011 |
|
} |
1012 |
|
|
1013 |
$im = IN_PARAGRAPH_IM; |
$im = IN_PARAGRAPH_IM; |
1014 |
## Reprocess. |
## Reprocess. |
1015 |
redo A; |
redo A; |
1032 |
(undef, [undef, 'colspan'], |
(undef, [undef, 'colspan'], |
1033 |
($lc->get_attribute_ns (undef, 'colspan') || 0) + 1); |
($lc->get_attribute_ns (undef, 'colspan') || 0) + 1); |
1034 |
} else { |
} else { |
1035 |
my $el = $doc->create_element_ns (SW10_NS, [undef, 'td']); |
my $el = $doc->create_element_ns (HTML_NS, [undef, 'td']); |
1036 |
$oe->[-1]->{node}->append_child ($el); |
$oe->[-1]->{node}->append_child ($el); |
1037 |
$el->set_user_data (manakai_source_line => $token->{line}); |
$el->set_user_data (manakai_source_line => $token->{line}); |
1038 |
$el->set_user_data (manakai_source_column => $token->{column}); |
$el->set_user_data (manakai_source_column => $token->{column}); |