Method: IsoDoc::Function::References#bibitem_ref_code

Defined in:
lib/isodoc/function/references.rb

#bibitem_ref_code(bib) ⇒ Object

returns [metanorma, non-metanorma, DOI/ISSN/ISBN] identifiers



72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/isodoc/function/references.rb', line 72

def bibitem_ref_code(bib)
  id = bib.at(ns("./docidentifier[@type = 'metanorma']"))
  id1 = pref_ref_code(bib)
  id2 = bib.at(ns("./docidentifier[@type = 'DOI' or @type = 'ISSN' or "\
                  "@type = 'ISBN']"))
  id3 = bib.at(ns("./docidentifier[@type = 'metanorma-ordinal']"))
  return [id, id1, id2, id3] if id || id1 || id2 || id3
  return [nil, nil, nil, nil] if bib["suppress_identifier"] == "true"

  id = Nokogiri::XML::Node.new("docidentifier", bib.document)
  id << "(NO ID)"
  [nil, id, nil, nil]
end