summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-03-29 12:49:28 +0200
committerJonas Smedegaard <dr@jones.dk>2017-03-29 14:55:53 +0200
commit0a0699dc71fc95d02c8079fe45af2b8a261e492e (patch)
tree165728858fa3e7fdbdbd645813962db56ab17603
parentb703505823e34ca94f81cca9f4817003b64d90b3 (diff)
Modernize Pandoc::Element usage: stringify($ast) → $ast->string.
-rwxr-xr-xpandoc-emphasis12
-rwxr-xr-xpandoc-memoir6
2 files changed, 8 insertions, 10 deletions
diff --git a/pandoc-emphasis b/pandoc-emphasis
index 50da37e..35f6076 100755
--- a/pandoc-emphasis
+++ b/pandoc-emphasis
@@ -14,12 +14,12 @@
use Moops -strict;
use Pandoc::Filter 0.06;
-use Pandoc::Elements;
+use Pandoc::Elements 0.12;
use Scalar::Util qw(reftype);
use Clone qw(clone);
use Log::Any qw($log);
-use Log::Any::Adapter ( 'ScreenColoredLevel',
+use Log::Any::Adapter ( 'Screen',
use_color => ! -t *STDERR );
# TODO: add class Egg, and coercing roles Exotic and Noble
@@ -117,8 +117,7 @@ sub emphasis {
if ( $self->content->[$kid]->name eq 'Quoted'
and $self->content->[$kid]->content->[0]->name eq 'Emph'
) {
- my $new_content = stringify(
- $self->content->[$kid]->content->[0] );
+ my $new_content = $self->content->[$kid]->content->[0]->string;
$log->infof( 'emphasis: Quoted+Emph→title: %s',
$new_content );
# FIXME: LaTeX-encode content
@@ -150,8 +149,7 @@ sub emphasis {
if ( $self->content->[$kid]->name eq 'Emph'
and $self->content->[$kid]->content->[0]->name eq 'Quoted'
) {
- my $new_content = stringify(
- $self->content->[$kid]->content->[0] );
+ my $new_content = $self->content->[$kid]->content->[0]->string;
$log->infof( 'emphasis: Emph+Quoted→foreign: %s',
$new_content );
# FIXME: LaTeX-encode content
@@ -164,7 +162,7 @@ sub emphasis {
}
# foreign markup via quotation mark in Str
if ( $self->content->[$kid]->name eq 'Emph'
- and stringify($self->content->[$kid])
+ and $self->content->[$kid]->string
# =~ /^(\")([^\"]+)\"$/
=~ /^($doublequote)(^$nodoublequote+)$doublequote$/
) {
diff --git a/pandoc-memoir b/pandoc-memoir
index 6954877..c15ebe6 100755
--- a/pandoc-memoir
+++ b/pandoc-memoir
@@ -7,7 +7,7 @@ use feature qw(switch);
no if $] >= 5.018, warnings => "experimental::smartmatch";
use Pandoc::Filter 0.06;
-use Pandoc::Elements;
+use Pandoc::Elements 0.12;
my ( $frontmatter_seen, $mainmatter_seen, $backmatter_seen, $toc_seen);
@@ -23,7 +23,7 @@ sub matter {
my (@replace, @prepend);
# push @prepend, RawBlock( 'latex', '\\frontmatter' )
# unless ($toc_seen++);
- given (stringify($self)) {
+ given ($self->string) {
when ( /^Table/ and not $frontmatter_seen++ ) {
push @replace, RawBlock( 'latex',
'{\\hypersetup{linkcolor=black}\\setcounter{tocdepth}{3}\\cleartorecto\\tableofcontents}'
@@ -48,6 +48,6 @@ sub matter {
sub toc {
my $self = shift;
return []
- if ( $self->name eq 'Para' and stringify($self) =~ /__TOC__/ );
+ if ( $self->name eq 'Para' and $self->string =~ /__TOC__/ );
return;
}