Class: Metanorma::Plugin::Lutaml::LutamlUmlClassPreprocessor

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

Overview

Macro for quick rendering of datamodel attributes/values table

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

Direct Known Subclasses

LutamlUmlAttributesTablePreprocessor

Constant Summary collapse

MACRO_REGEXP =
/\[lutaml_uml_class,([^,]+),?([^,]+),?(.+?)?\]/

Instance Method Summary collapse

Instance Method Details

#get_macro_regexpObject



20
21
22
# File 'lib/metanorma/plugin/lutaml/lutaml_uml_class_preprocessor.rb', line 20

def get_macro_regexp
  self.class.const_get(:MACRO_REGEXP)
end

#process(document, reader) ⇒ Object

search document for block ‘datamodel_attributes_table`

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


27
28
29
30
31
32
# File 'lib/metanorma/plugin/lutaml/lutaml_uml_class_preprocessor.rb', line 27

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