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

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

Instance Method Summary collapse

Methods included from CitationHelper

#citation_ref_label

Constructor Details

#initializeBibliographyRenderer

Returns a new instance of BibliographyRenderer.



9
10
11
# File 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb', line 9

def initialize
  @rendered = {}
end

Instance Method Details

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



22
23
24
25
# File 'lib/metanorma/plugin/glossarist/bibliography_renderer.rb', line 22

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



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

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