Module: IsoDoc::Function::References
- Included in:
- Common
- Defined in:
- lib/isodoc/function/references.rb
Instance Method Summary collapse
- #bibitem_entry(list, bib, _ordinal, biblio) ⇒ Object
- #biblio_list(refs, div, biblio) ⇒ Object
- #bibliography(node, out) ⇒ Object
- #bibliography_parse(node, out) ⇒ Object
- #bibliography_xpath ⇒ Object
- #iso_bibitem_entry_attrs(bib, biblio) ⇒ Object
- #norm_ref(node, out) ⇒ Object
- #norm_ref_xpath ⇒ Object
- #reference_format(bib, out) ⇒ Object
Instance Method Details
#bibitem_entry(list, bib, _ordinal, biblio) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/isodoc/function/references.rb', line 4 def bibitem_entry(list, bib, _ordinal, biblio) list.p **attr_code(iso_bibitem_entry_attrs(bib, biblio)) do |ref| tag = bib.at(ns("./biblio-tag")) tag&.children&.each { |n| parse(n, ref) } reference_format(bib, ref) end end |
#biblio_list(refs, div, biblio) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/isodoc/function/references.rb', line 21 def biblio_list(refs, div, biblio) i = 0 refs.children.each do |b| if b.name == "bibitem" b["hidden"] == "true" and next i += 1 bibitem_entry(div, b, i, biblio) else parse(b, div) unless %w(title).include? b.name end end end |
#bibliography(node, out) ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/isodoc/function/references.rb', line 58 def bibliography(node, out) node["hidden"] != "true" or return page_break(out) out.div do |div| div.h1 class: "Section3" do |h1| node.at(ns("./title"))&.children&.each { |c2| parse(c2, h1) } end biblio_list(node, div, true) end end |
#bibliography_parse(node, out) ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/isodoc/function/references.rb', line 69 def bibliography_parse(node, out) node["hidden"] != true or return out.div do |div| clause_parse_title(node, div, node.at(ns("./title")), out, { class: "Section3" }) biblio_list(node, div, true) end end |
#bibliography_xpath ⇒ Object
52 53 54 55 56 |
# File 'lib/isodoc/function/references.rb', line 52 def bibliography_xpath "//bibliography/clause[.//references]" \ "[not(.//references[@normative = 'true'])] | " \ "//bibliography/references[@normative = 'false']" end |
#iso_bibitem_entry_attrs(bib, biblio) ⇒ Object
12 13 14 |
# File 'lib/isodoc/function/references.rb', line 12 def iso_bibitem_entry_attrs(bib, biblio) { id: bib["id"], class: biblio ? "Biblio" : "NormRef" } end |
#norm_ref(node, out) ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/isodoc/function/references.rb', line 41 def norm_ref(node, out) node["hidden"] != "true" or return out.div do |div| clause_name(node, node.at(ns("./title")), div, nil) if node.name == "clause" node.elements.each { |e| parse(e, div) unless e.name == "title" } else biblio_list(node, div, false) end end end |
#norm_ref_xpath ⇒ Object
34 35 36 37 38 39 |
# File 'lib/isodoc/function/references.rb', line 34 def norm_ref_xpath "//bibliography/references[@normative = 'true'] | " \ "//bibliography/clause[.//references[@normative = 'true']] | " \ "//sections/references[@normative = 'true'] | " \ "//sections/clause[not(@type)][.//references[@normative = 'true']]" end |
#reference_format(bib, out) ⇒ Object
16 17 18 19 |
# File 'lib/isodoc/function/references.rb', line 16 def reference_format(bib, out) ftitle = bib.at(ns("./formattedref")) ftitle&.children&.each { |n| parse(n, out) } end |