Module: Metanorma::Plugin::Glossarist::LiquidRendering
- Defined in:
- lib/metanorma/plugin/glossarist/liquid_rendering.rb
Constant Summary collapse
- DEFAULT_PATTERNS =
["%s.liquid", "_%s.liquid"].freeze
- DOCUMENT_PATTERNS =
["%s.liquid", "_%s.liquid", "_%s.adoc"].freeze
Class Method Summary collapse
Class Method Details
.render(content, include_paths:, patterns: DEFAULT_PATTERNS, assigns: {}, registry: nil) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/metanorma/plugin/glossarist/liquid_rendering.rb', line 12 def self.render(content, include_paths:, patterns: DEFAULT_PATTERNS, assigns: {}, registry: nil) template = ::Liquid::Template.parse(content) template.registers[:file_system] = Liquid::LocalFileSystem.new(include_paths, patterns) template.registers[:dataset_registry] = registry if registry rendered = template.render(assigns) raise template.errors.first.cause if template.errors.any? rendered end |