Class: Metanorma::Plugin::Glossarist::BibliographyRenderer

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

Instance Method Summary collapse

Constructor Details

#initializeBibliographyRenderer

Returns a new instance of BibliographyRenderer.



7
8
9
# File 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb', line 7

def initialize
  @rendered = {}
end

Instance Method Details

#render_all(concepts, lang: "eng") ⇒ Object



20
21
22
23
# File 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb', line 20

def render_all(concepts, lang: "eng")
  entries = concepts.filter_map { |c| render_entry(c, lang: lang) }
  entries.sort.join("\n")
end

#render_entry(concept, lang: "eng") ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb', line 11

def render_entry(concept, lang: "eng")
  l10n = concept.localization(lang)
  return nil unless l10n

  entries = source_entries(l10n)
  warn_unresolved_xrefs(l10n)
  entries.empty? ? nil : entries.sort.join("\n")
end