diff options
author | Jonas Smedegaard <dr@jones.dk> | 2015-03-23 20:10:10 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2015-03-23 20:10:10 +0100 |
commit | 4e76fa89414bd1d280169a0d1ee9ab20757f6b9c (patch) | |
tree | 1c559bffc971d0cb6f8246db20ff97ec2e70a576 /pandoc-emphasis | |
parent | 75e79adb665cc3001d1fb8382456870bfaec85e3 (diff) |
Widen to cover curly doublequote.
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 ); |