Class: Metanorma::Plugin::Lutaml::Data2TextPreprocessor

Inherits:
BaseStructuredTextPreprocessor show all
Includes:
Content
Defined in:
lib/metanorma/plugin/lutaml/data2_text_preprocessor.rb

Constant Summary

Constants inherited from BaseStructuredTextPreprocessor

BaseStructuredTextPreprocessor::BLOCK_END_REGEXP, BaseStructuredTextPreprocessor::BLOCK_START_REGEXP, BaseStructuredTextPreprocessor::INCLUDE_PATH_OPTION, BaseStructuredTextPreprocessor::LOAD_FILE_REGEXP, BaseStructuredTextPreprocessor::TEMPLATE_OPTION

Constants included from Utils

Utils::LUTAML_EXP_IDX_TAG

Instance Method Summary collapse

Methods inherited from BaseStructuredTextPreprocessor

#process

Methods included from Utils

create_liquid_environment, error_signature, load_express_from_folder, load_express_from_index, load_express_repo_from_cache, load_express_repo_from_path, load_express_repositories, notify_render_errors, parse_document_express_indexes, processed_lines, relative_file_path, render_liquid_string, save_express_repo_to_cache

Constructor Details

#initialize(config = {}) ⇒ Data2TextPreprocessor

search document for block data2text after that take template from block and read file into this template example: [data2text,my_yaml=foobar.yaml,my_json=foobar.json] ----

=== {foobar.name}
{foobar.desc}

{my_json.symbol}:: {my_json.symbol_def}
----

with content of `foobar.yaml` file equal to:
- name: spaghetti
  desc: wheat noodles of 9mm diameter

and content of `foobar.json` file equal to:
{
  "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/lutaml/data2_text_preprocessor.rb', line 36

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