diff options
Diffstat (limited to 'pandoc-emphasis')
-rwxr-xr-x | pandoc-emphasis | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/pandoc-emphasis b/pandoc-emphasis index 13c3941..50da37e 100755 --- a/pandoc-emphasis +++ b/pandoc-emphasis @@ -62,6 +62,9 @@ class Uterus with MooX::Role::Logger { } } +my $doublequote = qr/[\"\x{00AB}\x{00BB}\x{201C}-\x{201F}\x{300C}-\x{300F}\x{301D}-\x{301F}\x{FE41}-\x{FE44}\x{FF02}\x{FF62}\x{FF63}]/; +my $nodoublequote = qr/[^\"\x{00AB}\x{00BB}\x{201C}-\x{201F}\x{300C}-\x{300F}\x{301D}-\x{301F}\x{FE41}-\x{FE44}\x{FF02}\x{FF62}\x{FF63}]/; + my $womb = Uterus->new; pandoc_filter( @@ -126,12 +129,11 @@ sub emphasis { next; } # title markup via quotation mark in Str - # TODO: widen container to non-upright doublequote if ( $self->content->[$kid]->name eq 'Str' - and $self->content->[$kid]->content eq '"' + and $self->content->[$kid]->content =~ /$doublequote/ and $self->content->[$kid+1]->name eq 'Emph' and $self->content->[$kid+2]->name eq 'Str' - and $self->content->[$kid+2]->content eq '"' + and $self->content->[$kid+2]->content =~ /$doublequote/ ) { $log->infof( 'emphasis: %s+Emph→title: %s', $self->content->[$kid]->content, @@ -161,9 +163,10 @@ sub emphasis { next; } # foreign markup via quotation mark in Str - # TODO: widen container to non-upright doublequote if ( $self->content->[$kid]->name eq 'Emph' - and stringify($self->content->[$kid]) =~ /^(\")([^\"]+)\"$/ + and stringify($self->content->[$kid]) +# =~ /^(\")([^\"]+)\"$/ + =~ /^($doublequote)(^$nodoublequote+)$doublequote$/ ) { $log->infof( 'emphasis: Emph+%s→foreign: %s', $1, $2 ); |