Class: Metanorma::Plugin::Lutaml::LutamlUmlDatamodelDescriptionPreprocessor

Inherits:
Asciidoctor::Extensions::Preprocessor
  • Object
show all
Defined in:
lib/metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor.rb

Overview

Macro for quick rendering of datamodel attributes/values table

@example [lutaml_uml_attributes_table,path/to/lutaml,EntityName]

Constant Summary collapse

MACRO_REGEXP =
/\[lutaml_uml_datamodel_description,([^,]+),?(.+)?\]/
LIQUID_INCLUDE_PATH =
File.join(
  Gem.loaded_specs["metanorma-plugin-lutaml"].full_gem_path,
  "lib", "metanorma", "plugin", "lutaml", "liquid_templates"
)
DEFAULT_RENDER_INCLUDE =
"packages"
RENDER_STYLES_INCLUDES =
{
  "default" => "packages",
  "entity_list" => "packages_entity_list",
  "entity_list_class" => "packages_entity_list_class",
  "data_dictionary" => "packages_data_dictionary",
}.freeze
RENDER_STYLE_ATTRIBUTE =
"render_style"
SUPPORTED_NESTED_MACRO =
%w[
  before diagram_include_block after include_block package_text
].freeze

Instance Method Summary collapse

Instance Method Details

#process(document, reader) ⇒ Object

search document for block ‘lutaml_uml_datamodel_description`

read include derectives that goes after that in block and transform
into yaml2text blocks


38
39
40
41
42
43
# File 'lib/metanorma/plugin/lutaml/lutaml_uml_datamodel_description_preprocessor.rb', line 38

def process(document, reader)
  r = Asciidoctor::PreprocessorNoIfdefsReader.new document, reader.lines
  input_lines = r.readlines.to_enum
  Asciidoctor::PreprocessorNoIfdefsReader
    .new(document, processed_lines(document, input_lines))
end