Module: Pandocomatic

Defined in:
lib/pandocomatic/cli.rb,
lib/pandocomatic/path.rb,
lib/pandocomatic/input.rb,
lib/pandocomatic/version.rb,
lib/pandocomatic/warning.rb,
lib/pandocomatic/template.rb,
lib/pandocomatic/processor.rb,
lib/pandocomatic/pandocomatic.rb,
lib/pandocomatic/configuration.rb,
lib/pandocomatic/error/io_error.rb,
lib/pandocomatic/command/command.rb,
lib/pandocomatic/error/cli_error.rb,
lib/pandocomatic/pandoc_metadata.rb,
lib/pandocomatic/printer/printer.rb,
lib/pandocomatic/pandocomatic_yaml.rb,
lib/pandocomatic/error/pandoc_error.rb,
lib/pandocomatic/command/skip_command.rb,
lib/pandocomatic/error/template_error.rb,
lib/pandocomatic/multiple_files_input.rb,
lib/pandocomatic/printer/help_printer.rb,
lib/pandocomatic/error/processor_error.rb,
lib/pandocomatic/printer/error_printer.rb,
lib/pandocomatic/printer/finish_printer.rb,
lib/pandocomatic/printer/command_printer.rb,
lib/pandocomatic/printer/summary_printer.rb,
lib/pandocomatic/printer/version_printer.rb,
lib/pandocomatic/printer/warning_printer.rb,
lib/pandocomatic/error/pandocomatic_error.rb,
lib/pandocomatic/command/copy_file_command.rb,
lib/pandocomatic/error/configuration_error.rb,
lib/pandocomatic/command/convert_dir_command.rb,
lib/pandocomatic/command/create_link_command.rb,
lib/pandocomatic/error/pandoc_metadata_error.rb,
lib/pandocomatic/command/convert_file_command.rb,
lib/pandocomatic/command/convert_list_command.rb,
lib/pandocomatic/printer/unknown_error_printer.rb,
lib/pandocomatic/processors/fileinfo_preprocessor.rb,
lib/pandocomatic/processors/metadata_preprocessor.rb,
lib/pandocomatic/printer/configuration_errors_printer.rb,
lib/pandocomatic/command/convert_file_multiple_command.rb

Overview

– Copyright 2017—2025 Huub de Beer <Huub@heerdebeer.org>

This file is part of pandocomatic.

Pandocomatic is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Pandocomatic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with pandocomatic. If not, see <www.gnu.org/licenses/>. ++

Defined Under Namespace

Modules: Pandocomatic, PandocomaticYAML, Path Classes: CLI, CLIError, Command, CommandPrinter, Configuration, ConfigurationError, ConfigurationErrorsPrinter, ConvertDirCommand, ConvertFileCommand, ConvertFileMultipleCommand, ConvertListCommand, CopyFileCommand, CreateLinkCommand, ErrorPrinter, FileInfoPreprocessor, FinishPrinter, HelpPrinter, IOError, Input, MetadataPreprocessor, MultipleFilesInput, PandocError, PandocMetadata, PandocMetadataError, PandocomaticError, Printer, Processor, ProcessorError, SkipCommand, SummaryPrinter, Template, TemplateError, UnknownErrorPrinter, VersionPrinter, Warning, WarningPrinter

Constant Summary collapse

VERSION =

Pandocomatic’s current version.

[2, 2, 1].freeze
DEFAULT_CONFIG =

The default configuration for pandocomatic is read from default_configuration.yaml.

PandocomaticYAML.load_file File.join(__dir__, 'default_configuration.yaml')
DEFAULT_SETTINGS =

The default settings for pandocomatic: hidden files will always be skipped, as will pandocomatic configuration files, unless explicitly set to not skip via the “unskip” option

{
  'skip' => ['.*', 'pandocomatic.yaml'],
  'extract-metadata-from' => [],
  'recursive' => true,
  'follow-links' => false,
  'match-files' => 'first'
}
DEFAULT_EXTENSION =

Maps pandoc output formats to their conventional default extension. Updated and in order of ‘pandoc –list-output-formats`.

{
  'asciidoc' => 'adoc',
  'asciidoctor' => 'adoc',
  'beamer' => 'tex',
  'bibtex' => 'bib',
  'biblatex' => 'bib',
  'commonmark' => 'md',
  'context' => 'tex',
  'csljson' => 'json',
  'docbook' => 'docbook',
  'docbook4' => 'docbook',
  'docbook5' => 'docbook',
  'docx' => 'docx',
  'dokuwiki' => 'txt',
  'dzslides' => 'html',
  'epub' => 'epub',
  'epub2' => 'epub',
  'epub3' => 'epub',
  'fb2' => 'fb2',
  'gfm' => 'md',
  'haddock' => 'hs',
  'html' => 'html',
  'html4' => 'html',
  'html5' => 'html',
  'icml' => 'icml',
  'ipynb' => 'ipynb',
  'jats' => 'jats',
  'jats_archiving' => 'jats',
  'jats_articleauthoring' => 'jats',
  'jats_publishing' => 'jats',
  'jira' => 'jira',
  'json' => 'json',
  'latex' => 'tex',
  'man' => 'man',
  'markdown' => 'md',
  'markdown_github' => 'md',
  'markdown_mmd' => 'md',
  'markdown_phpextra' => 'md',
  'markdown_strict' => 'md',
  'media_wiki' => 'mediawiki',
  'ms' => 'ms',
  'muse' => 'muse',
  'native' => 'hs',
  'odt' => 'odt',
  'opendocument' => 'odt',
  'opml' => 'opml',
  'org' => 'org',
  'pdf' => 'pdf',
  'plain' => 'txt',
  'pptx' => 'pptx',
  'revealjs' => 'html',
  'rst' => 'rst',
  's5' => 'html',
  'slideous' => 'html',
  'slidy' => 'html',
  'tei' => 'tei',
  'texinfo' => 'texi',
  'textile' => 'textile',
  'typst' => 'typ',
  'xwiki' => 'xwiki',
  'zimwiki' => 'zimwiki'
}.freeze
PANDOCS_EXTENSION_TO_FORMAT_MAPPING =

Pandoc’s mapping from file extensions to pandoc source format. Taken from github.com/jgm/pandoc/blob/main/src/Text/Pandoc/Format.hs

{
  '.Rmd' => 'markdown',
  '.adoc' => 'asciidoc',
  '.asciidoc' => 'asciidoc',
  '.bib' => 'biblatex',
  '.context' => 'context',
  '.csv' => 'csv',
  '.ctx' => 'context',
  '.db' => 'docbook',
  '.dj' => 'djot',
  '.docx' => 'docx',
  '.dokuwiki' => 'dokuwiki',
  '.epub' => 'epub',
  '.fb2' => 'fb2',
  '.htm' => 'html',
  '.html' => 'html',
  '.icml' => 'icml',
  '.ipynb' => 'ipynb',
  '.json' => 'json',
  '.latex' => 'latex',
  '.lhs' => 'markdown',
  '.ltx' => 'latex',
  '.markdown' => 'markdown',
  '.markua' => 'markua',
  '.md' => 'markdown',
  '.mdown' => 'markdown',
  '.mdwn' => 'markdown',
  '.mkd' => 'markdown',
  '.mkdn' => 'markdown',
  '.ms' => 'ms',
  '.muse' => 'muse',
  '.native' => 'native',
  '.odt' => 'odt',
  '.opml' => 'opml',
  '.org' => 'org',
  '.pptx' => 'pptx',
  '.ris' => 'ris',
  '.roff' => 'ms',
  '.rst' => 'rst',
  '.rtf' => 'rtf',
  '.s5' => 's5',
  '.t2t' => 't2t',
  '.tei' => 'tei',
  '.tex' => 'latex',
  '.texi' => 'texinfo',
  '.texinfo' => 'texinfo',
  '.text' => 'markdown',
  '.textile' => 'textile',
  '.tsv' => 'tsv',
  '.typ' => 'typst',
  '.txt' => 'markdown',
  '.wiki' => 'mediawiki',
  '.xhtml' => 'html',
  '.1' => 'man',
  '.2' => 'man',
  '.3' => 'man',
  '.4' => 'man',
  '.5' => 'man',
  '.6' => 'man',
  '.7' => 'man',
  '.8' => 'man',
  '.9' => 'man'
}.freeze
BLOCK_START =

Regular expression to find the start of metadata blocks in a string.

/^---[ \t]*$/
METADATA_BLOCK =

Regular expression to find metadata blocks in a string. This regular expression does interfere with pandoc’s horizontal line syntax when using three dashes for horizontal lines. Therefore, use four or more dashes in your pandoc documents.

/^---[ \t]*(\r\n|\r|\n)(.+?)^(?:---|\.\.\.)[ \t]*(\r\n|\r|\n)/m
OUTPUT_FORMATS =

Output formats used in pandocomatic

%w[docx pptx odt pdf epub epub3 epub2].freeze
PANDOC_OPTIONS_WITH_PATH =

Pandoc options that take a path as argument

%w[
  data-dir
  filter
  template
  css
  include-in-header
  include-before-body
  include-after-body
  reference-odt
  reference-docx
  epub-stylesheet
  epub-cover-image
  epub-metadata
  epub-embed-font
  epub-subdirectory
  bibliography
  csl
  syntax-definition
  reference-doc
  lua-filter
  extract-media
  resource-path
  citation-abbreviations
  abbreviations
  log
  resource-path
].freeze