metanorma-bipm 2.0.8 → 2.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/isodoc/bipm/base_convert.rb +2 -2
- data/lib/isodoc/bipm/bipm.brochure.xsl +498 -308
- data/lib/isodoc/bipm/bipm.guide.xsl +498 -308
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +498 -308
- data/lib/isodoc/bipm/bipm.rapport.xsl +498 -308
- data/lib/isodoc/bipm/doccontrol.rb +101 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +1 -0
- data/lib/isodoc/bipm/init.rb +1 -1
- data/lib/isodoc/bipm/jcgm.standard.xsl +480 -223
- data/lib/isodoc/bipm/presentation_xml_convert.rb +1 -93
- data/lib/isodoc/bipm/xref.rb +8 -4
- data/lib/metanorma/bipm/biblio.rng +37 -8
- data/lib/metanorma/bipm/isodoc.rng +56 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +7 -6
@@ -3,6 +3,7 @@ require "metanorma-generic"
|
|
3
3
|
require "metanorma-iso"
|
4
4
|
require_relative "init"
|
5
5
|
require_relative "index"
|
6
|
+
require_relative "doccontrol"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module BIPM
|
@@ -85,99 +86,6 @@ module IsoDoc
|
|
85
86
|
doccontrol docxml
|
86
87
|
end
|
87
88
|
|
88
|
-
def doccontrol(doc)
|
89
|
-
return unless doc.at(ns("//bibdata/relation[@type = 'supersedes']"))
|
90
|
-
|
91
|
-
clause = <<~DOCCONTROL
|
92
|
-
<doccontrol>
|
93
|
-
<title>Document Control</title>
|
94
|
-
<table unnumbered="true"><tbody>
|
95
|
-
<tr><th>Authors:</th><td/><td>#{list_authors(doc)}</td></tr>
|
96
|
-
#{doccontrol_row1(doc)} #{doccontrol_row2(doc)} #{list_drafts(doc)}
|
97
|
-
</tbody></table></doccontrol>
|
98
|
-
DOCCONTROL
|
99
|
-
doc.root << clause
|
100
|
-
end
|
101
|
-
|
102
|
-
def doccontrol_row1(doc)
|
103
|
-
return "" if list_draft(doc, 1) == ["", ""] && list_cochairs(doc).empty?
|
104
|
-
|
105
|
-
<<~ROW
|
106
|
-
<tr>#{list_draft(doc, 1)&.map { |x| "<td>#{x}</td>" }&.join}
|
107
|
-
<td>#{list_cochairs(doc)}</td></tr>
|
108
|
-
ROW
|
109
|
-
end
|
110
|
-
|
111
|
-
def doccontrol_row2(docxml)
|
112
|
-
list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty? and
|
113
|
-
return ""
|
114
|
-
|
115
|
-
<<~ROW
|
116
|
-
<tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join}
|
117
|
-
<td>#{list_chairs(docxml)}</td></tr>
|
118
|
-
ROW
|
119
|
-
end
|
120
|
-
|
121
|
-
def list_drafts(xml)
|
122
|
-
ret = ""
|
123
|
-
i = 3
|
124
|
-
while list_draft(xml, i) != ["", ""]
|
125
|
-
ret += "<tr>#{list_draft(xml, i).map { |x| "<td>#{x}</td>" }.join} "\
|
126
|
-
"<td/></tr>"
|
127
|
-
i += 1
|
128
|
-
end
|
129
|
-
ret
|
130
|
-
end
|
131
|
-
|
132
|
-
def list_draft(xml, idx)
|
133
|
-
d = xml.at(ns("//bibdata/relation[@type = 'supersedes'][#{idx}]"\
|
134
|
-
"/bibitem")) or return ["", ""]
|
135
|
-
|
136
|
-
draft = d&.at(ns("./version/draft"))&.text and draft = "Draft #{draft}"
|
137
|
-
edn = d&.at(ns("./edition"))&.text and edn = "Version #{edn}"
|
138
|
-
[[draft, edn].join(" "), d&.at(ns("./date"))&.text]
|
139
|
-
end
|
140
|
-
|
141
|
-
def list_authors(xml)
|
142
|
-
ret = list_people(
|
143
|
-
xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person"
|
144
|
-
)
|
145
|
-
@i18n.boolean_conj(ret, "and")
|
146
|
-
end
|
147
|
-
|
148
|
-
COCHAIR = "xmlns:role[contains(text(),'co-chair')]".freeze
|
149
|
-
CHAIR = "[xmlns:role[contains(text(),'chair')]"\
|
150
|
-
"[not(contains(text(),'co-chair'))]]".freeze
|
151
|
-
|
152
|
-
def list_cochairs(xml)
|
153
|
-
ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
|
154
|
-
ret.empty? and return ""
|
155
|
-
role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
|
156
|
-
label = ret.size > 1 && role ? "#{role}s" : role
|
157
|
-
"#{label}: #{@i18n.boolean_conj(ret, 'and')}"
|
158
|
-
end
|
159
|
-
|
160
|
-
def list_chairs(xml)
|
161
|
-
ret = list_people(xml, "//bibdata/contributor#{CHAIR}/person")
|
162
|
-
ret.empty? and return ""
|
163
|
-
role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
|
164
|
-
label = ret.size > 1 && role ? "#{role}s" : role
|
165
|
-
"#{label}: #{@i18n.boolean_conj(ret, 'and')}"
|
166
|
-
end
|
167
|
-
|
168
|
-
def list_people(xml, xpath)
|
169
|
-
ret = []
|
170
|
-
xml.xpath(ns(xpath)).each do |p|
|
171
|
-
name = p&.at(ns("./name/completename"))&.text
|
172
|
-
aff = p&.at(ns("./affiliation/organization/abbreviation"))&.text ||
|
173
|
-
p&.at(ns("./affiliation/organization/name"))&.text
|
174
|
-
c = name || ""
|
175
|
-
aff and c += " (#{aff})"
|
176
|
-
ret << c
|
177
|
-
end
|
178
|
-
ret
|
179
|
-
end
|
180
|
-
|
181
89
|
def twitter_cldr_localiser_symbols
|
182
90
|
{ group: " ", fraction_group: " ", fraction_group_digits: 3 }
|
183
91
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -153,8 +153,9 @@ module IsoDoc
|
|
153
153
|
|
154
154
|
def annex_names(clause, num)
|
155
155
|
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
156
|
-
if
|
157
|
-
annex_names1(
|
156
|
+
if @klass.single_term_clause?(clause)
|
157
|
+
annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
|
158
|
+
num.to_s, 1)
|
158
159
|
else
|
159
160
|
i = Counter.new
|
160
161
|
prefix = @jcgm ? "" : "A"
|
@@ -176,8 +177,9 @@ module IsoDoc
|
|
176
177
|
def unnumbered_annex_names(clause)
|
177
178
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
178
179
|
@anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
|
179
|
-
if
|
180
|
-
annex_names1(
|
180
|
+
if @klass.single_term_clause?(clause)
|
181
|
+
annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
|
182
|
+
num.to_s, 1)
|
181
183
|
else
|
182
184
|
clause.xpath(ns(SUBCLAUSES))
|
183
185
|
.each { |c| unnumbered_annex_names1(c, 2) }
|
@@ -229,10 +231,12 @@ module IsoDoc
|
|
229
231
|
|
230
232
|
def initial_anchor_names(doc)
|
231
233
|
super
|
234
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
232
235
|
if @jcgm
|
233
236
|
@iso.introduction_names(doc.at(ns("//introduction")))
|
234
237
|
@anchors.merge!(@iso.get)
|
235
238
|
end
|
239
|
+
end
|
236
240
|
end
|
237
241
|
|
238
242
|
def sequential_figure_names(clause)
|
@@ -851,17 +851,46 @@
|
|
851
851
|
</define>
|
852
852
|
<define name="bplace">
|
853
853
|
<element name="place">
|
854
|
-
<
|
855
|
-
<
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<group>
|
857
|
+
<ref name="bibliocity"/>
|
858
|
+
<zeroOrMore>
|
859
|
+
<ref name="biblioregion"/>
|
860
|
+
</zeroOrMore>
|
861
|
+
<zeroOrMore>
|
862
|
+
<ref name="bibliocountry"/>
|
863
|
+
</zeroOrMore>
|
864
|
+
</group>
|
865
|
+
</choice>
|
866
|
+
</element>
|
867
|
+
</define>
|
868
|
+
<define name="bibliocity">
|
869
|
+
<element name="city">
|
862
870
|
<text/>
|
863
871
|
</element>
|
864
872
|
</define>
|
873
|
+
<define name="biblioregion">
|
874
|
+
<element name="region">
|
875
|
+
<ref name="RegionType"/>
|
876
|
+
</element>
|
877
|
+
</define>
|
878
|
+
<define name="bibliocountry">
|
879
|
+
<element name="country">
|
880
|
+
<ref name="RegionType"/>
|
881
|
+
</element>
|
882
|
+
</define>
|
883
|
+
<define name="RegionType">
|
884
|
+
<optional>
|
885
|
+
<attribute name="iso"/>
|
886
|
+
</optional>
|
887
|
+
<optional>
|
888
|
+
<attribute name="recommended">
|
889
|
+
<data type="boolean"/>
|
890
|
+
</attribute>
|
891
|
+
</optional>
|
892
|
+
<text/>
|
893
|
+
</define>
|
865
894
|
<define name="bprice">
|
866
895
|
<element name="price">
|
867
896
|
<attribute name="currency"/>
|
@@ -32,6 +32,43 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="admonition">
|
36
|
+
<element name="admonition">
|
37
|
+
<attribute name="type">
|
38
|
+
<ref name="AdmonitionType"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="class"/>
|
42
|
+
</optional>
|
43
|
+
<attribute name="id">
|
44
|
+
<data type="ID"/>
|
45
|
+
</attribute>
|
46
|
+
<optional>
|
47
|
+
<attribute name="uri">
|
48
|
+
<data type="anyURI"/>
|
49
|
+
</attribute>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<attribute name="coverpage">
|
53
|
+
<data type="boolean"/>
|
54
|
+
</attribute>
|
55
|
+
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="notag">
|
58
|
+
<data type="boolean"/>
|
59
|
+
</attribute>
|
60
|
+
</optional>
|
61
|
+
<optional>
|
62
|
+
<ref name="tname"/>
|
63
|
+
</optional>
|
64
|
+
<zeroOrMore>
|
65
|
+
<ref name="paragraph-with-footnote"/>
|
66
|
+
</zeroOrMore>
|
67
|
+
<zeroOrMore>
|
68
|
+
<ref name="note"/>
|
69
|
+
</zeroOrMore>
|
70
|
+
</element>
|
71
|
+
</define>
|
35
72
|
<define name="index">
|
36
73
|
<element name="index">
|
37
74
|
<optional>
|
@@ -851,6 +888,16 @@
|
|
851
888
|
<ref name="MultilingualRenderingType"/>
|
852
889
|
</attribute>
|
853
890
|
</optional>
|
891
|
+
<optional>
|
892
|
+
<attribute name="coverpage">
|
893
|
+
<data type="boolean"/>
|
894
|
+
</attribute>
|
895
|
+
</optional>
|
896
|
+
<optional>
|
897
|
+
<attribute name="notag">
|
898
|
+
<data type="boolean"/>
|
899
|
+
</attribute>
|
900
|
+
</optional>
|
854
901
|
<oneOrMore>
|
855
902
|
<choice>
|
856
903
|
<ref name="paragraph"/>
|
@@ -1178,6 +1225,7 @@
|
|
1178
1225
|
<ref name="concept"/>
|
1179
1226
|
<ref name="add"/>
|
1180
1227
|
<ref name="del"/>
|
1228
|
+
<ref name="span"/>
|
1181
1229
|
</choice>
|
1182
1230
|
</define>
|
1183
1231
|
<define name="add">
|
@@ -1204,6 +1252,14 @@
|
|
1204
1252
|
</choice>
|
1205
1253
|
</element>
|
1206
1254
|
</define>
|
1255
|
+
<define name="span">
|
1256
|
+
<element name="span">
|
1257
|
+
<attribute name="class"/>
|
1258
|
+
<oneOrMore>
|
1259
|
+
<ref name="TextElement"/>
|
1260
|
+
</oneOrMore>
|
1261
|
+
</element>
|
1262
|
+
</define>
|
1207
1263
|
<define name="concept">
|
1208
1264
|
<element name="concept">
|
1209
1265
|
<optional>
|
data/metanorma-bipm.gemspec
CHANGED
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ["lib"]
|
27
27
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
28
28
|
|
29
|
-
spec.add_dependency "metanorma-generic", "~> 2.
|
30
|
-
spec.add_dependency "metanorma-iso", "~> 2.
|
29
|
+
spec.add_dependency "metanorma-generic", "~> 2.1.0"
|
30
|
+
spec.add_dependency "metanorma-iso", "~> 2.1.0"
|
31
31
|
|
32
32
|
spec.add_development_dependency "debug"
|
33
33
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-bipm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-generic
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: metanorma-iso
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: debug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,6 +234,7 @@ files:
|
|
234
234
|
- lib/isodoc/bipm/bipm.guide.xsl
|
235
235
|
- lib/isodoc/bipm/bipm.mise-en-pratique.xsl
|
236
236
|
- lib/isodoc/bipm/bipm.rapport.xsl
|
237
|
+
- lib/isodoc/bipm/doccontrol.rb
|
237
238
|
- lib/isodoc/bipm/html/html_bipm_intro.html
|
238
239
|
- lib/isodoc/bipm/html/html_bipm_titlepage.html
|
239
240
|
- lib/isodoc/bipm/html/htmlstyle.css
|