|
|
@ -222,8 +222,7 @@ sub parse { |
|
|
|
foreach my $line (@lines) { |
|
|
|
foreach my $line (@lines) { |
|
|
|
$linenum++; |
|
|
|
$linenum++; |
|
|
|
|
|
|
|
|
|
|
|
given ($mode) { |
|
|
|
if ($mode =~ m!block/(file|code|nowiki)!o) { |
|
|
|
when (m!block/(file|code|nowiki)!o) { |
|
|
|
|
|
|
|
$buf //= []; |
|
|
|
$buf //= []; |
|
|
|
if ($line =~ m{^\s*</$1>}o) { |
|
|
|
if ($line =~ m{^\s*</$1>}o) { |
|
|
|
$buf = join("\n", @{ $buf }); |
|
|
|
$buf = join("\n", @{ $buf }); |
|
|
@ -240,24 +239,21 @@ sub parse { |
|
|
|
} |
|
|
|
} |
|
|
|
push @{ $buf }, $line; |
|
|
|
push @{ $buf }, $line; |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} elsif ($mode eq 'code') { |
|
|
|
when ("code") { |
|
|
|
|
|
|
|
if ($line =~ m/^\s{2}(.+)/o) { |
|
|
|
if ($line =~ m/^\s{2}(.+)/o) { |
|
|
|
$buf .= $line . "\n"; |
|
|
|
$buf .= $line . "\n"; |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
push @tree, [pre => {}, $buf]; |
|
|
|
push @tree, [pre => {}, $buf]; |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
} |
|
|
|
} elsif ($mode eq 'list') { |
|
|
|
when ("list") { |
|
|
|
|
|
|
|
if ($line =~ m/^(\s{2})+([\*-])\s+(.+)/o) { |
|
|
|
if ($line =~ m/^(\s{2})+([\*-])\s+(.+)/o) { |
|
|
|
push @{ $buf }, $line; |
|
|
|
push @{ $buf }, $line; |
|
|
|
next; |
|
|
|
next; |
|
|
|
} |
|
|
|
} |
|
|
|
push @tree, $self->_parse_list($buf); |
|
|
|
push @tree, $self->_parse_list($buf); |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
} |
|
|
|
} elsif ($mode eq 'table') { |
|
|
|
when ("table") { |
|
|
|
|
|
|
|
if ($line =~ m/^\s?[\|\^]/o) { |
|
|
|
if ($line =~ m/^\s?[\|\^]/o) { |
|
|
|
push @{ $buf }, $line; |
|
|
|
push @{ $buf }, $line; |
|
|
|
next; |
|
|
|
next; |
|
|
@ -265,8 +261,6 @@ sub parse { |
|
|
|
push @tree, $self->_parse_table($buf); |
|
|
|
push @tree, $self->_parse_table($buf); |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
($buf, $mode, $attrs) = ('', '', {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
given ($line) { |
|
|
|
given ($line) { |
|
|
|
# macro |
|
|
|
# macro |
|
|
|