File: graphviz.pl

package info (click to toggle)
libpandoc-elements-perl 0.38-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 732 kB
  • sloc: perl: 1,630; makefile: 15; sh: 1
file content (33 lines) | stat: -rwxr-xr-x 849 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env perl
use strict;

use Pandoc::Filter;
use Pandoc::Filter::ImagesFromCode;

pandoc_filter 'CodeBlock.graphviz' => Pandoc::Filter::ImagesFromCode->new(
    from => 'dot',
    to   => sub { $_[0] eq 'latex' ? 'pdf' : 'png' },
    run  => ['dot', '-T$to$', '-o$outfile$', '$infile$'],
);

=head1 NAME

graphviz - process code blocks with C<.graphviz> into images

=head1 DESCRIPTION

Pandoc filter to process code blocks with class C<graphviz> into
graphviz-generated images. Attribute C<option=-K...> can be used to select
layout engine (C<dot> by default).

=head1 SYNOPSIS

  pandoc --filter graphviz.pl -o output.html < input.md

=head1 SEE ALSO

This is an extended port of
L<graphviz.py|https://github.com/jgm/pandocfilters/blob/master/examples/graphviz.py>
from Python to Perl with L<Pandoc::Elements> and L<Pandoc::Filter>.

=cut