Class: Pandocomatic::MetadataPreprocessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/pandocomatic/processors/metadata_preprocessor.rb

Overview

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.

Class Method Summary collapse

Class Method Details

.run(input, metadata = {}) ⇒ Object

Run this MetadataPreprocessor

Parameters:

  • input (String)

    the contents of the document that is being preprocessed

  • metadata (Hash = {}) (defaults to: {})

    the metadata to mix-in



34
35
36
37
38
39
40
41
# File 'lib/pandocomatic/processors/metadata_preprocessor.rb', line 34

def self.run(input,  = {})
  yaml = YAML.dump()
  Pandocomatic::LOG.debug '     | MetadataPreprocessor. Adding mined YAML blocks to metadata:' \
    "#{Pandocomatic::LOG.indent(
      yaml.sub('---', ''), 37
    )}"
  "#{input}\n\n#{yaml}...\n\n"
end