metanorma-bipm 1.0.3 → 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/.github/workflows/rake.yml +9 -32
- data/.gitignore +1 -0
- data/.rubocop.yml +14 -0
- data/lib/asciidoctor/bipm/biblio.rng +4 -6
- data/lib/asciidoctor/bipm/bipm.rng +6 -0
- data/lib/asciidoctor/bipm/converter.rb +65 -34
- data/lib/asciidoctor/bipm/isodoc.rng +235 -3
- data/lib/isodoc/bipm/bipm.brochure.xsl +910 -559
- data/lib/isodoc/bipm/bipm.guide.xsl +910 -559
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +910 -559
- data/lib/isodoc/bipm/bipm.rapport.xsl +910 -559
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +4 -2
- 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/index.rb +9 -4
- data/lib/isodoc/bipm/jcgm.standard.xsl +956 -580
- data/lib/isodoc/bipm/metadata.rb +15 -5
- data/lib/isodoc/bipm/pdf_convert.rb +12 -9
- data/lib/isodoc/bipm/presentation_xml_convert.rb +63 -19
- data/lib/isodoc/bipm/xref.rb +111 -55
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +6 -6
- data/metanorma.yml +1 -0
- metadata +25 -23
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,11 +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}"))
|
64
|
+
set(:org_abbrev,
|
65
|
+
isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
|
66
|
+
"[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
|
62
67
|
end
|
63
68
|
|
64
69
|
def extract_person_names_affiliations(authors)
|
65
70
|
extract_person_affiliations(authors)
|
66
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
|
67
77
|
end
|
68
78
|
end
|
69
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
|
-
return if f["unnumbered"]
|
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
|
|
@@ -33,28 +43,43 @@ module IsoDoc
|
|
33
43
|
doccontrol docxml
|
34
44
|
end
|
35
45
|
|
36
|
-
def doccontrol
|
46
|
+
def doccontrol(docxml)
|
37
47
|
return unless docxml.at(ns("//bibdata/relation[@type = 'supersedes']"))
|
48
|
+
|
38
49
|
clause = <<~END
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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>
|
56
|
+
END
|
57
|
+
docxml.root << clause
|
58
|
+
end
|
59
|
+
|
60
|
+
def doccontrol_row1(docxml)
|
61
|
+
return "" if list_draft(docxml, 1) == ["", ""] && list_cochairs(docxml).empty?
|
62
|
+
|
63
|
+
<<~ROW
|
43
64
|
<tr>#{list_draft(docxml, 1)&.map { |x| "<td>#{x}</td>" }&.join }
|
44
65
|
<td>#{list_cochairs(docxml)}</td></tr>
|
66
|
+
ROW
|
67
|
+
end
|
68
|
+
|
69
|
+
def doccontrol_row2(docxml)
|
70
|
+
return "" if list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty?
|
71
|
+
|
72
|
+
<<~ROW
|
45
73
|
<tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join }
|
46
74
|
<td>#{list_chairs(docxml)}</td></tr>
|
47
|
-
|
48
|
-
</tbody></table></doccontrol>
|
49
|
-
END
|
50
|
-
docxml.root << clause
|
75
|
+
ROW
|
51
76
|
end
|
52
77
|
|
53
78
|
def list_drafts(xml)
|
54
79
|
ret = ""
|
55
80
|
i = 3
|
56
|
-
while
|
57
|
-
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} "\
|
58
83
|
"<td/></tr>"
|
59
84
|
i += 1
|
60
85
|
end
|
@@ -62,14 +87,15 @@ module IsoDoc
|
|
62
87
|
end
|
63
88
|
|
64
89
|
def list_draft(xml, i)
|
65
|
-
return unless d =
|
90
|
+
return ["", ""] unless d =
|
66
91
|
xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{i}]/bibitem"))
|
92
|
+
|
67
93
|
date = d&.at(ns("./date"))&.text
|
68
94
|
draft = d&.at(ns("./version/draft"))&.text and
|
69
95
|
draft = "Draft #{draft}"
|
70
96
|
edn = d&.at(ns("./edition"))&.text and
|
71
|
-
edn = "
|
72
|
-
[
|
97
|
+
edn = "Version #{edn}"
|
98
|
+
[[draft, edn].join(" "), date]
|
73
99
|
end
|
74
100
|
|
75
101
|
def list_authors(xml)
|
@@ -84,16 +110,18 @@ module IsoDoc
|
|
84
110
|
|
85
111
|
def list_cochairs(xml)
|
86
112
|
ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
|
113
|
+
ret.empty? and return ""
|
87
114
|
role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
|
88
115
|
label = ret.size > 1 && role ? "#{role}s" : role
|
89
|
-
"#{label}: #{@i18n.multiple_and(ret, @i18n.get[
|
116
|
+
"#{label}: #{@i18n.multiple_and(ret, @i18n.get['and'])}"
|
90
117
|
end
|
91
118
|
|
92
119
|
def list_chairs(xml)
|
93
120
|
ret = list_people(xml, "//bibdata/contributor#{CHAIR}/person")
|
121
|
+
ret.empty? and return ""
|
94
122
|
role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
|
95
123
|
label = ret.size > 1 && role ? "#{role}s" : role
|
96
|
-
"#{label}: #{@i18n.multiple_and(ret, @i18n.get[
|
124
|
+
"#{label}: #{@i18n.multiple_and(ret, @i18n.get['and'])}"
|
97
125
|
end
|
98
126
|
|
99
127
|
def list_people(xml, xpath)
|
@@ -110,13 +138,29 @@ module IsoDoc
|
|
110
138
|
end
|
111
139
|
|
112
140
|
def twitter_cldr_localiser_symbols
|
113
|
-
{ group: " ", fraction_group: " ",
|
141
|
+
{ group: " ", fraction_group: " ",
|
142
|
+
fraction_group_digits: 3 }
|
114
143
|
end
|
115
144
|
|
116
145
|
def mathml1(f, locale)
|
117
146
|
localize_maths(f, locale)
|
118
147
|
end
|
119
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
|
+
|
120
164
|
include Init
|
121
165
|
end
|
122
166
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -8,20 +8,43 @@ 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)
|
24
|
+
if @jcgm
|
25
|
+
clause_names_jcgm(docxml, sect_num)
|
26
|
+
else
|
27
|
+
clause_names_bipm(docxml, sect_num)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def clause_names_jcgm(docxml, sect_num)
|
32
|
+
docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')]"\
|
33
|
+
"[not(descendant::terms)]")).each do |c|
|
34
|
+
section_names(c, sect_num, 1)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def clause_names_bipm(docxml, _sect_num)
|
12
39
|
n = Counter.new
|
13
40
|
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')] | "\
|
14
41
|
"//sections/terms[not(@unnumbered = 'true')] | "\
|
15
|
-
"//sections/definitions[not(@unnumbered = 'true')]"))
|
16
|
-
|
17
|
-
section_names(c, n, 1)
|
18
|
-
end
|
42
|
+
"//sections/definitions[not(@unnumbered = 'true')]"))
|
43
|
+
.each { |c| section_names(c, n, 1) }
|
19
44
|
docxml.xpath(ns("//sections/clause[@unnumbered = 'true'] | "\
|
20
45
|
"//sections/terms[@unnumbered = 'true'] | "\
|
21
|
-
"//sections/definitions[@unnumbered = 'true']"))
|
22
|
-
|
23
|
-
unnumbered_section_names(c, 1)
|
24
|
-
end
|
46
|
+
"//sections/definitions[@unnumbered = 'true']"))
|
47
|
+
.each { |c| unnumbered_section_names(c, 1) }
|
25
48
|
end
|
26
49
|
|
27
50
|
NUMBERED_SUBCLAUSES = "./clause[not(@unnumbered = 'true')] | "\
|
@@ -36,18 +59,24 @@ module IsoDoc
|
|
36
59
|
"./terms[@unnumbered = 'true'] | "\
|
37
60
|
"./definitions[@unnumbered = 'true']".freeze
|
38
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
|
+
|
39
69
|
def section_names(clause, num, lvl)
|
40
70
|
return num if clause.nil?
|
71
|
+
|
41
72
|
num.increment(clause)
|
42
|
-
@anchors[clause["id"]] =
|
43
|
-
{ label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"),
|
44
|
-
level: lvl, type: "clause" }
|
73
|
+
@anchors[clause["id"]] = section_name_anchors(clause, num, lvl)
|
45
74
|
i = Counter.new
|
46
75
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
47
76
|
i.increment(c)
|
48
77
|
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
49
78
|
end
|
50
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).
|
79
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
51
80
|
unnumbered_section_names1(c, lvl + 1)
|
52
81
|
end
|
53
82
|
num
|
@@ -55,30 +84,37 @@ module IsoDoc
|
|
55
84
|
|
56
85
|
def unnumbered_section_names(clause, lvl)
|
57
86
|
return if clause.nil?
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
87
|
+
|
88
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
89
|
+
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
|
90
|
+
level: lvl, type: "clause" }
|
91
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
62
92
|
unnumbered_section_names1(c, lvl + 1)
|
63
93
|
end
|
64
94
|
end
|
65
95
|
|
66
|
-
def
|
96
|
+
def section_name1_anchors(clause, num, level)
|
97
|
+
lbl = @jcgm ? "" : "#{@labels['subclause']} "
|
67
98
|
@anchors[clause["id"]] =
|
68
|
-
{ label: num, level: level,
|
99
|
+
{ label: num, level: level,
|
100
|
+
xref: l10n("#{lbl}#{num}"),
|
69
101
|
type: "clause" }
|
102
|
+
end
|
103
|
+
|
104
|
+
def section_names1(clause, num, level)
|
105
|
+
@anchors[clause["id"]] = section_name1_anchors(clause, num, level)
|
70
106
|
i = Counter.new
|
71
107
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
72
108
|
i.increment(c)
|
73
109
|
section_names1(c, "#{num}.#{i.print}", level + 1)
|
74
110
|
end
|
75
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).
|
111
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
76
112
|
unnumbered_section_names1(c, lvl + 1)
|
77
113
|
end
|
78
114
|
end
|
79
115
|
|
80
116
|
def unnumbered_section_names1(clause, level)
|
81
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
117
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
82
118
|
@anchors[clause["id"]] =
|
83
119
|
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level, type: "clause" }
|
84
120
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
@@ -88,75 +124,95 @@ module IsoDoc
|
|
88
124
|
|
89
125
|
def back_anchor_names(docxml)
|
90
126
|
super
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
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) }
|
134
|
+
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
135
|
+
end
|
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 }
|
97
140
|
end
|
98
141
|
|
99
142
|
def annex_names(clause, num)
|
100
|
-
@anchors[clause["id"]] =
|
101
|
-
{ label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
|
102
|
-
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
143
|
+
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
103
144
|
if a = single_annex_special_section(clause)
|
104
|
-
annex_names1(a,
|
145
|
+
annex_names1(a, num.to_s, 1)
|
105
146
|
else
|
106
147
|
i = Counter.new
|
107
148
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
108
149
|
i.increment(c)
|
109
150
|
annex_names1(c, "#{num}.#{i.print}", 2)
|
110
151
|
end
|
111
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
112
|
-
unnumbered_annex_names1(c, 2)
|
113
|
-
end
|
152
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
153
|
+
.each { |c| unnumbered_annex_names1(c, 2) }
|
114
154
|
end
|
115
155
|
hierarchical_asset_names(clause, num)
|
116
156
|
end
|
117
157
|
|
158
|
+
def unnumbered_annex_anchors(lbl)
|
159
|
+
{ label: lbl, type: "clause", value: "",
|
160
|
+
xref: l10n(%{"#{lbl}"}), level: 1 }
|
161
|
+
end
|
162
|
+
|
118
163
|
def unnumbered_annex_names(clause)
|
119
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
120
|
-
@anchors[clause["id"]] =
|
121
|
-
{ label: lbl, type: "clause", value: "",
|
122
|
-
xref: l10n(%{"#{lbl}"}), level: 1 }
|
164
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
165
|
+
@anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
|
123
166
|
if a = single_annex_special_section(clause)
|
124
|
-
annex_names1(a,
|
167
|
+
annex_names1(a, num.to_s, 1)
|
125
168
|
else
|
126
|
-
clause.xpath(ns(SUBCLAUSES))
|
127
|
-
unnumbered_annex_names1(c, 2)
|
128
|
-
end
|
169
|
+
clause.xpath(ns(SUBCLAUSES))
|
170
|
+
.each { |c| unnumbered_annex_names1(c, 2) }
|
129
171
|
end
|
130
172
|
hierarchical_asset_names(clause, lbl)
|
131
173
|
end
|
132
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
|
+
|
133
181
|
def annex_names1(clause, num, level)
|
134
|
-
@anchors[clause["id"]] =
|
135
|
-
{ label: num, xref: l10n("#{@annexlbl} #{num}"),
|
136
|
-
level: level, type: "clause" }
|
182
|
+
@anchors[clause["id"]] = annex_names1_anchors(num, level)
|
137
183
|
i = Counter.new
|
138
184
|
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
139
185
|
i.increment(c)
|
140
186
|
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
141
187
|
end
|
142
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
143
|
-
unnumbered_annex_names1(c, level + 1)
|
144
|
-
end
|
188
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
|
189
|
+
.each { |c| unnumbered_annex_names1(c, level + 1) }
|
145
190
|
end
|
146
191
|
|
147
192
|
def unnumbered_annex_names1(clause, level)
|
148
|
-
lbl = clause&.at(ns("./title"))&.text || "[#{clause[
|
149
|
-
@anchors[clause["id"]] =
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
unnumbered_annex_names1(c, level + 1)
|
154
|
-
end
|
193
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
194
|
+
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
|
195
|
+
level: level, type: "clause" }
|
196
|
+
clause.xpath(ns(SUBCLAUSES))
|
197
|
+
.each { |c| unnumbered_annex_names1(c, level + 1) }
|
155
198
|
end
|
156
199
|
|
157
|
-
def annex_name_lbl(
|
200
|
+
def annex_name_lbl(_clause, num)
|
158
201
|
l10n("<strong>#{@annexlbl} #{num}</strong>")
|
159
202
|
end
|
203
|
+
|
204
|
+
def sequential_formula_names(clause)
|
205
|
+
c = Counter.new
|
206
|
+
clause.xpath(ns(".//formula")).each do |t|
|
207
|
+
next if t["id"].nil? || t["id"].empty?
|
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
|
+
)
|
214
|
+
end
|
215
|
+
end
|
160
216
|
end
|
161
217
|
end
|
162
218
|
end
|