Class: Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
- Inherits:
-
BaseStructuredTextPreprocessor
- Object
- Asciidoctor::Extensions::Preprocessor
- BaseStructuredTextPreprocessor
- Metanorma::Plugin::Datastruct::Yaml2TextPreprocessor
- Includes:
- Content
- Defined in:
- lib/metanorma/plugin/datastruct/yaml2_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
-
#initialize(config = {}) ⇒ Yaml2TextPreprocessor
constructor
search document for block ‘yaml2text` after that take template from block and read file into this template example: [yaml2text,foobar.yaml] —- === itemitem.name itemitem.desc.
Methods inherited from BaseStructuredTextPreprocessor
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
34 35 36 37 |
# File 'lib/metanorma/plugin/datastruct/yaml2_text_preprocessor.rb', line 34 def initialize(config = {}) super @config[:block_name] = "yaml2text" end |