Scroll to navigation

Pod::Simple::Pandoc(3pm) User Contributed Perl Documentation Pod::Simple::Pandoc(3pm)

NAME

Pod::Simple::Pandoc - convert Pod to Pandoc document model

SYNOPSIS

  use Pod::Simple::Pandoc;
  my $parser = Pod::Simple::Pandoc->new;
  my $doc    = $parser->parse_file( $filename );
  
  # result is a Pandoc::Document
  print $doc->to_json;

DESCRIPTION

This module converts POD format documentation (perlpod) to the document model used by Pandoc <http://pandoc.org/>. The result can be accessed with methods of Pandoc::Element and emitted as JSON for further processing to other document formats (HTML, Markdown, LaTeX, PDF, EPUB, docx, ODT, man...).

The command line script pod2pandoc makes use of this module, for instance to directly convert to PDF:

  pod2pandoc input.pod | pandoc -f json -t output.pdf

METHODS

parse_file( $filename | *INPUT )

Reads Pod from file or filehandle and convert it to a Pandoc::Document.

parse_string( $string )

Reads Pod from string and convert it to a Pandoc::Document.

MAPPING

Pod elements are mapped to Pandoc elements as following:

Formatting codes

Formatting codes for italic text ("I<...>"), bold text ("B<...>"), and "code" ("C<...>") are mapped to Emphasized text ("Emph"), strongly emphasized text ("Strong"), and inline code ("Code"). Formatting code for filenames ("F<...>") are mapped to inline code with class "filename" ("`...`{.filename}" in Pandoc Markdown). Formatting codes inside code and filenames (e.g. "code with bold" or <http://example.org/> as filename) are stripped to unformatted code. Character escapes ("E<...>") and "S<...>" are directly mapped to Unicode characters. The special formatting code "X<...>" is ignored.

Some examples of links of different kinds:

<http://example.org/>

pod2pandoc

"OPTIONS" in pod2pandoc

perl(1)

"ENVIRONMENT" in crontab(5)

hell itself!

Link text can contain formatting codes:

the "pod2pandoc" script

Internal links are not supported yet:

"MAPPING"

mapping from PoD to Pandoc

Titles may contain formatting "codes"!

Lists

1.
Numbered lists are
2.
converted to "NumberedList" and
  • Bulleted lists are
  • converted to

    "BulletList"

also supported.

=over/=back

An "=over"..."=back" region containing no "=item" is mapped to "BlockQuote".

Verbatim sections

  verbatim sections are mapped 
    to code blocks

Data sections

Data sections with target "html" or "latex" are passed as "RawBlock". "HTML", "LaTeX", "TeX", and "tex" are recognized as alias.

LIMITATIONS

Sure there are bugs. Please send bug reports <https://github.com/nichtich/Pandoc-Elements/issues>!

Configuration will be added in a later version.

SEE ALSO

This module is based on Pod::Simple (Pod::Simple::SimpleTree). It makes obsolete several specialized "Pod::Simple::..." modules such as Pod::Simple::HTML, Pod::Simple::XHTML, Pod::Simple::LaTeX, Pod::Simple::RTF Pod::Simple::Text, Pod::Simple::Wiki, Pod::WordML, Pod::Perldoc::ToToc etc.

2017-01-10 perl v5.24.1