summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpandoc-emphasis63
1 files changed, 30 insertions, 33 deletions
diff --git a/pandoc-emphasis b/pandoc-emphasis
index 9adb6e5..34770f5 100755
--- a/pandoc-emphasis
+++ b/pandoc-emphasis
@@ -5,9 +5,6 @@
use Moops -strict;
-use feature qw(switch);
-no if $] >= 5.018, warnings => "experimental::smartmatch";
-
use Pandoc::Filter 0.06;
use Pandoc::Elements;
@@ -78,41 +75,41 @@ sub emphasis {
return unless ( $self->name =~ /Str|Emph/ );
if ( $self->name eq 'Emph' ) {
$window->set_view($self);
- given ( stringify($self) ) {
- when ( $self->content->[0]->name eq 'Str' ) {
- if ( $window->peek_at_ledge() eq '"' ) {
- $window->clear_ledge();
- $title++;
- $log->infof( 'emphasis: %s+Emph→title: %s',
- '"',
- $_ );
- return $window->interpret_view(
- Quoted( DoubleQuote,
- $self->content ));
- }
- }
- when ( $self->content->[0]->name eq 'Quoted' ) {
- $log->infof( 'emphasis: Emph+Quoted→foreign: %s',
- $_ );
- # FIXME: LaTeX-encode content
- return $window->interpret_view(
- RawInline( 'latex',
- sprintf( '\foreign{%s}',
- $_ )));
- }
+ if ( $self->content->[0]->name eq 'Str'
+ and $window->peek_at_ledge() eq '"'
+ ) {
+ $window->clear_ledge();
+ $title++;
+ $log->infof( 'emphasis: %s+Emph→title: %s',
+ '"',
+ stringify(
+ $self->content ));
+ return $window->interpret_view(
+ Quoted( DoubleQuote,
+ $self->content ));
+ }
+ if ( $self->content->[0]->name eq 'Quoted'
+ ) {
+ my $new_content = stringify(
+ $self->content->[0] );
+ $log->infof( 'emphasis: Emph+Quoted→foreign: %s',
+ $new_content );
+ # FIXME: LaTeX-encode content
+ return $window->interpret_view(
+ RawInline( 'latex',
+ sprintf( '\foreign{%s}',
+ $new_content )));
}
return $window->describe_view();
}
if ( $self->name eq 'Str' ) {
$window->set_view($self);
- given ( $self->content ) {
- when ('"') {
- if ($title) {
- $title--;
- return $window->suppress_view();
- };
- return $window->postpone_view();
- }
+ if ( $self->content eq '"' ) {
+ if ($title) {
+ $title--;
+ return $window->suppress_view();
+ };
+ return $window->postpone_view();
}
$window->clear_ledge();
if ($title) {