Class: Metanorma::Plugin::Datastruct::Json2TextPreprocessor

Inherits:
BaseStructuredTextPreprocessor show all
Includes:
Content
Defined in:
lib/metanorma/plugin/datastruct/json2_text_preprocessor.rb

Constant Summary

Constants inherited from BaseStructuredTextPreprocessor

BaseStructuredTextPreprocessor::BLOCK_END_REGEXP, BaseStructuredTextPreprocessor::BLOCK_START_REGEXP, BaseStructuredTextPreprocessor::LOAD_FILE_REGEXP

Instance Method Summary collapse

Methods inherited from BaseStructuredTextPreprocessor

#process

Constructor Details

#initialize(config = {}) ⇒ Json2TextPreprocessor

search document for block json2text after that take template from block and read file into this template example: [json2text,foobar.json] ----

=== {item.name}
{item.desc}

{item.symbol}:: {item.symbol_def}
----

with content of `foobar.json` file equal to:
{
  "name": "spaghetti",
  "desc": "wheat noodles of 9mm diameter".
  "symbol": "SPAG",
  "symbol_def": "the situation is message like spaghetti",
}

will produce:
=== spaghetti
wheat noodles of 9mm diameter

SPAG:: the situation is message like spaghetti


36
37
38
39
# File 'lib/metanorma/plugin/datastruct/json2_text_preprocessor.rb', line 36

def initialize(config = {})
  super
  @config[:block_name] = "json2text"
end