module IsoDoc module NIST module BaseConvert NIST_PUBLISHER_XPATH = "./contributor[xmlns:role/@type = 'publisher']/"\ "organization[abbreviation = 'NIST' or xmlns:name = 'NIST']".freeze # we are taking the ref number/code out as prefix to reference def nonstd_bibitem(list, b, ordinal, bibliography) list.p **attr_code(iso_bibitem_entry_attrs(b, bibliography)) do |r| reference_format(b, r) end end def std_bibitem_entry(list, b, ordinal, biblio) nonstd_bibitem(list, b, ordinal, biblio) end def reference_format(b, r) if code = b.at(ns("./docidentifier[@display = 'true']")) r << code.text insert_tab(r, 1) end reference_format1(b, r) end def reference_format1(b, r) if ftitle = b.at(ns("./formattedref")) ftitle&.children&.each { |n| parse(n, r) } else title = b.at(ns("./title[@language = '#{@lang}']")) || b.at(ns("./title")) r.i do |i| title&.children&.each { |n| parse(n, i) } end end end def bracket_if_num(x) return nil if x.nil? x = x.text.sub(/^\[/, "").sub(/\]$/, "") "[#{x}]" end def omit_docid_prefix(prefix) return true if prefix.nil? || prefix.empty? super || prefix == "NIST" end def bibliography_parse(node, out) return if node["hidden"] == "true" title = node&.at(ns("./title"))&.text || "" out.div do |div| unless suppress_biblio_title(node) clause_parse_title(node, div, node.at(ns("./title")), out) end biblio_list(node, div, true) end end def bibliography(isoxml, out) f = isoxml.at(ns("//bibliography/clause | //bibliography/references")) || return page_break(out) isoxml.xpath(ns("//bibliography/clause | //bibliography/references")).each do |f| next if f["hidden"] == "true" out.div do |div| div.h1 **{ class: "Section3" } do |h1| f&.at(ns("./title"))&.children.each { |n| parse(n, h1) } end biblio_list(f, div, false) end end end end end end