Class: IsoDoc::IEEE::Xref
- Inherits:
-
Xref
- Object
- Xref
- IsoDoc::IEEE::Xref
- Defined in:
- lib/isodoc/ieee/xref.rb
Instance Method Summary collapse
- #initial_anchor_names(doc) ⇒ Object
-
#initialize(lang, script, klass, labels, options) ⇒ Xref
constructor
A new instance of Xref.
- #middle_section_asset_names(doc) ⇒ Object
- #middle_sections ⇒ Object
- #sequential_formula_names(clause) ⇒ Object
Constructor Details
#initialize(lang, script, klass, labels, options) ⇒ Xref
Returns a new instance of Xref.
9 10 11 12 |
# File 'lib/isodoc/ieee/xref.rb', line 9 def initialize(lang, script, klass, labels, ) super @hierarchical_assets = [:hierarchical_assets] end |
Instance Method Details
#initial_anchor_names(doc) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/isodoc/ieee/xref.rb', line 14 def initial_anchor_names(doc) if @parse_settings.empty? || @parse_settings[:clauses] doc.xpath(ns("//preface/*")).each do |c| c.element? and preface_names(c) end end if @parse_settings.empty? if @hierarchical_assets hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"), "Preface") else sequential_asset_names(doc.xpath(ns("//preface/*"))) end end if @parse_settings.empty? || @parse_settings[:clauses] n = Counter.new n = section_names(doc.at(ns("//clause[@type = 'overview']")), n, 1) n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1) n = section_names(doc.at(ns("//sections/terms | "\ "//sections/clause[descendant::terms]")), n, 1) n = section_names(doc.at(ns("//sections/definitions")), n, 1) clause_names(doc, n) end if @parse_settings.empty? middle_section_asset_names(doc) termnote_anchor_names(doc) termexample_anchor_names(doc) end end |
#middle_section_asset_names(doc) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/isodoc/ieee/xref.rb', line 50 def middle_section_asset_names(doc) middle_sections = "#{@klass.norm_ref_xpath} | //sections/terms | "\ "//sections/definitions | //clause[parent::sections]" if @hierarchical_assets doc.xpath(ns(middle_sections)).each do |c| hierarchical_asset_names(c, @anchors[c["id"]][:label]) end else sequential_asset_names(doc.xpath(ns(middle_sections))) end end |
#middle_sections ⇒ Object
44 45 46 47 48 |
# File 'lib/isodoc/ieee/xref.rb', line 44 def middle_sections " #{@klass.norm_ref_xpath} | "\ "//sections/terms | //preface/clause | "\ "//sections/definitions | //clause[parent::sections]" end |
#sequential_formula_names(clause) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/isodoc/ieee/xref.rb', line 63 def sequential_formula_names(clause) c = Counter.new clause.xpath(ns(".//formula")).reject do |n| blank?(n["id"]) end.each do |t| @anchors[t["id"]] = anchor_struct( c.increment(t).print, nil, t["inequality"] ? @labels["inequality"] : @labels["formula"], "formula", t["unnumbered"] ) end end |