Class: Metanorma::Plugin::Glossarist::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/metanorma/plugin/glossarist/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDocument

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_systemObject

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

#registryObject

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_content(content, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/metanorma/plugin/glossarist/document.rb', line 13

def add_content(content, options = {})
  @content << if options[:render]
                LiquidRendering.render(
                  content,
                  include_paths: [file_system,
                                  options[:template]].compact,
                  patterns: LiquidRendering::DOCUMENT_PATTERNS,
                  registry: registry,
                )
              else
                content
              end
end

#to_sObject



27
28
29
# File 'lib/metanorma/plugin/glossarist/document.rb', line 27

def to_s
  @content.compact.join("\n")
end