summaryrefslogtreecommitdiff
path: root/pandoc-emphasis
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2015-03-20 20:31:57 +0100
committerJonas Smedegaard <dr@jones.dk>2015-03-20 20:31:57 +0100
commitf264ef9110344de5273e6cca5ccc729538cd0815 (patch)
treecfc3b6a7a52aed41b793dc07a6a38e3ca027ca24 /pandoc-emphasis
parentf44c9d537c70eb96ef882c0e721fcbf8f939c302 (diff)
Avoid given/when.
Diffstat (limited to 'pandoc-emphasis')
-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) {