class Pandocomatic::MetadataPreprocessor

MetadataPreprocessor mixes in the metadata section of a template into a document before pandoc is run to convert that document. It is a default preprocessor.

Public Class Methods

run(input, metadata = {}) click to toggle source

Run this MetadataPreprocessor

@param input [String] the contents of the document that is being

preprocessed

@param metadata [Hash = {}] the metadata to mix-in

# File lib/pandocomatic/processors/metadata_preprocessor.rb, line 34
def self.run(input, metadata = {})
  yaml = YAML.dump(metadata)
  Pandocomatic::LOG.debug '     | MetadataPreprocessor. Adding mined YAML blocks to metadata:' \
    "#{Pandocomatic::LOG.indent(
      yaml.sub('---', ''), 37
    )}"
  "#{input}\n\n#{yaml}...\n\n"
end