Class: Metanorma::Plugin::Lutaml::LutamlXsdPreprocessor

Inherits:
BasePreprocessor
  • Object
show all
Defined in:
lib/metanorma/plugin/lutaml/lutaml_xsd_preprocessor.rb

Overview

Preprocessor for XSD (XML Schema Definition) files. Parses XSD via lutaml-model’s XSD parser and exposes the schema object to Liquid templates.

Caching: parsed XSD results are cached at two levels:

  • Class-level (@@xsd_cache) persists across document invocations

  • Document-level (document.attributes) within a single document’s processing

Constant Summary collapse

XSD_PREPROCESSOR_REGEX =
%r{
  ^                            # Start of line
  \[                           # Opening bracket
  (?:\blutaml_xsd\b)           # lutaml_xsd
  ,                            # Comma separator
  (?<index_names>[^,]+)?       # Optional index names
  ,?                           # Optional comma
  (?<context_name>[^,]+)?      # Optional context name
  (?<options>,.*)?             # Optional options
  \]                           # Closing bracket
}x

Constants included from Utils

Utils::LUTAML_EXP_IDX_TAG

Instance Method Summary collapse

Methods inherited from BasePreprocessor

#process

Methods included from Utils

create_liquid_environment, error_signature, load_express_from_folder, load_express_from_index, load_express_repo_from_cache, load_express_repo_from_path, load_express_repositories, notify_render_errors, parse_document_express_indexes, processed_lines, relative_file_path, render_liquid_string, save_express_repo_to_cache

Constructor Details

#initialize(_config = {}) ⇒ LutamlXsdPreprocessor

Returns a new instance of LutamlXsdPreprocessor.



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

def initialize(_config = {})
  super
  @@xsd_cache ||= {}
end