module IsoDoc::BIPM::BaseConvert

Public Instance Methods

configuration() click to toggle source
# File lib/isodoc/bipm/base_convert.rb, line 6
def configuration
  Metanorma::BIPM.configuration
end
convert1(docxml, filename, dir) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/base_convert.rb, line 10
def convert1(docxml, filename, dir)
  @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))&.value == "JCGM"
  super
end
middle(isoxml, out) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/base_convert.rb, line 15
def middle(isoxml, out)
  if @jcgm
    super
  else
    middle_title(isoxml, out)
    middle_admonitions(isoxml, out)
    clause isoxml, out
    annex isoxml, out
    bibliography isoxml, out
  end
end
middle_clause(docxml) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/base_convert.rb, line 27
def middle_clause(docxml)
  if @jcgm
    super
  else
    "//sections/*"
  end
end
nonstd_bibitem(list, bibitem, ordinal, biblio) click to toggle source
# File lib/isodoc/bipm/base_convert.rb, line 42
def nonstd_bibitem(list, bibitem, ordinal, biblio)
  list.p **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
    ids = bibitem_ref_code(bibitem)
    identifiers = render_identifier(ids)
    if biblio then ref_entry_code(ref, ordinal, identifiers, ids)
    else
      ref << identifiers[0] || identifiers[1]
      ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
    end
    ref << " " unless biblio && !identifiers[1]
    reference_format(bibitem, ref)
  end
end
render_identifier(id) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/base_convert.rb, line 35
def render_identifier(id)
  ret = super
  ret[1] = nil if !id[1].nil? && id[1]["type"] == "BIPM"
  ret[2] = nil if !id[2].nil? && id[2]["type"] == "BIPM"
  ret
end
std_bibitem_entry(list, bibitem, ordinal, biblio) click to toggle source
# File lib/isodoc/bipm/base_convert.rb, line 56
def std_bibitem_entry(list, bibitem, ordinal, biblio)
  list.p **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
    identifiers = render_identifier(bibitem_ref_code(bibitem))
    if biblio then ref_entry_code(ref, ordinal, identifiers, nil)
    else
      ref << identifiers[0] || identifiers[1]
      ref << " #{identifiers[1]}" if identifiers[0] && identifiers[1]
    end
    date_note_process(bibitem, ref)
    ref << " " unless biblio && !identifiers[1]
    reference_format(bibitem, ref)
  end
end
term_cleanup(docxml) click to toggle source
Calls superclass method
# File lib/isodoc/bipm/base_convert.rb, line 70
def term_cleanup(docxml)
  @jcgm ? docxml : super
end
termref_cleanup(docxml) click to toggle source
# File lib/isodoc/bipm/base_convert.rb, line 74
def termref_cleanup(docxml)
  docxml
    .gsub(/\s*\[MODIFICATION\]\s*\[\/TERMREF\]/,
  l10n(", #{@i18n.modified} [/TERMREF]"))
    .gsub(%r{\s*\[/TERMREF\]\s*</p>\s*<p>\s*\[TERMREF\]}, "; ")
    .gsub(/\[TERMREF\]\s*/, l10n("[#{@i18n.source} "))
    .gsub(%r{\s*\[/TERMREF\]\s*}, l10n("]"))
    .gsub(/\s*\[MODIFICATION\]/, l10n(", #{@i18n.modified} &mdash; "))
end