Class: Metanorma::Plugin::Lutaml::Yaml2TextPreprocessor

Inherits:
BaseStructuredTextPreprocessor show all
Includes:
Content
Defined in:
lib/metanorma/plugin/lutaml/yaml2_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 = {}) ⇒ Yaml2TextPreprocessor

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

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

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

with content of `foobar.yaml` file equal to:
- name: spaghetti
  desc: wheat noodles of 9mm diameter
  symbol: SPAG
  symbol_def: the situation is message like spaghetti at a kid's

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

SPAG:: the situation is message like spaghetti at a kid's meal


32
33
34
35
# File 'lib/metanorma/plugin/lutaml/yaml2_text_preprocessor.rb', line 32

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