Class: Metanorma::Plugin::Datastruct::Data2TextPreprocessor
- Inherits:
-
BaseStructuredTextPreprocessor
- Object
- Asciidoctor::Extensions::Preprocessor
- BaseStructuredTextPreprocessor
- Metanorma::Plugin::Datastruct::Data2TextPreprocessor
- Includes:
- Content
- Defined in:
- lib/metanorma/plugin/datastruct/data2_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 = {}) ⇒ Data2TextPreprocessor
constructor
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] —- === foobarfoobar.name foobarfoobar.desc.
Methods inherited from BaseStructuredTextPreprocessor
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
38 39 40 41 |
# File 'lib/metanorma/plugin/datastruct/data2_text_preprocessor.rb', line 38 def initialize(config = {}) super @config[:block_name] = "data2text" end |