relaton-bipm 1.6.1 → 1.7.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/grammars/bipm.rng +188 -23
- data/grammars/isodoc.rng +14 -43
- data/lib/relaton_bipm.rb +2 -0
- data/lib/relaton_bipm/acronyms.yaml +57 -0
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +12 -7
- data/lib/relaton_bipm/committee.rb +60 -0
- data/lib/relaton_bipm/editorial_group.rb +8 -17
- data/lib/relaton_bipm/hash_converter.rb +28 -2
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/workgroup.rb +46 -0
- data/lib/relaton_bipm/xml_parser.rb +25 -4
- data/relaton_bipm.gemspec +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6155907dfcf708b034a914e45245ab8fd8262de9c83d29fb6436fcd8130c5ad3
|
|
4
|
+
data.tar.gz: 251bf3228d0717ca3fcc4a181b50d2ae62f5e1df7fe6a7b3284404463ab389e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cbc54d6dfc3c066aada2bcd84cdde54a9218b02de719149fd8d556e281d3e232fe74a1094bb349b91a6bef748afe0c0398aeebbe3c96e27b8c55526efc1ed349
|
|
7
|
+
data.tar.gz: dfd7cf7dc70e74c3f4ec56b3f32e6c9816e3c49a2c94d26c4fbf0048f06bb21df15fea401e4c33a0e5927cdb2486888ecb312d670b04105dabb194620b3d62eb
|
data/grammars/bipm.rng
CHANGED
|
@@ -42,9 +42,158 @@
|
|
|
42
42
|
<data type="boolean"/>
|
|
43
43
|
</attribute>
|
|
44
44
|
</optional>
|
|
45
|
+
<optional>
|
|
46
|
+
<attribute name="nosee">
|
|
47
|
+
<data type="boolean"/>
|
|
48
|
+
</attribute>
|
|
49
|
+
</optional>
|
|
45
50
|
<text/>
|
|
46
51
|
</element>
|
|
47
52
|
</define>
|
|
53
|
+
<define name="Clause-Section">
|
|
54
|
+
<optional>
|
|
55
|
+
<attribute name="id">
|
|
56
|
+
<data type="ID"/>
|
|
57
|
+
</attribute>
|
|
58
|
+
</optional>
|
|
59
|
+
<optional>
|
|
60
|
+
<attribute name="language"/>
|
|
61
|
+
</optional>
|
|
62
|
+
<optional>
|
|
63
|
+
<attribute name="script"/>
|
|
64
|
+
</optional>
|
|
65
|
+
<optional>
|
|
66
|
+
<attribute name="inline-header">
|
|
67
|
+
<data type="boolean"/>
|
|
68
|
+
</attribute>
|
|
69
|
+
</optional>
|
|
70
|
+
<optional>
|
|
71
|
+
<attribute name="obligation">
|
|
72
|
+
<choice>
|
|
73
|
+
<value>normative</value>
|
|
74
|
+
<value>informative</value>
|
|
75
|
+
</choice>
|
|
76
|
+
</attribute>
|
|
77
|
+
</optional>
|
|
78
|
+
<optional>
|
|
79
|
+
<attribute name="type"/>
|
|
80
|
+
</optional>
|
|
81
|
+
<optional>
|
|
82
|
+
<attribute name="unnumbered">
|
|
83
|
+
<data type="boolean"/>
|
|
84
|
+
</attribute>
|
|
85
|
+
</optional>
|
|
86
|
+
<optional>
|
|
87
|
+
<ref name="section-title"/>
|
|
88
|
+
</optional>
|
|
89
|
+
<group>
|
|
90
|
+
<choice>
|
|
91
|
+
<group>
|
|
92
|
+
<zeroOrMore>
|
|
93
|
+
<ref name="BasicBlock"/>
|
|
94
|
+
</zeroOrMore>
|
|
95
|
+
<zeroOrMore>
|
|
96
|
+
<ref name="note"/>
|
|
97
|
+
</zeroOrMore>
|
|
98
|
+
</group>
|
|
99
|
+
<ref name="amend"/>
|
|
100
|
+
</choice>
|
|
101
|
+
<zeroOrMore>
|
|
102
|
+
<choice>
|
|
103
|
+
<ref name="clause-subsection"/>
|
|
104
|
+
<ref name="terms"/>
|
|
105
|
+
<ref name="definitions"/>
|
|
106
|
+
</choice>
|
|
107
|
+
</zeroOrMore>
|
|
108
|
+
</group>
|
|
109
|
+
</define>
|
|
110
|
+
<define name="Annex-Section">
|
|
111
|
+
<optional>
|
|
112
|
+
<attribute name="id">
|
|
113
|
+
<data type="ID"/>
|
|
114
|
+
</attribute>
|
|
115
|
+
</optional>
|
|
116
|
+
<optional>
|
|
117
|
+
<attribute name="language"/>
|
|
118
|
+
</optional>
|
|
119
|
+
<optional>
|
|
120
|
+
<attribute name="script"/>
|
|
121
|
+
</optional>
|
|
122
|
+
<optional>
|
|
123
|
+
<attribute name="inline-header">
|
|
124
|
+
<data type="boolean"/>
|
|
125
|
+
</attribute>
|
|
126
|
+
</optional>
|
|
127
|
+
<optional>
|
|
128
|
+
<attribute name="obligation">
|
|
129
|
+
<choice>
|
|
130
|
+
<value>normative</value>
|
|
131
|
+
<value>informative</value>
|
|
132
|
+
</choice>
|
|
133
|
+
</attribute>
|
|
134
|
+
</optional>
|
|
135
|
+
<optional>
|
|
136
|
+
<attribute name="unnumbered">
|
|
137
|
+
<data type="boolean"/>
|
|
138
|
+
</attribute>
|
|
139
|
+
</optional>
|
|
140
|
+
<optional>
|
|
141
|
+
<ref name="section-title"/>
|
|
142
|
+
</optional>
|
|
143
|
+
<group>
|
|
144
|
+
<group>
|
|
145
|
+
<zeroOrMore>
|
|
146
|
+
<ref name="BasicBlock"/>
|
|
147
|
+
</zeroOrMore>
|
|
148
|
+
<zeroOrMore>
|
|
149
|
+
<ref name="note"/>
|
|
150
|
+
</zeroOrMore>
|
|
151
|
+
</group>
|
|
152
|
+
<zeroOrMore>
|
|
153
|
+
<choice>
|
|
154
|
+
<ref name="annex-subsection"/>
|
|
155
|
+
<ref name="terms"/>
|
|
156
|
+
<ref name="definitions"/>
|
|
157
|
+
<ref name="references"/>
|
|
158
|
+
</choice>
|
|
159
|
+
</zeroOrMore>
|
|
160
|
+
</group>
|
|
161
|
+
</define>
|
|
162
|
+
<define name="ol">
|
|
163
|
+
<element name="ol">
|
|
164
|
+
<attribute name="id">
|
|
165
|
+
<data type="ID"/>
|
|
166
|
+
</attribute>
|
|
167
|
+
<optional>
|
|
168
|
+
<attribute name="keep-with-next">
|
|
169
|
+
<data type="boolean"/>
|
|
170
|
+
</attribute>
|
|
171
|
+
</optional>
|
|
172
|
+
<optional>
|
|
173
|
+
<attribute name="keep-lines-together">
|
|
174
|
+
<data type="boolean"/>
|
|
175
|
+
</attribute>
|
|
176
|
+
</optional>
|
|
177
|
+
<attribute name="type">
|
|
178
|
+
<choice>
|
|
179
|
+
<value>roman</value>
|
|
180
|
+
<value>alphabet</value>
|
|
181
|
+
<value>arabic</value>
|
|
182
|
+
<value>roman_upper</value>
|
|
183
|
+
<value>alphabet_upper</value>
|
|
184
|
+
</choice>
|
|
185
|
+
</attribute>
|
|
186
|
+
<optional>
|
|
187
|
+
<attribute name="start"/>
|
|
188
|
+
</optional>
|
|
189
|
+
<oneOrMore>
|
|
190
|
+
<ref name="li"/>
|
|
191
|
+
</oneOrMore>
|
|
192
|
+
<zeroOrMore>
|
|
193
|
+
<ref name="note"/>
|
|
194
|
+
</zeroOrMore>
|
|
195
|
+
</element>
|
|
196
|
+
</define>
|
|
48
197
|
<define name="DocumentType">
|
|
49
198
|
<choice>
|
|
50
199
|
<value>brochure</value>
|
|
@@ -65,9 +214,9 @@
|
|
|
65
214
|
<oneOrMore>
|
|
66
215
|
<ref name="committee"/>
|
|
67
216
|
</oneOrMore>
|
|
68
|
-
<
|
|
217
|
+
<zeroOrMore>
|
|
69
218
|
<ref name="workgroup"/>
|
|
70
|
-
</
|
|
219
|
+
</zeroOrMore>
|
|
71
220
|
</element>
|
|
72
221
|
</define>
|
|
73
222
|
<define name="structuredidentifier">
|
|
@@ -98,6 +247,9 @@
|
|
|
98
247
|
<optional>
|
|
99
248
|
<ref name="si-aspect"/>
|
|
100
249
|
</optional>
|
|
250
|
+
<optional>
|
|
251
|
+
<ref name="meeting-note"/>
|
|
252
|
+
</optional>
|
|
101
253
|
<ref name="structuredidentifier"/>
|
|
102
254
|
</define>
|
|
103
255
|
</include>
|
|
@@ -132,30 +284,41 @@
|
|
|
132
284
|
</define>
|
|
133
285
|
<define name="committee">
|
|
134
286
|
<element name="committee">
|
|
135
|
-
<
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
287
|
+
<attribute name="acronym">
|
|
288
|
+
<choice>
|
|
289
|
+
<value>CGPM</value>
|
|
290
|
+
<value>CIPM</value>
|
|
291
|
+
<value>BIPM</value>
|
|
292
|
+
<value>CCAUV</value>
|
|
293
|
+
<value>CCEM</value>
|
|
294
|
+
<value>CCL</value>
|
|
295
|
+
<value>CCM</value>
|
|
296
|
+
<value>CCPR</value>
|
|
297
|
+
<value>CCQM</value>
|
|
298
|
+
<value>CCRI</value>
|
|
299
|
+
<value>CCT</value>
|
|
300
|
+
<value>CCTF</value>
|
|
301
|
+
<value>CCU</value>
|
|
302
|
+
<value>CCL-CCTF</value>
|
|
303
|
+
<value>JCGM</value>
|
|
304
|
+
<value>JCRB</value>
|
|
305
|
+
<value>JCTLM</value>
|
|
306
|
+
<value>INetQI</value>
|
|
307
|
+
</choice>
|
|
308
|
+
</attribute>
|
|
309
|
+
<ref name="LocalizedString"/>
|
|
155
310
|
</element>
|
|
156
311
|
</define>
|
|
157
312
|
<define name="workgroup">
|
|
158
313
|
<element name="workgroup">
|
|
314
|
+
<optional>
|
|
315
|
+
<attribute name="acronym"/>
|
|
316
|
+
</optional>
|
|
317
|
+
<text/>
|
|
318
|
+
</element>
|
|
319
|
+
</define>
|
|
320
|
+
<define name="meeting-note">
|
|
321
|
+
<element name="meeting-note">
|
|
159
322
|
<text/>
|
|
160
323
|
</element>
|
|
161
324
|
</define>
|
|
@@ -182,7 +345,9 @@
|
|
|
182
345
|
<zeroOrMore>
|
|
183
346
|
<ref name="annex"/>
|
|
184
347
|
</zeroOrMore>
|
|
185
|
-
<
|
|
348
|
+
<optional>
|
|
349
|
+
<ref name="bibliography"/>
|
|
350
|
+
</optional>
|
|
186
351
|
</element>
|
|
187
352
|
</define>
|
|
188
353
|
</grammar>
|
data/grammars/isodoc.rng
CHANGED
|
@@ -24,6 +24,14 @@
|
|
|
24
24
|
<start>
|
|
25
25
|
<ref name="standard-document"/>
|
|
26
26
|
</start>
|
|
27
|
+
<define name="doctype">
|
|
28
|
+
<element name="doctype">
|
|
29
|
+
<optional>
|
|
30
|
+
<attribute name="abbreviation"/>
|
|
31
|
+
</optional>
|
|
32
|
+
<ref name="DocumentType"/>
|
|
33
|
+
</element>
|
|
34
|
+
</define>
|
|
27
35
|
<define name="hyperlink">
|
|
28
36
|
<element name="link">
|
|
29
37
|
<attribute name="target">
|
|
@@ -141,6 +149,11 @@
|
|
|
141
149
|
<data type="boolean"/>
|
|
142
150
|
</attribute>
|
|
143
151
|
</optional>
|
|
152
|
+
<optional>
|
|
153
|
+
<attribute name="key">
|
|
154
|
+
<data type="boolean"/>
|
|
155
|
+
</attribute>
|
|
156
|
+
</optional>
|
|
144
157
|
<oneOrMore>
|
|
145
158
|
<ref name="dt"/>
|
|
146
159
|
<ref name="dd"/>
|
|
@@ -1164,49 +1177,7 @@
|
|
|
1164
1177
|
</define>
|
|
1165
1178
|
<define name="annex">
|
|
1166
1179
|
<element name="annex">
|
|
1167
|
-
<
|
|
1168
|
-
<attribute name="id">
|
|
1169
|
-
<data type="ID"/>
|
|
1170
|
-
</attribute>
|
|
1171
|
-
</optional>
|
|
1172
|
-
<optional>
|
|
1173
|
-
<attribute name="language"/>
|
|
1174
|
-
</optional>
|
|
1175
|
-
<optional>
|
|
1176
|
-
<attribute name="script"/>
|
|
1177
|
-
</optional>
|
|
1178
|
-
<optional>
|
|
1179
|
-
<attribute name="inline-header">
|
|
1180
|
-
<data type="boolean"/>
|
|
1181
|
-
</attribute>
|
|
1182
|
-
</optional>
|
|
1183
|
-
<attribute name="obligation">
|
|
1184
|
-
<choice>
|
|
1185
|
-
<value>normative</value>
|
|
1186
|
-
<value>informative</value>
|
|
1187
|
-
</choice>
|
|
1188
|
-
</attribute>
|
|
1189
|
-
<optional>
|
|
1190
|
-
<ref name="section-title"/>
|
|
1191
|
-
</optional>
|
|
1192
|
-
<group>
|
|
1193
|
-
<group>
|
|
1194
|
-
<zeroOrMore>
|
|
1195
|
-
<ref name="BasicBlock"/>
|
|
1196
|
-
</zeroOrMore>
|
|
1197
|
-
<zeroOrMore>
|
|
1198
|
-
<ref name="note"/>
|
|
1199
|
-
</zeroOrMore>
|
|
1200
|
-
</group>
|
|
1201
|
-
<zeroOrMore>
|
|
1202
|
-
<choice>
|
|
1203
|
-
<ref name="annex-subsection"/>
|
|
1204
|
-
<ref name="terms"/>
|
|
1205
|
-
<ref name="definitions"/>
|
|
1206
|
-
<ref name="references"/>
|
|
1207
|
-
</choice>
|
|
1208
|
-
</zeroOrMore>
|
|
1209
|
-
</group>
|
|
1180
|
+
<ref name="Annex-Section"/>
|
|
1210
1181
|
</element>
|
|
1211
1182
|
</define>
|
|
1212
1183
|
<define name="terms">
|
data/lib/relaton_bipm.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
require "relaton_bib"
|
|
2
2
|
require "relaton_bipm/version"
|
|
3
3
|
require "relaton_bipm/editorial_group"
|
|
4
|
+
require "relaton_bipm/committee"
|
|
5
|
+
require "relaton_bipm/workgroup"
|
|
4
6
|
require "relaton_bipm/structured_identifier"
|
|
5
7
|
require "relaton_bipm/bibliographic_date"
|
|
6
8
|
require "relaton_bipm/document_relation"
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
CCAUV:
|
|
2
|
+
fr: Comité consultatif de l’acoustique, des ultrasons et des vibrations
|
|
3
|
+
en: Consultative Committee for Acoustics, Ultrasound and Vibration
|
|
4
|
+
CCDS:
|
|
5
|
+
fr: Comité consultatif pour la définition de la seconde
|
|
6
|
+
en: Consultative Committee for the Definition of the Second
|
|
7
|
+
note: see CCTF
|
|
8
|
+
CCE:
|
|
9
|
+
fr: Comité consultatif d’électricité
|
|
10
|
+
en: Consultative Committee for Electricity
|
|
11
|
+
note: see CCEM
|
|
12
|
+
CCEM:
|
|
13
|
+
fr: Comité consultatif d’électricité et magnétisme
|
|
14
|
+
en: Consultative Committee for Electricity and Magnetism
|
|
15
|
+
note: formerly the CCE
|
|
16
|
+
CCL:
|
|
17
|
+
fr: Comité consultatif des longueurs
|
|
18
|
+
en: Consultative Committee for Length
|
|
19
|
+
CCM:
|
|
20
|
+
fr: Comité consultatif pour la masse et les grandeurs apparentées
|
|
21
|
+
en: Consultative Committee for Mass and Related Quantities
|
|
22
|
+
CCPR:
|
|
23
|
+
fr: Comité consultatif de photométrie et radiométrie
|
|
24
|
+
en: Consultative Committee for Photometry and Radiometry
|
|
25
|
+
CCQM:
|
|
26
|
+
fr: 'Comité consultatif pour la quantité de matière : métrologie en chimie et biologie'
|
|
27
|
+
en: 'Consultative Committee for Amount of Substance: Metrology in Chemistry and Biology'
|
|
28
|
+
CCRI:
|
|
29
|
+
fr: Comité consultatif des rayonnements ionisants
|
|
30
|
+
en: Consultative Committee for Ionizing Radiation
|
|
31
|
+
CCT:
|
|
32
|
+
fr: Comité consultatif de thermométrie
|
|
33
|
+
en: Consultative Committee for Thermometry
|
|
34
|
+
CCTF:
|
|
35
|
+
fr: Comité consultatif du temps et des fréquences
|
|
36
|
+
en: Consultative Committee for Time and Frequency
|
|
37
|
+
note: formerly the CCDS
|
|
38
|
+
CCU:
|
|
39
|
+
fr: Comité consultatif des unités
|
|
40
|
+
en: Consultative Committee for Units
|
|
41
|
+
CGPM:
|
|
42
|
+
fr: Conférence générale des poids et mesures
|
|
43
|
+
en: General Conference on Weights and Measures
|
|
44
|
+
CIPM:
|
|
45
|
+
fr: Comité international des poids et mesures
|
|
46
|
+
en: International Committee for Weights and Measures
|
|
47
|
+
BIPM:
|
|
48
|
+
en: Joint Committees of the BIPM and other international organizations
|
|
49
|
+
CCL-CCTF:
|
|
50
|
+
JCGM:
|
|
51
|
+
en: Joint Committee for Guides in Metrology
|
|
52
|
+
JCRB:
|
|
53
|
+
en: Joint Committee of the Regional Metrology Organizations and the BIPM
|
|
54
|
+
JCTLM:
|
|
55
|
+
en: Joint Committee for Traceability in Laboratory Medicine
|
|
56
|
+
INetQI:
|
|
57
|
+
en: International Network on Quality Infrastructure
|
|
@@ -13,19 +13,20 @@ module RelatonBipm
|
|
|
13
13
|
kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA s_deltanu
|
|
14
14
|
].freeze
|
|
15
15
|
|
|
16
|
-
# @return [RelatonBipm::CommentPeriod,
|
|
16
|
+
# @return [RelatonBipm::CommentPeriod, nil]
|
|
17
17
|
attr_reader :comment_period
|
|
18
18
|
|
|
19
|
-
# @return [String]
|
|
20
|
-
attr_reader :si_aspect
|
|
19
|
+
# @return [String, nil]
|
|
20
|
+
attr_reader :si_aspect, :meeting_note
|
|
21
21
|
|
|
22
22
|
# @param relation [Array<RelatonBipm::DocumentRelation>]
|
|
23
23
|
# @param editorialgroup [RelatonBipm::EditorialGroup]
|
|
24
|
-
# @param comment_period [RelatonBipm::CommentPeriod,
|
|
25
|
-
# @param si_aspect [String]
|
|
24
|
+
# @param comment_period [RelatonBipm::CommentPeriod, nil]
|
|
25
|
+
# @param si_aspect [String, nil]
|
|
26
|
+
# @param meeting_note [String, nil]
|
|
26
27
|
# @param structuredidentifier [RelatonBipm::StructuredIdentifier]
|
|
27
28
|
def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
28
|
-
if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage)
|
|
29
|
+
if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage.value)
|
|
29
30
|
warn "[relaton-bipm] Warning: invalid docstatus: #{args[:docstatus]}. "\
|
|
30
31
|
"It should be one of: #{STATUSES}"
|
|
31
32
|
end
|
|
@@ -37,6 +38,7 @@ module RelatonBipm
|
|
|
37
38
|
|
|
38
39
|
@comment_period = args.delete :comment_period
|
|
39
40
|
@si_aspect = args.delete :si_aspect
|
|
41
|
+
@meeting_note = args[:meeting_note]
|
|
40
42
|
super
|
|
41
43
|
end
|
|
42
44
|
|
|
@@ -55,6 +57,7 @@ module RelatonBipm
|
|
|
55
57
|
editorialgroup&.to_xml b
|
|
56
58
|
comment_period&.to_xml b
|
|
57
59
|
b.send "si-aspect", si_aspect if si_aspect
|
|
60
|
+
b.send "meeting-note", meeting_note if meeting_note
|
|
58
61
|
structuredidentifier&.to_xml b
|
|
59
62
|
end
|
|
60
63
|
end
|
|
@@ -66,6 +69,7 @@ module RelatonBipm
|
|
|
66
69
|
hash = super
|
|
67
70
|
hash["comment_period"] = comment_period.to_hash if comment_period
|
|
68
71
|
hash["si_aspect"] = si_aspect if si_aspect
|
|
72
|
+
hash["meeting-note"] = meeting_note if meeting_note
|
|
69
73
|
hash
|
|
70
74
|
end
|
|
71
75
|
|
|
@@ -75,7 +79,8 @@ module RelatonBipm
|
|
|
75
79
|
pref = prefix.empty? ? prefix : prefix + "."
|
|
76
80
|
out = super
|
|
77
81
|
out += comment_period.to_asciibib prefix if comment_period
|
|
78
|
-
out += "#{pref}
|
|
82
|
+
out += "#{pref}si_aspect:: #{si_aspect}\n" if si_aspect
|
|
83
|
+
out += "#{pref}meeting_note:: #{meeting_note}\h" if meeting_note
|
|
79
84
|
out
|
|
80
85
|
end
|
|
81
86
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module RelatonBipm
|
|
2
|
+
class Committee
|
|
3
|
+
# @return [String]
|
|
4
|
+
attr_reader :acronym
|
|
5
|
+
|
|
6
|
+
# @return [RelatonBib::LocalizedString]
|
|
7
|
+
attr_reader :content
|
|
8
|
+
|
|
9
|
+
# @param acronym [String]
|
|
10
|
+
# @param content [RelatonBib::LocalisedString, String, nil]
|
|
11
|
+
def initialize(acronym:, content: nil)
|
|
12
|
+
acronyms = YAML.load_file File.join(__dir__, "acronyms.yaml")
|
|
13
|
+
unless acronyms[acronym]
|
|
14
|
+
warn "[relaton-bipm] WARNING: invalid acronym: #{acronym}. Allowed "\
|
|
15
|
+
"values: #{acronyms.map { |k, _v| k }.join ', '}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@acronym = acronym
|
|
19
|
+
@content = localized_content content, acronyms[acronym]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @param builder [Nokogiri::XML::Builder]
|
|
23
|
+
def to_xml(builder)
|
|
24
|
+
builder.committee(acronym: acronym) { |b| content.to_xml b }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @param prefix [String]
|
|
28
|
+
# @param count [Integer]
|
|
29
|
+
# @return [String]
|
|
30
|
+
def to_asciibib(prefix, count = 1)
|
|
31
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
|
32
|
+
pref += "committee"
|
|
33
|
+
out = count > 1 ? "#{pref}::\n" : ""
|
|
34
|
+
out += "#{pref}.acronym:: #{acronym}\n"
|
|
35
|
+
out + content.to_asciibib(pref)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @return [Hash]
|
|
39
|
+
def to_hash
|
|
40
|
+
hash = { "acronym" => acronym }
|
|
41
|
+
cnt = content.to_hash
|
|
42
|
+
if cnt.is_a? Array then hash["variants"] = cnt
|
|
43
|
+
elsif cnt.is_a? Hash then hash.merge! cnt
|
|
44
|
+
else hash["content"] = cnt
|
|
45
|
+
end
|
|
46
|
+
hash
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def localized_content(cnt, acr)
|
|
52
|
+
if cnt.is_a? String
|
|
53
|
+
RelatonBib::LocalizedString.new cnt
|
|
54
|
+
elsif (cnt.nil? || cnt.empty?) && acr && acr["en"]
|
|
55
|
+
RelatonBib::LocalizedString.new(acr["en"], "en", "Latn")
|
|
56
|
+
else cnt
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -2,21 +2,12 @@ module RelatonBipm
|
|
|
2
2
|
class EditorialGroup
|
|
3
3
|
include RelatonBib
|
|
4
4
|
|
|
5
|
-
COMMITTEES = %w[CGPM CIPM BIPM CCAUV CCEM CCL CCM CCPR CCQM CCRI CCT CCTF
|
|
6
|
-
CCU CCL-CCT JCGM JCRB JCTLM INetQI].freeze
|
|
7
|
-
|
|
8
5
|
# @return [Array<String>]
|
|
9
6
|
attr_reader :committee, :workgroup
|
|
10
7
|
|
|
11
|
-
# @param committee [Array<
|
|
12
|
-
# @param workgroup [Array<
|
|
13
|
-
def initialize(committee:, workgroup:)
|
|
14
|
-
committee.each do |c|
|
|
15
|
-
unless COMMITTEES.include? c
|
|
16
|
-
warn "[relaton-bipm] invalid committee: #{c}"
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
8
|
+
# @param committee [Array<RelatonBipm::Committee>]
|
|
9
|
+
# @param workgroup [Array<RelatonBipm::WorkGroup>]
|
|
10
|
+
def initialize(committee:, workgroup: [])
|
|
20
11
|
@committee = committee
|
|
21
12
|
@workgroup = workgroup
|
|
22
13
|
end
|
|
@@ -24,19 +15,19 @@ module RelatonBipm
|
|
|
24
15
|
# @param builder [Nokogiri::XML::Builder]
|
|
25
16
|
def to_xml(builder)
|
|
26
17
|
builder.editorialgroup do |b|
|
|
27
|
-
committee.each { |c|
|
|
28
|
-
workgroup.each { |c|
|
|
18
|
+
committee.each { |c| c.to_xml b }
|
|
19
|
+
workgroup.each { |c| c.to_xml b }
|
|
29
20
|
end
|
|
30
21
|
end
|
|
31
22
|
|
|
32
23
|
# @param prefix [String]
|
|
33
24
|
# @return [String]
|
|
34
|
-
def to_asciibib(prefix = "")
|
|
25
|
+
def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
|
|
35
26
|
pref = prefix.empty? ? prefix : prefix + "."
|
|
36
27
|
pref += "editorialgroup"
|
|
37
28
|
out = ""
|
|
38
|
-
committee.each { |c| out +=
|
|
39
|
-
workgroup.each { |w| out +=
|
|
29
|
+
committee.each { |c| out += c.to_asciibib pref, committee.size }
|
|
30
|
+
workgroup.each { |w| out += w.to_asciibib pref, workgroup.size }
|
|
40
31
|
out
|
|
41
32
|
end
|
|
42
33
|
|
|
@@ -2,6 +2,8 @@ require "yaml"
|
|
|
2
2
|
|
|
3
3
|
module RelatonBipm
|
|
4
4
|
class HashConverter < RelatonBib::HashConverter
|
|
5
|
+
@@acronyms = nil
|
|
6
|
+
|
|
5
7
|
class << self
|
|
6
8
|
# @override RelatonIsoBib::HashConverter.hash_to_bib
|
|
7
9
|
# @param args [Hash]
|
|
@@ -67,8 +69,32 @@ module RelatonBipm
|
|
|
67
69
|
end
|
|
68
70
|
|
|
69
71
|
# @param ret [Hash]
|
|
70
|
-
def editorialgroup_hash_to_bib(ret)
|
|
71
|
-
|
|
72
|
+
def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize
|
|
73
|
+
return unless ret[:editorialgroup]
|
|
74
|
+
|
|
75
|
+
cmt = ret[:editorialgroup][:committee].map do |c|
|
|
76
|
+
if (vars = committee_variants c).any?
|
|
77
|
+
content = RelatonBib::LocalizedString.new vars
|
|
78
|
+
Committee.new acronym: c[:acronym], content: content
|
|
79
|
+
else
|
|
80
|
+
Committee.new c
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
wg = array(ret[:editorialgroup][:workgroup]).map do |w|
|
|
84
|
+
w.is_a?(Hash) ? WorkGroup.new(w) : WorkGroup.new(content: w)
|
|
85
|
+
end
|
|
86
|
+
ret[:editorialgroup] = EditorialGroup.new committee: cmt, workgroup: wg
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def committee_variants(cmt)
|
|
90
|
+
array(cmt[:variants]).each_with_object([]) do |v, a|
|
|
91
|
+
c = v[:content] || (ac = acronyms[cmt[:acronym]]) && ac[v[:language]]
|
|
92
|
+
a << RelatonBib::LocalizedString.new(c, v[:language], v[:script]) if c
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def acronyms
|
|
97
|
+
@@acronyms ||= YAML.load_file File.join __dir__, "acronyms.yaml"
|
|
72
98
|
end
|
|
73
99
|
|
|
74
100
|
# @param ret [Hash]
|
data/lib/relaton_bipm/version.rb
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
module RelatonBipm
|
|
2
|
+
class WorkGroup
|
|
3
|
+
# @return [String]
|
|
4
|
+
attr_reader :content
|
|
5
|
+
|
|
6
|
+
# @return [String, nil]
|
|
7
|
+
attr_reader :acronym
|
|
8
|
+
|
|
9
|
+
# @param content [String]
|
|
10
|
+
# @param acronym [String, nil]
|
|
11
|
+
def initialize(content:, acronym: nil)
|
|
12
|
+
@content = content
|
|
13
|
+
@acronym = acronym
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @param builder [Nokogiri::XML::Builder]
|
|
17
|
+
def to_xml(builder)
|
|
18
|
+
xml = builder.workgroup content
|
|
19
|
+
xml[:acronym] = acronym if acronym
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @param prefix [String]
|
|
23
|
+
# @param count [Integer]
|
|
24
|
+
# @return [String]
|
|
25
|
+
def to_asciibib(prefix, count = 1)
|
|
26
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
|
27
|
+
pref += "workgroup"
|
|
28
|
+
if acronym
|
|
29
|
+
out = count > 1 ? "#{pref}::\n" : ""
|
|
30
|
+
out += "#{pref}.acronym:: #{acronym}\n"
|
|
31
|
+
out + "#{pref}.content:: #{content}\n"
|
|
32
|
+
else "#{pref}:: #{content}\n"
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @return [Hash, String]
|
|
37
|
+
def to_hash
|
|
38
|
+
if acronym
|
|
39
|
+
hash = { "content" => content }
|
|
40
|
+
hash["acronym"] = acronym
|
|
41
|
+
hash
|
|
42
|
+
else content
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -13,6 +13,7 @@ module RelatonBipm
|
|
|
13
13
|
|
|
14
14
|
data[:comment_period] = fetch_commentperiond ext
|
|
15
15
|
data[:si_aspect] = ext.at("si-aspect")&.text
|
|
16
|
+
data[:meeting_note] = ext.at("meeting-note")&.text
|
|
16
17
|
data
|
|
17
18
|
end
|
|
18
19
|
|
|
@@ -63,21 +64,41 @@ module RelatonBipm
|
|
|
63
64
|
|
|
64
65
|
# @param ext [Nokogiri::XML::Element]
|
|
65
66
|
# @return [RelatonBipm::EditorialGroup, nil]
|
|
66
|
-
def fetch_editorialgroup(ext)
|
|
67
|
+
def fetch_editorialgroup(ext) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
67
68
|
return unless ext && (eg = ext.at "editorialgroup")
|
|
68
69
|
|
|
69
|
-
cm = eg.xpath("committee").map
|
|
70
|
-
|
|
70
|
+
cm = eg.xpath("committee").map do |c|
|
|
71
|
+
vars = variants c
|
|
72
|
+
cnt = if vars.any?
|
|
73
|
+
RelatonBib::LocalizedString.new vars
|
|
74
|
+
else
|
|
75
|
+
RelatonBib::LocalizedString.new c.text, c[:language], c[:script]
|
|
76
|
+
end
|
|
77
|
+
Committee.new acronym: c[:acronym], content: cnt
|
|
78
|
+
end
|
|
79
|
+
wg = eg.xpath("workgroup").map do |w|
|
|
80
|
+
WorkGroup.new content: w.text, acronym: w[:acronym]
|
|
81
|
+
end
|
|
71
82
|
EditorialGroup.new committee: cm, workgroup: wg
|
|
72
83
|
end
|
|
73
84
|
|
|
85
|
+
# @TODO remove this method before next (1.7.0) relaton release
|
|
86
|
+
# it's in the relaton-bib but hasn't released yet
|
|
87
|
+
# @param title [Nokogiri::XML::Element]
|
|
88
|
+
# @return [Array<RelatonBib::LocalizedString>]
|
|
89
|
+
def variants(elm)
|
|
90
|
+
elm.xpath("variant").map do |v|
|
|
91
|
+
RelatonBib::LocalizedString.new v.text, v[:language], v[:script]
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
74
95
|
# @param ext [Nokogiri::XML::Element]
|
|
75
96
|
# @return [RelatonBipm::StructuredIdentifier]
|
|
76
97
|
def fetch_structuredidentifier(ext)
|
|
77
98
|
return unless ext && (sid = ext.at("structuredidentifier"))
|
|
78
99
|
|
|
79
100
|
StructuredIdentifier.new(
|
|
80
|
-
docnumber: sid.at("docnumber")
|
|
101
|
+
docnumber: sid.at("docnumber")&.text, part: sid.at("part")&.text,
|
|
81
102
|
appendix: sid.at("appendix")&.text
|
|
82
103
|
)
|
|
83
104
|
end
|
data/relaton_bipm.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bipm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.7.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: 2020-11-
|
|
11
|
+
date: 2020-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|
|
@@ -156,14 +156,14 @@ dependencies:
|
|
|
156
156
|
requirements:
|
|
157
157
|
- - "~>"
|
|
158
158
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 1.
|
|
159
|
+
version: 1.7.0
|
|
160
160
|
type: :runtime
|
|
161
161
|
prerelease: false
|
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 1.
|
|
166
|
+
version: 1.7.0
|
|
167
167
|
description: 'RelatonBipm: retrieve BIPM Standards for bibliographic use using the
|
|
168
168
|
BibliographicItem model'
|
|
169
169
|
email:
|
|
@@ -191,16 +191,19 @@ files:
|
|
|
191
191
|
- grammars/isodoc.rng
|
|
192
192
|
- grammars/reqt.rng
|
|
193
193
|
- lib/relaton_bipm.rb
|
|
194
|
+
- lib/relaton_bipm/acronyms.yaml
|
|
194
195
|
- lib/relaton_bipm/bibliographic_date.rb
|
|
195
196
|
- lib/relaton_bipm/bipm_bibliographic_item.rb
|
|
196
197
|
- lib/relaton_bipm/bipm_bibliography.rb
|
|
197
198
|
- lib/relaton_bipm/comment_periond.rb
|
|
199
|
+
- lib/relaton_bipm/committee.rb
|
|
198
200
|
- lib/relaton_bipm/document_relation.rb
|
|
199
201
|
- lib/relaton_bipm/editorial_group.rb
|
|
200
202
|
- lib/relaton_bipm/hash_converter.rb
|
|
201
203
|
- lib/relaton_bipm/processor.rb
|
|
202
204
|
- lib/relaton_bipm/structured_identifier.rb
|
|
203
205
|
- lib/relaton_bipm/version.rb
|
|
206
|
+
- lib/relaton_bipm/workgroup.rb
|
|
204
207
|
- lib/relaton_bipm/xml_parser.rb
|
|
205
208
|
- relaton_bipm.gemspec
|
|
206
209
|
homepage: https://github.com/relaton/relaton-bipm
|