Class: Metanorma::Plugin::Glossarist::Document
- Inherits:
-
Object
- Object
- Metanorma::Plugin::Glossarist::Document
- Defined in:
- lib/metanorma/plugin/glossarist/document.rb
Instance Attribute Summary collapse
-
#file_system ⇒ Object
Returns the value of attribute file_system.
-
#registry ⇒ Object
Returns the value of attribute registry.
Instance Method Summary collapse
- #add_raw(content) ⇒ Object
- #add_rendered(content, template: nil) ⇒ Object
-
#initialize ⇒ Document
constructor
A new instance of Document.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Document
Returns a new instance of Document.
9 10 11 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 9 def initialize @content = [] end |
Instance Attribute Details
#file_system ⇒ Object
Returns the value of attribute file_system.
7 8 9 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 7 def file_system @file_system end |
#registry ⇒ Object
Returns the value of attribute registry.
7 8 9 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 7 def registry @registry end |
Instance Method Details
#add_raw(content) ⇒ Object
13 14 15 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 13 def add_raw(content) @content << content end |
#add_rendered(content, template: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 17 def add_rendered(content, template: nil) include_paths = [file_system, TEMPLATES_DIR, template].compact @content << LiquidRendering.render( content, include_paths: include_paths, patterns: LiquidRendering::DOCUMENT_PATTERNS, registry: registry, ) end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/metanorma/plugin/glossarist/document.rb', line 27 def to_s @content.compact.join("\n") end |