From 4e76fa89414bd1d280169a0d1ee9ab20757f6b9c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 23 Mar 2015 20:10:10 +0100 Subject: Widen to cover curly doublequote. --- pandoc-emphasis | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'pandoc-emphasis') 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 ); -- cgit v1.2.3