lib/isodoc/iso/xref.rb in metanorma-iso-1.7.4 vs lib/isodoc/iso/xref.rb in metanorma-iso-1.8.0
- old
+ new
@@ -83,10 +83,11 @@
def hierarchical_formula_names(clause, num)
c = IsoDoc::XrefGen::Counter.new
clause.xpath(ns(".//formula")).each do |t|
next if t["id"].nil? || t["id"].empty?
+
@anchors[t["id"]] =
anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", t,
t["inequality"] ? @labels["inequality"] : @labels["formula"],
"formula", t["unnumbered"])
end
@@ -106,30 +107,32 @@
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
each do |t|
j = subfigure_increment(j, c, t)
sublabel = j.zero? ? nil : "#{(j+96).chr})"
next if t["id"].nil? || t["id"].empty?
+
figure_anchor(t, sublabel, c.print)
end
end
def hierarchical_figure_names(clause, num)
c = IsoDoc::XrefGen::Counter.new
j = 0
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
- each do |t|
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]"))
+ .each do |t|
j = subfigure_increment(j, c, t)
label = "#{num}#{hiersep}#{c.print}"
- sublabel = j.zero? ? nil : "#{(j+96).chr})"
+ sublabel = j.zero? ? nil : "#{(j + 96).chr})"
next if t["id"].nil? || t["id"].empty?
+
figure_anchor(t, sublabel, label)
end
end
def reference_names(ref)
super
- @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].
- sub(/ \(All Parts\)/i, "") }
+ @anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref]
+ .sub(/ \(All Parts\)/i, "") }
end
def back_anchor_names(docxml)
super
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }