|
|
|
@ -237,17 +237,11 @@ sub parse {
|
|
|
|
|
$level = 7 - $level; # invert |
|
|
|
|
push @tree, ["h$level" => {}, $+{header}]; |
|
|
|
|
} elsif ($text =~ m/\G$rx->{codeblock}/cgi) { |
|
|
|
|
if ($+{tag} eq 'file' and $+{filename}) { |
|
|
|
|
my $attrs = $+{syntax} ? {class => $+{syntax}} : {}; |
|
|
|
|
my $dt = [dt => {}, $+{filename}]; |
|
|
|
|
my $dd = [dt => {}, [pre => $attrs, $+{block}]]; |
|
|
|
|
push @tree, [dl => {class => 'file'}, [$dt, $dd]]; |
|
|
|
|
} elsif ($+{tag} eq 'file') { |
|
|
|
|
push @tree, [pre => {class => 'file'}, $+{block}]; |
|
|
|
|
} else { |
|
|
|
|
my $attrs = $+{syntax} ? {class => $+{syntax}} : {}; |
|
|
|
|
push @tree, [code => $attrs, [pre => {}, $+{block}]]; |
|
|
|
|
} |
|
|
|
|
my $attrs = {}; |
|
|
|
|
$attrs->{type} = $+{tag}; |
|
|
|
|
$attrs->{file} = $+{filename} if $+{filename}; |
|
|
|
|
$attrs->{syntax} = $+{syntax} if $+{syntax}; |
|
|
|
|
push @tree, [codeblock => $attrs, $+{block}]; |
|
|
|
|
} elsif ($text =~ m/\G$rx->{table}/cgi) { |
|
|
|
|
my $lines = $+{table}; |
|
|
|
|
chomp $lines; |
|
|
|
|