1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#!/usr/bin/env perl
use strict;
=head1 NAME
myemph - use C<\myemp{...}> instead of C<\emph{...}> in LaTeX
=head1 DESCRIPTION
Pandoc filter that causes emphasized text to be rendered using the custom macro
C<\myemph{...}> rather than C<\emph{...}> in LaTeX. Other output formats are
unaffected.
=cut
use Pandoc::Filter;
use Pandoc::Elements;
pandoc_filter Emph => sub {
my ($e, $f, $m) = @_;
return if $f ne 'latex';
[ RawInline(latex => '\myemph{'), @{$e->content}, RawInline(latex => '}') ]
};
=head1 SYNOPSIS
pandoc --filter myemph.pl -o output.html < input.md
=head1 SEE ALSO
This is a port of
L<myemph.py|https://github.com/jgm/pandocfilters/blob/master/examples/myemph.py>
from Python to Perl with L<Pandoc::Elements> and L<Pandoc::Filter>.
=cut
|