Browse Source

Merge branch 'master' of ssh://192.168.10.2/home/git/libtext-dokuwiki-perl

Conflicts:
	lib/Text/Dokuwiki/Parser.pm
master
Alex 'AdUser' Z 10 years ago
parent
commit
b402935d00
  1. 30
      lib/Text/Dokuwiki/Parser.pm

30
lib/Text/Dokuwiki/Parser.pm

@ -177,13 +177,11 @@ sub _parse_text {
last; last;
} }
given ($match) { if ($match eq '\\\\ ') { # force newline
when ('\\\\ ') { # force newline
push @parts, [br => {}]; push @parts, [br => {}];
$line = $after; $line = $after;
next; next;
} } elsif ($match) {
default {
$endtag = $inlines->{$match}; $endtag = $inlines->{$match};
$endpos = index($after, $endtag, 0); $endpos = index($after, $endtag, 0);
if ($endpos < 0) { # no closing marker? if ($endpos < 0) { # no closing marker?
@ -193,24 +191,18 @@ sub _parse_text {
} }
$content = substr($after, 0, $endpos); $content = substr($after, 0, $endpos);
$line = substr($after, $endpos + 2); $line = substr($after, $endpos + 2);
continue;
}
} }
my %attrs; my %attrs;
given ($match) { if ($match eq "//") { %attrs = ('font-style' => 'italic'); }
when ("//") { %attrs = ('font-style' => 'italic'); } elsif ($match eq "**") { %attrs = ('font-weight' => 'bold'); }
when ("**") { %attrs = ('font-weight' => 'bold'); } elsif ($match eq "''") { %attrs = ('font-family' => 'monospace'); }
when ("''") { %attrs = ('font-family' => 'monospace'); } elsif ($match eq "__") { %attrs = ('text-decoration' => 'underline'); }
when ("__") { %attrs = ('text-decoration' => 'underline'); } elsif ($match eq "{{") { push @parts, $self->_parse_include($content); next; }
when ("{{") { push @parts, $self->_parse_include($content); next; } elsif ($match eq "[[") { push @parts, $self->_parse_link($content); next; }
when ("[[") { push @parts, $self->_parse_link($content); next; } elsif ($match eq "((") { ...; next; }
when ("((") { ...; next; } elsif ($match) { die("unrecognized inline: $match\n"); }
default {
die("unrecognized inline: $match\n");
next;
}
}
if (%attrs) { if (%attrs) {
push @parts, [span => \%attrs, $self->_parse_text($content)]; push @parts, [span => \%attrs, $self->_parse_text($content)];
next; next;

Loading…
Cancel
Save