From 7067110fe99826ee4b9265fc3b9b4e9ea1bfaae2 Mon Sep 17 00:00:00 2001 From: Zubrikhin Alexey Date: Mon, 6 Jul 2015 16:14:41 +1000 Subject: [PATCH] * Text::Dokuwiki::Parser->_parse_text() --- lib/Text/Dokuwiki/Parser.pm | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/Text/Dokuwiki/Parser.pm b/lib/Text/Dokuwiki/Parser.pm index ca6d655..338ab3c 100644 --- a/lib/Text/Dokuwiki/Parser.pm +++ b/lib/Text/Dokuwiki/Parser.pm @@ -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 + 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;