metanorma-bipm 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/asciidoctor/bipm/converter.rb +64 -33
- data/lib/asciidoctor/bipm/isodoc.rng +130 -1
- data/lib/isodoc/bipm/bipm.brochure.xsl +44 -18
- data/lib/isodoc/bipm/bipm.guide.xsl +44 -18
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +44 -18
- data/lib/isodoc/bipm/bipm.rapport.xsl +44 -18
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +2 -0
- data/lib/isodoc/bipm/html/htmlstyle.css +7 -0
- data/lib/isodoc/bipm/i18n-en.yaml +9 -0
- data/lib/isodoc/bipm/i18n-fr.yaml +6 -0
- data/lib/isodoc/bipm/jcgm.standard.xsl +157 -59
- data/lib/isodoc/bipm/metadata.rb +15 -7
- data/lib/isodoc/bipm/pdf_convert.rb +12 -9
- data/lib/isodoc/bipm/presentation_xml_convert.rb +42 -14
- data/lib/isodoc/bipm/xref.rb +86 -51
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +4 -4
- metadata +18 -18
data/lib/isodoc/bipm/metadata.rb
CHANGED
@@ -8,7 +8,8 @@ module IsoDoc
|
|
8
8
|
end
|
9
9
|
|
10
10
|
SI_ASPECT = %w(A_e_deltanu A_e cd_Kcd_h_deltanu cd_Kcd full K_k_deltanu
|
11
|
-
|
11
|
+
K_k kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA
|
12
|
+
s_deltanu).freeze
|
12
13
|
|
13
14
|
def initialize(lang, script, labels)
|
14
15
|
super
|
@@ -24,12 +25,12 @@ module IsoDoc
|
|
24
25
|
TITLE = "//bibdata/title".freeze
|
25
26
|
|
26
27
|
def title(isoxml, _out)
|
27
|
-
lang1, lang2
|
28
|
+
lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
|
28
29
|
set(:doctitle, @c.encode(isoxml&.at(
|
29
30
|
ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
|
30
31
|
set(:docsubtitle, @c.encode(isoxml&.at(
|
31
32
|
ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
|
32
|
-
%w(appendix annex part subtitle).each do |e|
|
33
|
+
%w(appendix annex part subtitle provenance).each do |e|
|
33
34
|
set("#{e}title".to_sym, @c.encode(isoxml&.at(
|
34
35
|
ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
|
35
36
|
set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
|
@@ -40,9 +41,10 @@ module IsoDoc
|
|
40
41
|
def status_print(status)
|
41
42
|
return "Procès-Verbal" if status == "procès-verbal"
|
42
43
|
return "CIPM-MRA" if status == "cipm-mra"
|
44
|
+
|
43
45
|
status.split(/[- ]/).map.with_index do |s, i|
|
44
|
-
|
45
|
-
end.join(
|
46
|
+
%w(en de).include?(s) && i.positive? ? s : s.capitalize
|
47
|
+
end.join(" ")
|
46
48
|
end
|
47
49
|
|
48
50
|
def docid(isoxml, _out)
|
@@ -59,13 +61,19 @@ module IsoDoc
|
|
59
61
|
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
|
60
62
|
dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
|
61
63
|
dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
|
62
|
-
set(:org_abbrev,
|
63
|
-
isoxml.at(ns("//bibdata/ext/editorialgroup/committee
|
64
|
+
set(:org_abbrev,
|
65
|
+
isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
|
66
|
+
"[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
|
64
67
|
end
|
65
68
|
|
66
69
|
def extract_person_names_affiliations(authors)
|
67
70
|
extract_person_affiliations(authors)
|
68
71
|
end
|
72
|
+
|
73
|
+
def bibdate(isoxml, _out)
|
74
|
+
pubdate = isoxml.at(ns("//bibdata/date[not(@format)][@type = 'published']"))
|
75
|
+
pubdate and set(:pubdate_monthyear, monthyr(pubdate.text))
|
76
|
+
end
|
69
77
|
end
|
70
78
|
end
|
71
79
|
end
|
@@ -4,7 +4,7 @@ module IsoDoc
|
|
4
4
|
module BIPM
|
5
5
|
# A {Converter} implementation that generates PDF HTML output, and a
|
6
6
|
# document schema encapsulation of the document for validation
|
7
|
-
class PdfConvert <
|
7
|
+
class PdfConvert < IsoDoc::XslfoPdfConvert
|
8
8
|
def initialize(options)
|
9
9
|
@libdir = File.dirname(__FILE__)
|
10
10
|
super
|
@@ -15,20 +15,23 @@ module IsoDoc
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def pdf_stylesheet(docxml)
|
18
|
-
|
18
|
+
docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))
|
19
|
+
&.value == "JCGM" and
|
20
|
+
return "jcgm.standard.xsl"
|
21
|
+
|
19
22
|
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
20
|
-
doctype = "brochure" unless %w(guide mise-en-pratique rapport)
|
21
|
-
include? doctype
|
23
|
+
doctype = "brochure" unless %w(guide mise-en-pratique rapport)
|
24
|
+
.include? doctype
|
22
25
|
"bipm.#{doctype}.xsl"
|
23
26
|
end
|
24
27
|
|
25
28
|
def pdf_options(docxml)
|
29
|
+
n = configuration.document_namespace
|
30
|
+
q = "//m:bipm-standard/m:bibdata/m:language[@current = 'true']"
|
26
31
|
if docxml.root.name == "metanorma-collection" &&
|
27
|
-
docxml.at("
|
28
|
-
|
29
|
-
|
30
|
-
"m" => configuration.document_namespace)
|
31
|
-
"--split-by-language"
|
32
|
+
docxml.at("#{q}[. = 'fr']", "m" => n) &&
|
33
|
+
docxml.at("#{q}[. = 'en']", "m" => n)
|
34
|
+
"#{super} --split-by-language"
|
32
35
|
else
|
33
36
|
super
|
34
37
|
end
|
@@ -6,16 +6,25 @@ require_relative "index"
|
|
6
6
|
module IsoDoc
|
7
7
|
module BIPM
|
8
8
|
class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
|
9
|
+
def convert1(docxml, filename, dir)
|
10
|
+
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
|
11
|
+
"@acronym"))&.value == "JCGM"
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
9
15
|
def table1(f)
|
10
16
|
return if labelled_ancestor(f)
|
11
17
|
return if f["unnumbered"]
|
18
|
+
|
12
19
|
n = @xrefs.anchor(f['id'], :label, false)
|
13
20
|
prefix_name(f, ".<tab/>", l10n("#{@i18n.table.capitalize} #{n}"), "name")
|
14
21
|
end
|
15
22
|
|
16
23
|
def annex1(f)
|
24
|
+
return super if @jcgm
|
17
25
|
return if f["unnumbered"] == "true"
|
18
|
-
|
26
|
+
|
27
|
+
lbl = @xrefs.anchor(f["id"], :label)
|
19
28
|
if t = f.at(ns("./title"))
|
20
29
|
t.children = "<strong>#{t.children.to_xml}</strong>"
|
21
30
|
end
|
@@ -25,6 +34,7 @@ module IsoDoc
|
|
25
34
|
def clause1(f)
|
26
35
|
return if f["unnumbered"] == "true"
|
27
36
|
return if f.at(("./ancestor::*[@unnumbered = 'true']"))
|
37
|
+
|
28
38
|
super
|
29
39
|
end
|
30
40
|
|
@@ -35,21 +45,21 @@ module IsoDoc
|
|
35
45
|
|
36
46
|
def doccontrol(docxml)
|
37
47
|
return unless docxml.at(ns("//bibdata/relation[@type = 'supersedes']"))
|
48
|
+
|
38
49
|
clause = <<~END
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
#{list_drafts(docxml)}
|
46
|
-
</tbody></table></doccontrol>
|
50
|
+
<doccontrol>
|
51
|
+
<title>Document Control</title>
|
52
|
+
<table unnumbered="true"><tbody>
|
53
|
+
<tr><th>Authors:</th><td/><td>#{list_authors(docxml)}</td></tr>
|
54
|
+
#{doccontrol_row1(docxml)} #{doccontrol_row2(docxml)} #{list_drafts(docxml)}
|
55
|
+
</tbody></table></doccontrol>
|
47
56
|
END
|
48
57
|
docxml.root << clause
|
49
58
|
end
|
50
59
|
|
51
60
|
def doccontrol_row1(docxml)
|
52
61
|
return "" if list_draft(docxml, 1) == ["", ""] && list_cochairs(docxml).empty?
|
62
|
+
|
53
63
|
<<~ROW
|
54
64
|
<tr>#{list_draft(docxml, 1)&.map { |x| "<td>#{x}</td>" }&.join }
|
55
65
|
<td>#{list_cochairs(docxml)}</td></tr>
|
@@ -58,6 +68,7 @@ module IsoDoc
|
|
58
68
|
|
59
69
|
def doccontrol_row2(docxml)
|
60
70
|
return "" if list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty?
|
71
|
+
|
61
72
|
<<~ROW
|
62
73
|
<tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join }
|
63
74
|
<td>#{list_chairs(docxml)}</td></tr>
|
@@ -67,8 +78,8 @@ module IsoDoc
|
|
67
78
|
def list_drafts(xml)
|
68
79
|
ret = ""
|
69
80
|
i = 3
|
70
|
-
while
|
71
|
-
ret += "<tr>#{list_draft(xml, i).map { |x| "<td>#{x}</td>" }.join
|
81
|
+
while list_draft(xml, i) != ["", ""]
|
82
|
+
ret += "<tr>#{list_draft(xml, i).map { |x| "<td>#{x}</td>" }.join} "\
|
72
83
|
"<td/></tr>"
|
73
84
|
i += 1
|
74
85
|
end
|
@@ -78,6 +89,7 @@ module IsoDoc
|
|
78
89
|
def list_draft(xml, i)
|
79
90
|
return ["", ""] unless d =
|
80
91
|
xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{i}]/bibitem"))
|
92
|
+
|
81
93
|
date = d&.at(ns("./date"))&.text
|
82
94
|
draft = d&.at(ns("./version/draft"))&.text and
|
83
95
|
draft = "Draft #{draft}"
|
@@ -101,7 +113,7 @@ module IsoDoc
|
|
101
113
|
ret.empty? and return ""
|
102
114
|
role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
|
103
115
|
label = ret.size > 1 && role ? "#{role}s" : role
|
104
|
-
"#{label}: #{@i18n.multiple_and(ret, @i18n.get[
|
116
|
+
"#{label}: #{@i18n.multiple_and(ret, @i18n.get['and'])}"
|
105
117
|
end
|
106
118
|
|
107
119
|
def list_chairs(xml)
|
@@ -109,7 +121,7 @@ module IsoDoc
|
|
109
121
|
ret.empty? and return ""
|
110
122
|
role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
|
111
123
|
label = ret.size > 1 && role ? "#{role}s" : role
|
112
|
-
"#{label}: #{@i18n.multiple_and(ret, @i18n.get[
|
124
|
+
"#{label}: #{@i18n.multiple_and(ret, @i18n.get['and'])}"
|
113
125
|
end
|
114
126
|
|
115
127
|
def list_people(xml, xpath)
|
@@ -126,13 +138,29 @@ module IsoDoc
|
|
126
138
|
end
|
127
139
|
|
128
140
|
def twitter_cldr_localiser_symbols
|
129
|
-
{ group: " ", fraction_group: " ",
|
141
|
+
{ group: " ", fraction_group: " ",
|
142
|
+
fraction_group_digits: 3 }
|
130
143
|
end
|
131
144
|
|
132
145
|
def mathml1(f, locale)
|
133
146
|
localize_maths(f, locale)
|
134
147
|
end
|
135
148
|
|
149
|
+
def bibdata_i18n(bibdata)
|
150
|
+
super
|
151
|
+
bibdata_dates(bibdata)
|
152
|
+
end
|
153
|
+
|
154
|
+
def bibdata_dates(bibdata)
|
155
|
+
pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
|
156
|
+
return unless pubdate
|
157
|
+
|
158
|
+
meta = metadata_init(@lang, @script, @i18n)
|
159
|
+
pubdate.next = pubdate.dup
|
160
|
+
pubdate.next["format"] = "ddMMMyyyy"
|
161
|
+
pubdate.next.children = meta.monthyr(pubdate.text)
|
162
|
+
end
|
163
|
+
|
136
164
|
include Init
|
137
165
|
end
|
138
166
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -8,9 +8,20 @@ module IsoDoc
|
|
8
8
|
super
|
9
9
|
end
|
10
10
|
|
11
|
+
def parse(docxml)
|
12
|
+
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
|
13
|
+
"@acronym"))&.value == "JCGM"
|
14
|
+
@annexlbl =
|
15
|
+
if docxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
|
16
|
+
@labels["appendix"]
|
17
|
+
else
|
18
|
+
@labels["annex"]
|
19
|
+
end
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
11
23
|
def clause_names(docxml, sect_num)
|
12
|
-
if
|
13
|
-
value == "JCGM"
|
24
|
+
if @jcgm
|
14
25
|
clause_names_jcgm(docxml, sect_num)
|
15
26
|
else
|
16
27
|
clause_names_bipm(docxml, sect_num)
|
@@ -19,21 +30,21 @@ module IsoDoc
|
|
19
30
|
|
20
31
|
def clause_names_jcgm(docxml, sect_num)
|
21
32
|
docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]"\
|
22
|
-
"[not(descendant::terms)]")).
|
33
|
+
"[not(descendant::terms)]")).each do |c|
|
23
34
|
section_names(c, sect_num, 1)
|
24
35
|
end
|
25
36
|
end
|
26
37
|
|
27
|
-
def clause_names_bipm(docxml,
|
38
|
+
def clause_names_bipm(docxml, _sect_num)
|
28
39
|
n = Counter.new
|
29
40
|
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')] | "\
|
30
41
|
"//sections/terms[not(@unnumbered = 'true')] | "\
|
31
|
-
"//sections/definitions[not(@unnumbered = 'true')]"))
|
32
|
-
|
42
|
+
"//sections/definitions[not(@unnumbered = 'true')]"))
|
43
|
+
.each { |c| section_names(c, n, 1) }
|
33
44
|
docxml.xpath(ns("//sections/clause[@unnumbered = 'true'] | "\
|
34
45
|
"//sections/terms[@unnumbered = 'true'] | "\
|
35
|
-
"//sections/definitions[@unnumbered = 'true']"))
|
36
|
-
|
46
|
+
"//sections/definitions[@unnumbered = 'true']"))
|
47
|
+
.each { |c| unnumbered_section_names(c, 1) }
|
37
48
|
end
|
38
49
|
|
39
50
|
NUMBERED_SUBCLAUSES = "./clause[not(@unnumbered = 'true')] | "\
|
@@ -48,18 +59,24 @@ module IsoDoc
|
|
48
59
|
"./terms[@unnumbered = 'true'] | "\
|
49
60
|
"./definitions[@unnumbered = 'true']".freeze
|
50
61
|
|
62
|
+
def section_name_anchors(clause, num, lvl)
|
63
|
+
lbl = @jcgm ? "clause_jcgm" : "clause"
|
64
|
+
@anchors[clause["id"]] =
|
65
|
+
{ label: num.print, xref: l10n("#{@labels[lbl]} #{num.print}"),
|
66
|
+
level: lvl, type: "clause" }
|
67
|
+
end
|
68
|
+
|
51
69
|
def section_names(clause, num, lvl)
|
52
70
|
return num if clause.nil?
|
71
|
+
|
53
72
|
num.increment(clause)
|
54
|
-
@anchors[clause["id"]] =
|
55
|
-
{ label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"),
|
56
|
-
level: lvl, type: "clause" }
|
73
|
+
@anchors[clause["id"]] = section_name_anchors(clause, num, lvl)
|
57
74
|
i = Counter.new
|
58
75
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
59
76
|
i.increment(c)
|
60
77
|
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
61
78
|
end
|
62
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).
|
79
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
63
80
|
unnumbered_section_names1(c, lvl + 1)
|
64
81
|
end
|
65
82
|
num
|
@@ -67,31 +84,37 @@ module IsoDoc
|
|
67
84
|
|
68
85
|
def unnumbered_section_names(clause, lvl)
|
69
86
|
return if clause.nil?
|
70
|
-
|
87
|
+
|
88
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
71
89
|
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
|
72
90
|
level: lvl, type: "clause" }
|
73
|
-
clause.xpath(ns(SUBCLAUSES)).
|
91
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
74
92
|
unnumbered_section_names1(c, lvl + 1)
|
75
93
|
end
|
76
94
|
end
|
77
95
|
|
78
|
-
def
|
96
|
+
def section_name1_anchors(clause, num, level)
|
97
|
+
lbl = @jcgm ? "" : "#{@labels['subclause']} "
|
79
98
|
@anchors[clause["id"]] =
|
80
99
|
{ label: num, level: level,
|
81
|
-
xref: l10n("#{
|
100
|
+
xref: l10n("#{lbl}#{num}"),
|
82
101
|
type: "clause" }
|
102
|
+
end
|
103
|
+
|
104
|
+
def section_names1(clause, num, level)
|
105
|
+
@anchors[clause["id"]] = section_name1_anchors(clause, num, level)
|
83
106
|
i = Counter.new
|
84
107
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
85
108
|
i.increment(c)
|
86
109
|
section_names1(c, "#{num}.#{i.print}", level + 1)
|
87
110
|
end
|
88
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).
|
111
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
89
112
|
unnumbered_section_names1(c, lvl + 1)
|
90
113
|
end
|
91
114
|
end
|
92
115
|
|
93
116
|
def unnumbered_section_names1(clause, level)
|
94
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
117
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
95
118
|
@anchors[clause["id"]] =
|
96
119
|
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level, type: "clause" }
|
97
120
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
@@ -101,69 +124,80 @@ module IsoDoc
|
|
101
124
|
|
102
125
|
def back_anchor_names(docxml)
|
103
126
|
super
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
127
|
+
i = @jcgm ? Counter.new("@") : Counter.new(0)
|
128
|
+
docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).each do |c|
|
129
|
+
i.increment(c)
|
130
|
+
annex_names(c, i.print)
|
131
|
+
end
|
132
|
+
docxml.xpath(ns("//annex[@unnumbered = 'true']"))
|
133
|
+
.each { |c| unnumbered_annex_names(c) }
|
110
134
|
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
111
135
|
end
|
112
136
|
|
137
|
+
def annex_name_anchors(clause, num)
|
138
|
+
{ label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
|
139
|
+
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
140
|
+
end
|
141
|
+
|
113
142
|
def annex_names(clause, num)
|
114
|
-
@anchors[clause["id"]] =
|
115
|
-
{ label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
|
116
|
-
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
143
|
+
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
117
144
|
if a = single_annex_special_section(clause)
|
118
|
-
annex_names1(a,
|
145
|
+
annex_names1(a, num.to_s, 1)
|
119
146
|
else
|
120
147
|
i = Counter.new
|
121
148
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
122
149
|
i.increment(c)
|
123
150
|
annex_names1(c, "#{num}.#{i.print}", 2)
|
124
151
|
end
|
125
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
126
|
-
each { |c| unnumbered_annex_names1(c, 2) }
|
152
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
153
|
+
.each { |c| unnumbered_annex_names1(c, 2) }
|
127
154
|
end
|
128
155
|
hierarchical_asset_names(clause, num)
|
129
156
|
end
|
130
157
|
|
158
|
+
def unnumbered_annex_anchors(lbl)
|
159
|
+
{ label: lbl, type: "clause", value: "",
|
160
|
+
xref: l10n(%{"#{lbl}"}), level: 1 }
|
161
|
+
end
|
162
|
+
|
131
163
|
def unnumbered_annex_names(clause)
|
132
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
133
|
-
@anchors[clause["id"]] =
|
134
|
-
{ label: lbl, type: "clause", value: "",
|
135
|
-
xref: l10n(%{"#{lbl}"}), level: 1 }
|
164
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
165
|
+
@anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
|
136
166
|
if a = single_annex_special_section(clause)
|
137
|
-
annex_names1(a,
|
167
|
+
annex_names1(a, num.to_s, 1)
|
138
168
|
else
|
139
|
-
clause.xpath(ns(SUBCLAUSES))
|
140
|
-
each { |c| unnumbered_annex_names1(c, 2) }
|
169
|
+
clause.xpath(ns(SUBCLAUSES))
|
170
|
+
.each { |c| unnumbered_annex_names1(c, 2) }
|
141
171
|
end
|
142
172
|
hierarchical_asset_names(clause, lbl)
|
143
173
|
end
|
144
174
|
|
175
|
+
def annex_names1_anchors(num, level)
|
176
|
+
lbl = @jcgm ? "" : "#{@annexlbl} "
|
177
|
+
{ label: num, xref: l10n("#{lbl}#{num}"),
|
178
|
+
level: level, type: "clause" }
|
179
|
+
end
|
180
|
+
|
145
181
|
def annex_names1(clause, num, level)
|
146
|
-
@anchors[clause["id"]] =
|
147
|
-
{ label: num, xref: l10n("#{@annexlbl} #{num}"),
|
148
|
-
level: level, type: "clause" }
|
182
|
+
@anchors[clause["id"]] = annex_names1_anchors(num, level)
|
149
183
|
i = Counter.new
|
150
184
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
151
185
|
i.increment(c)
|
152
186
|
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
153
187
|
end
|
154
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
155
|
-
each { |c| unnumbered_annex_names1(c, level + 1) }
|
188
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
189
|
+
.each { |c| unnumbered_annex_names1(c, level + 1) }
|
156
190
|
end
|
157
191
|
|
158
192
|
def unnumbered_annex_names1(clause, level)
|
159
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
193
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
160
194
|
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
|
161
195
|
level: level, type: "clause" }
|
162
|
-
clause.xpath(ns(SUBCLAUSES))
|
163
|
-
each { |c| unnumbered_annex_names1(c, level + 1) }
|
196
|
+
clause.xpath(ns(SUBCLAUSES))
|
197
|
+
.each { |c| unnumbered_annex_names1(c, level + 1) }
|
164
198
|
end
|
165
199
|
|
166
|
-
def annex_name_lbl(
|
200
|
+
def annex_name_lbl(_clause, num)
|
167
201
|
l10n("<strong>#{@annexlbl} #{num}</strong>")
|
168
202
|
end
|
169
203
|
|
@@ -171,13 +205,14 @@ module IsoDoc
|
|
171
205
|
c = Counter.new
|
172
206
|
clause.xpath(ns(".//formula")).each do |t|
|
173
207
|
next if t["id"].nil? || t["id"].empty?
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
208
|
+
|
209
|
+
@anchors[t["id"]] = anchor_struct(
|
210
|
+
c.increment(t).print, nil,
|
211
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
212
|
+
"formula", t["unnumbered"]
|
213
|
+
)
|
178
214
|
end
|
179
215
|
end
|
180
|
-
|
181
216
|
end
|
182
217
|
end
|
183
218
|
end
|