lib/isodoc/iho/xref.rb in metanorma-iho-0.5.8 vs lib/isodoc/iho/xref.rb in metanorma-iho-0.6.0
- old
+ new
@@ -19,12 +19,13 @@
appendix_names(clause, num)
lbl = annexlbl(clause["obligation"] == "informative")
@anchors[clause["id"]] =
{ label: annex_name_lbl(clause, num), type: "clause", elem: lbl,
xref: l10n("#{lbl} #{num}"), level: 1, value: num }
- if a = single_annex_special_section(clause)
- annex_names1(a, num.to_s, 1)
+ if @klass.single_term_clause?(clause)
+ annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
+ num.to_s, 1)
else
i = Counter.new
clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
.each do |c|
i.increment(c)
@@ -34,20 +35,22 @@
hierarchical_asset_names(clause, num)
end
def back_anchor_names(docxml)
super
- i = Counter.new
- docxml.xpath(ns("//annex[@obligation = 'informative']"))
- .each do |c|
- i.increment(c)
- annex_names(c, i.print)
- end
- i = Counter.new("@", skip_i: true)
- docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
- .each do |c|
- i.increment(c)
- annex_names(c, i.print)
+ if @parse_settings.empty? || @parse_settings[:clauses]
+ i = Counter.new
+ docxml.xpath(ns("//annex[@obligation = 'informative']"))
+ .each do |c|
+ i.increment(c)
+ annex_names(c, i.print)
+ end
+ i = Counter.new("@", skip_i: true)
+ docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
+ .each do |c|
+ i.increment(c)
+ annex_names(c, i.print)
+ end
end
end
def annex_names1(clause, num, level)
lbl = annexlbl(clause.at("./ancestor::xmlns:annex/@obligation")