Class: Metanorma::Plugin::Glossarist::DatasetPreprocessor
- Inherits:
-
Asciidoctor::Extensions::Preprocessor
- Object
- Asciidoctor::Extensions::Preprocessor
- Metanorma::Plugin::Glossarist::DatasetPreprocessor
- Defined in:
- lib/metanorma/plugin/glossarist/dataset_preprocessor.rb
Constant Summary collapse
- DATASET_ATTR_REGEX =
/^:glossarist-dataset:\s*(.*?)$/m- IMPORT_REGEX =
/^glossarist::import\[(.*?)\]$/m- RENDER_REGEX =
/^glossarist::render\[(.*?)\]$/m- BLOCK_REGEX =
/^\[glossarist,(.+?),(.+?)\]$/m- BIBLIOGRAPHY_REGEX =
/^glossarist::render_bibliography\[(.*?)\]$/m- BIBLIOGRAPHY_ENTRY_REGEX =
/^glossarist::render_bibliography_entry\[(.*?)\]$/m- BIB_ANCHOR_REGEX =
/^\*\s*\[\[\[([^,]+)/
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ DatasetPreprocessor
constructor
A new instance of DatasetPreprocessor.
- #process(document, reader) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ DatasetPreprocessor
Returns a new instance of DatasetPreprocessor.
20 21 22 23 |
# File 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb', line 20 def initialize(config = {}) super @config = config end |
Instance Method Details
#process(document, reader) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/metanorma/plugin/glossarist/dataset_preprocessor.rb', line 25 def process(document, reader) input_lines = reader.lines.to_enum @config[:file_system] = relative_file_path(document, "") @registry = DatasetRegistry.new @rendered_concepts = [] @title_depth = 2 @existing_bib_anchors = [] @seen_glossarist = false processed_doc = prepare_document(document, input_lines) log(document, processed_doc.to_s) if @seen_glossarist Asciidoctor::PreprocessorReader.new(document, processed_doc.to_s.split("\n")) end |