|
|
|
@ -200,25 +200,22 @@ sub _parse_text {
|
|
|
|
|
$line = substr($after, $endpos + 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
my %attrs; |
|
|
|
|
if ($match eq "//") { %attrs = ('font-style' => 'italic'); } |
|
|
|
|
elsif ($match eq "**") { %attrs = ('font-weight' => 'bold'); } |
|
|
|
|
elsif ($match eq "''") { %attrs = ('font-family' => 'monospace'); } |
|
|
|
|
elsif ($match eq "__") { %attrs = ('text-decoration' => 'underline'); } |
|
|
|
|
my ($tag, %attrs); |
|
|
|
|
if ($match eq "//") { $tag = 'i'; } |
|
|
|
|
elsif ($match eq "**") { $tag = 'b'; } |
|
|
|
|
elsif ($match eq "__") { $tag = 'u'; } # should be rendered as <span style=""> |
|
|
|
|
elsif ($match eq "''") { $tag = 'code'; } |
|
|
|
|
elsif ($match eq "{{") { push @parts, $self->_parse_include($content); next; } |
|
|
|
|
elsif ($match eq "[[") { push @parts, $self->_parse_link($content); next; } |
|
|
|
|
elsif ($match eq "[[") { push @parts, $self->_parse_link($content); next; } |
|
|
|
|
elsif ($match eq "((") { |
|
|
|
|
push @{ $self->{footnotes} }, $self->_parse_text($content); |
|
|
|
|
my $n = scalar @{ $self->{footnotes} }; |
|
|
|
|
push @parts, [sup => {}, [a => {href => "#note_$n"}, $n]]; |
|
|
|
|
push @parts, [a => {href => "#note_$n", class => 'footnote'}, $n]; |
|
|
|
|
next; |
|
|
|
|
} |
|
|
|
|
elsif ($match) { die("unrecognized inline: $match\n"); } |
|
|
|
|
elsif ($match) { die("parser failed, unrecognized inline: $match\n"); } |
|
|
|
|
|
|
|
|
|
if (%attrs) { |
|
|
|
|
push @parts, [span => \%attrs, $self->_parse_text($content)]; |
|
|
|
|
next; |
|
|
|
|
} |
|
|
|
|
push @parts, [$tag => \%attrs, $self->_parse_text($content)]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return @parts; |
|
|
|
|