relaton-un 1.0.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ubuntu.yml +1 -0
- data/.rubocop.yml +2 -2
- data/grammars/biblio.rng +89 -32
- data/grammars/isodoc.rng +450 -4
- data/grammars/un.rng +111 -0
- data/lib/relaton_un.rb +1 -1
- data/lib/relaton_un/editorialgroup.rb +8 -0
- data/lib/relaton_un/hash_converter.rb +2 -1
- data/lib/relaton_un/hit.rb +4 -7
- data/lib/relaton_un/hit_collection.rb +9 -4
- data/lib/relaton_un/processor.rb +1 -1
- data/lib/relaton_un/session.rb +32 -10
- data/lib/relaton_un/un_bibliographic_item.rb +42 -7
- data/lib/relaton_un/version.rb +1 -1
- data/lib/relaton_un/xml_parser.rb +26 -25
- data/relaton_un.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 613a9a82547cda0760295b57949e565c868f3fd2b660a7f7d813ba6e224a00b8
|
4
|
+
data.tar.gz: 5aa7797780314ab7887b540fb84105a0dccab4a36f1c5fabcf5f814e70d4b2e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bf072e67d014ac53bc8a95650a87fcd079420cf93fe2b47ab051a6c41b406b5e75d45127b5d6ba8bab3a6c9279604aee9a059b620c4bc167659f19eb502fcbf
|
7
|
+
data.tar.gz: 8d17af6fa62c494921521a3a4ce417f0fd604ce560949a587d1b37db1230d8a889cfdb831fcd0cef78bdbc676b594680abc51a75e06f67befb464b81756c1d8e
|
data/.rubocop.yml
CHANGED
data/grammars/biblio.rng
CHANGED
@@ -88,7 +88,7 @@
|
|
88
88
|
<text/>
|
89
89
|
</element>
|
90
90
|
</define>
|
91
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
92
92
|
<optional>
|
93
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
94
|
<attribute name="language"/>
|
@@ -98,6 +98,16 @@
|
|
98
98
|
</optional>
|
99
99
|
<text/>
|
100
100
|
</define>
|
101
|
+
<define name="LocalizedString">
|
102
|
+
<choice>
|
103
|
+
<ref name="LocalizedString1"/>
|
104
|
+
<oneOrMore>
|
105
|
+
<element name="variant">
|
106
|
+
<ref name="LocalizedString1"/>
|
107
|
+
</element>
|
108
|
+
</oneOrMore>
|
109
|
+
</choice>
|
110
|
+
</define>
|
101
111
|
<!--
|
102
112
|
Unlike UML, change type to format: type is overloaded
|
103
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -121,7 +131,7 @@
|
|
121
131
|
</optional>
|
122
132
|
<ref name="LocalizedStringOrXsAny"/>
|
123
133
|
</define>
|
124
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
125
135
|
<optional>
|
126
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
127
137
|
<attribute name="language"/>
|
@@ -136,6 +146,16 @@
|
|
136
146
|
</choice>
|
137
147
|
</oneOrMore>
|
138
148
|
</define>
|
149
|
+
<define name="LocalizedStringOrXsAny">
|
150
|
+
<choice>
|
151
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
152
|
+
<oneOrMore>
|
153
|
+
<element name="variant">
|
154
|
+
<ref name="LocalizedStringOrXsAny1"/>
|
155
|
+
</element>
|
156
|
+
</oneOrMore>
|
157
|
+
</choice>
|
158
|
+
</define>
|
139
159
|
<define name="contributor">
|
140
160
|
<element name="contributor">
|
141
161
|
<zeroOrMore>
|
@@ -512,7 +532,7 @@
|
|
512
532
|
</define>
|
513
533
|
<define name="LocalityType">
|
514
534
|
<data type="string">
|
515
|
-
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|locality:[a-zA-Z0-9_]+</param>
|
535
|
+
<param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
|
516
536
|
</data>
|
517
537
|
</define>
|
518
538
|
<define name="referenceFrom">
|
@@ -641,9 +661,9 @@
|
|
641
661
|
<optional>
|
642
662
|
<ref name="status"/>
|
643
663
|
</optional>
|
644
|
-
<
|
664
|
+
<zeroOrMore>
|
645
665
|
<ref name="copyright"/>
|
646
|
-
</
|
666
|
+
</zeroOrMore>
|
647
667
|
<zeroOrMore>
|
648
668
|
<ref name="docrelation"/>
|
649
669
|
</zeroOrMore>
|
@@ -767,6 +787,8 @@
|
|
767
787
|
<value>unchanged</value>
|
768
788
|
<value>circulated</value>
|
769
789
|
<value>adapted</value>
|
790
|
+
<value>vote-started</value>
|
791
|
+
<value>vote-ended</value>
|
770
792
|
</choice>
|
771
793
|
</define>
|
772
794
|
<define name="bdate">
|
@@ -999,7 +1021,17 @@
|
|
999
1021
|
<optional>
|
1000
1022
|
<ref name="to"/>
|
1001
1023
|
</optional>
|
1002
|
-
<
|
1024
|
+
<oneOrMore>
|
1025
|
+
<ref name="owner"/>
|
1026
|
+
</oneOrMore>
|
1027
|
+
<optional>
|
1028
|
+
<ref name="copyright_scope"/>
|
1029
|
+
</optional>
|
1030
|
+
</element>
|
1031
|
+
</define>
|
1032
|
+
<define name="copyright_scope">
|
1033
|
+
<element name="scope">
|
1034
|
+
<text/>
|
1003
1035
|
</element>
|
1004
1036
|
</define>
|
1005
1037
|
<define name="from">
|
@@ -1019,38 +1051,63 @@
|
|
1019
1051
|
</define>
|
1020
1052
|
<define name="DocRelationType">
|
1021
1053
|
<choice>
|
1022
|
-
<value>obsoletes</value>
|
1023
|
-
<value>obsoletedBy</value>
|
1024
|
-
<value>supersedes</value>
|
1025
|
-
<value>supersededBy</value>
|
1026
|
-
<value>updates</value>
|
1027
|
-
<value>updatedBy</value>
|
1028
|
-
<value>complements</value>
|
1029
|
-
<value>derivedFrom</value>
|
1030
|
-
<value>translatedFrom</value>
|
1031
|
-
<value>hasTranslation</value>
|
1032
|
-
<value>adoptedFrom</value>
|
1033
|
-
<value>equivalent</value>
|
1034
|
-
<value>identical</value>
|
1035
|
-
<value>nonequivalent</value>
|
1036
|
-
<value>includedIn</value>
|
1037
1054
|
<value>includes</value>
|
1038
|
-
<value>
|
1039
|
-
<value>instanceOf</value>
|
1040
|
-
<value>partOf</value>
|
1055
|
+
<value>includedIn</value>
|
1041
1056
|
<value>hasPart</value>
|
1042
|
-
<value>
|
1043
|
-
<value>draftOf</value>
|
1057
|
+
<value>partOf</value>
|
1044
1058
|
<value>merges</value>
|
1059
|
+
<value>mergedInto</value>
|
1045
1060
|
<value>splits</value>
|
1046
|
-
<value>
|
1047
|
-
<value>
|
1048
|
-
<value>
|
1049
|
-
<value>
|
1050
|
-
<value>
|
1051
|
-
<value>
|
1061
|
+
<value>splitInto</value>
|
1062
|
+
<value>instance</value>
|
1063
|
+
<value>hasInstance</value>
|
1064
|
+
<value>exemplarOf</value>
|
1065
|
+
<value>hasExemplar</value>
|
1066
|
+
<value>manifestationOf</value>
|
1067
|
+
<value>hasManifestation</value>
|
1068
|
+
<value>reproductionOf</value>
|
1069
|
+
<value>hasReproduction</value>
|
1070
|
+
<value>reprintOf</value>
|
1071
|
+
<value>hasReprint</value>
|
1072
|
+
<value>expressionOf</value>
|
1073
|
+
<value>hasExpression</value>
|
1074
|
+
<value>translatedFrom</value>
|
1075
|
+
<value>hasTranslation</value>
|
1076
|
+
<value>arrangementOf</value>
|
1077
|
+
<value>hasArrangement</value>
|
1078
|
+
<value>abridgementOf</value>
|
1079
|
+
<value>hasAbridgement</value>
|
1080
|
+
<value>annotationOf</value>
|
1081
|
+
<value>hasAnnotation</value>
|
1082
|
+
<value>draftOf</value>
|
1083
|
+
<value>hasDraft</value>
|
1084
|
+
<value>editionOf</value>
|
1085
|
+
<value>hasEdition</value>
|
1086
|
+
<value>updates</value>
|
1087
|
+
<value>updatedBy</value>
|
1088
|
+
<value>derivedFrom</value>
|
1089
|
+
<value>derives</value>
|
1052
1090
|
<value>describes</value>
|
1053
1091
|
<value>describedBy</value>
|
1092
|
+
<value>catalogues</value>
|
1093
|
+
<value>cataloguedBy</value>
|
1094
|
+
<value>hasSuccessor</value>
|
1095
|
+
<value>successorOf</value>
|
1096
|
+
<value>adaptedFrom</value>
|
1097
|
+
<value>hasAdaptation</value>
|
1098
|
+
<value>adoptedFrom</value>
|
1099
|
+
<value>adoptedAs</value>
|
1100
|
+
<value>reviewOf</value>
|
1101
|
+
<value>hasReview</value>
|
1102
|
+
<value>commentaryOf</value>
|
1103
|
+
<value>hasCommentary</value>
|
1104
|
+
<value>related</value>
|
1105
|
+
<value>complements</value>
|
1106
|
+
<value>complementOf</value>
|
1107
|
+
<value>obsoletes</value>
|
1108
|
+
<value>obsoletedBy</value>
|
1109
|
+
<value>cited</value>
|
1110
|
+
<value>isCitedIn</value>
|
1054
1111
|
</choice>
|
1055
1112
|
</define>
|
1056
1113
|
<define name="docrelation">
|
data/grammars/isodoc.rng
CHANGED
@@ -53,9 +53,96 @@
|
|
53
53
|
<optional>
|
54
54
|
<attribute name="alt"/>
|
55
55
|
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="case">
|
58
|
+
<choice>
|
59
|
+
<value>capital</value>
|
60
|
+
<value>lowercase</value>
|
61
|
+
</choice>
|
62
|
+
</attribute>
|
63
|
+
</optional>
|
56
64
|
<text/>
|
57
65
|
</element>
|
58
66
|
</define>
|
67
|
+
<define name="ul">
|
68
|
+
<element name="ul">
|
69
|
+
<attribute name="id">
|
70
|
+
<data type="ID"/>
|
71
|
+
</attribute>
|
72
|
+
<optional>
|
73
|
+
<attribute name="keep-with-next">
|
74
|
+
<data type="boolean"/>
|
75
|
+
</attribute>
|
76
|
+
</optional>
|
77
|
+
<optional>
|
78
|
+
<attribute name="keep-lines-together">
|
79
|
+
<data type="boolean"/>
|
80
|
+
</attribute>
|
81
|
+
</optional>
|
82
|
+
<oneOrMore>
|
83
|
+
<ref name="li"/>
|
84
|
+
</oneOrMore>
|
85
|
+
<zeroOrMore>
|
86
|
+
<ref name="note"/>
|
87
|
+
</zeroOrMore>
|
88
|
+
</element>
|
89
|
+
</define>
|
90
|
+
<define name="ol">
|
91
|
+
<element name="ol">
|
92
|
+
<attribute name="id">
|
93
|
+
<data type="ID"/>
|
94
|
+
</attribute>
|
95
|
+
<optional>
|
96
|
+
<attribute name="keep-with-next">
|
97
|
+
<data type="boolean"/>
|
98
|
+
</attribute>
|
99
|
+
</optional>
|
100
|
+
<optional>
|
101
|
+
<attribute name="keep-lines-together">
|
102
|
+
<data type="boolean"/>
|
103
|
+
</attribute>
|
104
|
+
</optional>
|
105
|
+
<attribute name="type">
|
106
|
+
<choice>
|
107
|
+
<value>roman</value>
|
108
|
+
<value>alphabet</value>
|
109
|
+
<value>arabic</value>
|
110
|
+
<value>roman_upper</value>
|
111
|
+
<value>alphabet_upper</value>
|
112
|
+
</choice>
|
113
|
+
</attribute>
|
114
|
+
<oneOrMore>
|
115
|
+
<ref name="li"/>
|
116
|
+
</oneOrMore>
|
117
|
+
<zeroOrMore>
|
118
|
+
<ref name="note"/>
|
119
|
+
</zeroOrMore>
|
120
|
+
</element>
|
121
|
+
</define>
|
122
|
+
<define name="dl">
|
123
|
+
<element name="dl">
|
124
|
+
<attribute name="id">
|
125
|
+
<data type="ID"/>
|
126
|
+
</attribute>
|
127
|
+
<optional>
|
128
|
+
<attribute name="keep-with-next">
|
129
|
+
<data type="boolean"/>
|
130
|
+
</attribute>
|
131
|
+
</optional>
|
132
|
+
<optional>
|
133
|
+
<attribute name="keep-lines-together">
|
134
|
+
<data type="boolean"/>
|
135
|
+
</attribute>
|
136
|
+
</optional>
|
137
|
+
<oneOrMore>
|
138
|
+
<ref name="dt"/>
|
139
|
+
<ref name="dd"/>
|
140
|
+
</oneOrMore>
|
141
|
+
<zeroOrMore>
|
142
|
+
<ref name="note"/>
|
143
|
+
</zeroOrMore>
|
144
|
+
</element>
|
145
|
+
</define>
|
59
146
|
<define name="example">
|
60
147
|
<element name="example">
|
61
148
|
<attribute name="id">
|
@@ -69,6 +156,19 @@
|
|
69
156
|
<optional>
|
70
157
|
<attribute name="subsequence"/>
|
71
158
|
</optional>
|
159
|
+
<optional>
|
160
|
+
<attribute name="number"/>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-with-next">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
167
|
+
<optional>
|
168
|
+
<attribute name="keep-lines-together">
|
169
|
+
<data type="boolean"/>
|
170
|
+
</attribute>
|
171
|
+
</optional>
|
72
172
|
<optional>
|
73
173
|
<ref name="tname"/>
|
74
174
|
</optional>
|
@@ -89,6 +189,296 @@
|
|
89
189
|
</zeroOrMore>
|
90
190
|
</element>
|
91
191
|
</define>
|
192
|
+
<define name="table">
|
193
|
+
<element name="table">
|
194
|
+
<attribute name="id">
|
195
|
+
<data type="ID"/>
|
196
|
+
</attribute>
|
197
|
+
<optional>
|
198
|
+
<attribute name="unnumbered">
|
199
|
+
<data type="boolean"/>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<optional>
|
203
|
+
<attribute name="number"/>
|
204
|
+
</optional>
|
205
|
+
<optional>
|
206
|
+
<attribute name="subsequence"/>
|
207
|
+
</optional>
|
208
|
+
<optional>
|
209
|
+
<attribute name="alt"/>
|
210
|
+
</optional>
|
211
|
+
<optional>
|
212
|
+
<attribute name="summary"/>
|
213
|
+
</optional>
|
214
|
+
<optional>
|
215
|
+
<attribute name="uri">
|
216
|
+
<data type="anyURI"/>
|
217
|
+
</attribute>
|
218
|
+
</optional>
|
219
|
+
<optional>
|
220
|
+
<attribute name="keep-with-next">
|
221
|
+
<data type="boolean"/>
|
222
|
+
</attribute>
|
223
|
+
</optional>
|
224
|
+
<optional>
|
225
|
+
<attribute name="keep-lines-together">
|
226
|
+
<data type="boolean"/>
|
227
|
+
</attribute>
|
228
|
+
</optional>
|
229
|
+
<optional>
|
230
|
+
<ref name="tname"/>
|
231
|
+
</optional>
|
232
|
+
<optional>
|
233
|
+
<ref name="thead"/>
|
234
|
+
</optional>
|
235
|
+
<ref name="tbody"/>
|
236
|
+
<optional>
|
237
|
+
<ref name="tfoot"/>
|
238
|
+
</optional>
|
239
|
+
<zeroOrMore>
|
240
|
+
<ref name="table-note"/>
|
241
|
+
</zeroOrMore>
|
242
|
+
<optional>
|
243
|
+
<ref name="dl"/>
|
244
|
+
</optional>
|
245
|
+
</element>
|
246
|
+
</define>
|
247
|
+
<define name="figure">
|
248
|
+
<element name="figure">
|
249
|
+
<attribute name="id">
|
250
|
+
<data type="ID"/>
|
251
|
+
</attribute>
|
252
|
+
<optional>
|
253
|
+
<attribute name="unnumbered">
|
254
|
+
<data type="boolean"/>
|
255
|
+
</attribute>
|
256
|
+
</optional>
|
257
|
+
<optional>
|
258
|
+
<attribute name="number"/>
|
259
|
+
</optional>
|
260
|
+
<optional>
|
261
|
+
<attribute name="subsequence"/>
|
262
|
+
</optional>
|
263
|
+
<optional>
|
264
|
+
<attribute name="keep-with-next">
|
265
|
+
<data type="boolean"/>
|
266
|
+
</attribute>
|
267
|
+
</optional>
|
268
|
+
<optional>
|
269
|
+
<attribute name="keep-lines-together">
|
270
|
+
<data type="boolean"/>
|
271
|
+
</attribute>
|
272
|
+
</optional>
|
273
|
+
<optional>
|
274
|
+
<attribute name="class"/>
|
275
|
+
</optional>
|
276
|
+
<optional>
|
277
|
+
<ref name="source"/>
|
278
|
+
</optional>
|
279
|
+
<optional>
|
280
|
+
<ref name="tname"/>
|
281
|
+
</optional>
|
282
|
+
<choice>
|
283
|
+
<ref name="image"/>
|
284
|
+
<ref name="video"/>
|
285
|
+
<ref name="audio"/>
|
286
|
+
<ref name="pre"/>
|
287
|
+
<oneOrMore>
|
288
|
+
<ref name="paragraph-with-footnote"/>
|
289
|
+
</oneOrMore>
|
290
|
+
<zeroOrMore>
|
291
|
+
<ref name="figure"/>
|
292
|
+
</zeroOrMore>
|
293
|
+
</choice>
|
294
|
+
<zeroOrMore>
|
295
|
+
<ref name="fn"/>
|
296
|
+
</zeroOrMore>
|
297
|
+
<optional>
|
298
|
+
<ref name="dl"/>
|
299
|
+
</optional>
|
300
|
+
<zeroOrMore>
|
301
|
+
<ref name="note"/>
|
302
|
+
</zeroOrMore>
|
303
|
+
</element>
|
304
|
+
</define>
|
305
|
+
<define name="sourcecode">
|
306
|
+
<element name="sourcecode">
|
307
|
+
<attribute name="id">
|
308
|
+
<data type="ID"/>
|
309
|
+
</attribute>
|
310
|
+
<optional>
|
311
|
+
<attribute name="unnumbered">
|
312
|
+
<data type="boolean"/>
|
313
|
+
</attribute>
|
314
|
+
</optional>
|
315
|
+
<optional>
|
316
|
+
<attribute name="number"/>
|
317
|
+
</optional>
|
318
|
+
<optional>
|
319
|
+
<attribute name="subsequence"/>
|
320
|
+
</optional>
|
321
|
+
<optional>
|
322
|
+
<attribute name="keep-with-next">
|
323
|
+
<data type="boolean"/>
|
324
|
+
</attribute>
|
325
|
+
</optional>
|
326
|
+
<optional>
|
327
|
+
<attribute name="keep-lines-together">
|
328
|
+
<data type="boolean"/>
|
329
|
+
</attribute>
|
330
|
+
</optional>
|
331
|
+
<optional>
|
332
|
+
<attribute name="lang"/>
|
333
|
+
</optional>
|
334
|
+
<optional>
|
335
|
+
<ref name="tname"/>
|
336
|
+
</optional>
|
337
|
+
<oneOrMore>
|
338
|
+
<choice>
|
339
|
+
<text/>
|
340
|
+
<ref name="callout"/>
|
341
|
+
</choice>
|
342
|
+
</oneOrMore>
|
343
|
+
<zeroOrMore>
|
344
|
+
<ref name="annotation"/>
|
345
|
+
</zeroOrMore>
|
346
|
+
<zeroOrMore>
|
347
|
+
<ref name="note"/>
|
348
|
+
</zeroOrMore>
|
349
|
+
</element>
|
350
|
+
</define>
|
351
|
+
<define name="formula">
|
352
|
+
<element name="formula">
|
353
|
+
<attribute name="id">
|
354
|
+
<data type="ID"/>
|
355
|
+
</attribute>
|
356
|
+
<optional>
|
357
|
+
<attribute name="unnumbered">
|
358
|
+
<data type="boolean"/>
|
359
|
+
</attribute>
|
360
|
+
</optional>
|
361
|
+
<optional>
|
362
|
+
<attribute name="number"/>
|
363
|
+
</optional>
|
364
|
+
<optional>
|
365
|
+
<attribute name="subsequence"/>
|
366
|
+
</optional>
|
367
|
+
<optional>
|
368
|
+
<attribute name="keep-with-next">
|
369
|
+
<data type="boolean"/>
|
370
|
+
</attribute>
|
371
|
+
</optional>
|
372
|
+
<optional>
|
373
|
+
<attribute name="keep-lines-together">
|
374
|
+
<data type="boolean"/>
|
375
|
+
</attribute>
|
376
|
+
</optional>
|
377
|
+
<optional>
|
378
|
+
<attribute name="inequality">
|
379
|
+
<data type="boolean"/>
|
380
|
+
</attribute>
|
381
|
+
</optional>
|
382
|
+
<ref name="stem"/>
|
383
|
+
<optional>
|
384
|
+
<ref name="dl"/>
|
385
|
+
</optional>
|
386
|
+
<zeroOrMore>
|
387
|
+
<ref name="note"/>
|
388
|
+
</zeroOrMore>
|
389
|
+
</element>
|
390
|
+
</define>
|
391
|
+
<define name="ParagraphType">
|
392
|
+
<attribute name="id">
|
393
|
+
<data type="ID"/>
|
394
|
+
</attribute>
|
395
|
+
<optional>
|
396
|
+
<attribute name="align">
|
397
|
+
<ref name="Alignments"/>
|
398
|
+
</attribute>
|
399
|
+
</optional>
|
400
|
+
<optional>
|
401
|
+
<attribute name="keep-with-next">
|
402
|
+
<data type="boolean"/>
|
403
|
+
</attribute>
|
404
|
+
</optional>
|
405
|
+
<optional>
|
406
|
+
<attribute name="keep-lines-together">
|
407
|
+
<data type="boolean"/>
|
408
|
+
</attribute>
|
409
|
+
</optional>
|
410
|
+
<zeroOrMore>
|
411
|
+
<ref name="TextElement"/>
|
412
|
+
</zeroOrMore>
|
413
|
+
<zeroOrMore>
|
414
|
+
<ref name="note"/>
|
415
|
+
</zeroOrMore>
|
416
|
+
</define>
|
417
|
+
<define name="paragraph-with-footnote">
|
418
|
+
<element name="p">
|
419
|
+
<attribute name="id">
|
420
|
+
<data type="ID"/>
|
421
|
+
</attribute>
|
422
|
+
<optional>
|
423
|
+
<attribute name="align">
|
424
|
+
<ref name="Alignments"/>
|
425
|
+
</attribute>
|
426
|
+
</optional>
|
427
|
+
<optional>
|
428
|
+
<attribute name="keep-with-next">
|
429
|
+
<data type="boolean"/>
|
430
|
+
</attribute>
|
431
|
+
</optional>
|
432
|
+
<optional>
|
433
|
+
<attribute name="keep-lines-together">
|
434
|
+
<data type="boolean"/>
|
435
|
+
</attribute>
|
436
|
+
</optional>
|
437
|
+
<zeroOrMore>
|
438
|
+
<choice>
|
439
|
+
<ref name="TextElement"/>
|
440
|
+
<ref name="fn"/>
|
441
|
+
</choice>
|
442
|
+
</zeroOrMore>
|
443
|
+
<zeroOrMore>
|
444
|
+
<ref name="note"/>
|
445
|
+
</zeroOrMore>
|
446
|
+
</element>
|
447
|
+
</define>
|
448
|
+
<define name="quote">
|
449
|
+
<element name="quote">
|
450
|
+
<attribute name="id">
|
451
|
+
<data type="ID"/>
|
452
|
+
</attribute>
|
453
|
+
<optional>
|
454
|
+
<attribute name="alignment">
|
455
|
+
<ref name="Alignments"/>
|
456
|
+
</attribute>
|
457
|
+
</optional>
|
458
|
+
<optional>
|
459
|
+
<attribute name="keep-with-next">
|
460
|
+
<data type="boolean"/>
|
461
|
+
</attribute>
|
462
|
+
</optional>
|
463
|
+
<optional>
|
464
|
+
<attribute name="keep-lines-together">
|
465
|
+
<data type="boolean"/>
|
466
|
+
</attribute>
|
467
|
+
</optional>
|
468
|
+
<optional>
|
469
|
+
<ref name="quote-source"/>
|
470
|
+
</optional>
|
471
|
+
<optional>
|
472
|
+
<ref name="quote-author"/>
|
473
|
+
</optional>
|
474
|
+
<oneOrMore>
|
475
|
+
<ref name="paragraph-with-footnote"/>
|
476
|
+
</oneOrMore>
|
477
|
+
<zeroOrMore>
|
478
|
+
<ref name="note"/>
|
479
|
+
</zeroOrMore>
|
480
|
+
</element>
|
481
|
+
</define>
|
92
482
|
<define name="BibDataExtensionType">
|
93
483
|
<ref name="doctype"/>
|
94
484
|
<optional>
|
@@ -129,6 +519,9 @@
|
|
129
519
|
</choice>
|
130
520
|
</attribute>
|
131
521
|
</optional>
|
522
|
+
<attribute name="normative">
|
523
|
+
<data type="boolean"/>
|
524
|
+
</attribute>
|
132
525
|
<optional>
|
133
526
|
<ref name="section-title"/>
|
134
527
|
</optional>
|
@@ -154,6 +547,30 @@
|
|
154
547
|
<attribute name="id">
|
155
548
|
<data type="ID"/>
|
156
549
|
</attribute>
|
550
|
+
<optional>
|
551
|
+
<attribute name="unnumbered">
|
552
|
+
<data type="boolean"/>
|
553
|
+
</attribute>
|
554
|
+
</optional>
|
555
|
+
<optional>
|
556
|
+
<attribute name="number"/>
|
557
|
+
</optional>
|
558
|
+
<optional>
|
559
|
+
<attribute name="subsequence"/>
|
560
|
+
</optional>
|
561
|
+
<optional>
|
562
|
+
<attribute name="keep-with-next">
|
563
|
+
<data type="boolean"/>
|
564
|
+
</attribute>
|
565
|
+
</optional>
|
566
|
+
<optional>
|
567
|
+
<attribute name="keep-lines-together">
|
568
|
+
<data type="boolean"/>
|
569
|
+
</attribute>
|
570
|
+
</optional>
|
571
|
+
<optional>
|
572
|
+
<attribute name="type"/>
|
573
|
+
</optional>
|
157
574
|
<oneOrMore>
|
158
575
|
<choice>
|
159
576
|
<ref name="paragraph"/>
|
@@ -303,11 +720,11 @@
|
|
303
720
|
<ref name="paragraph"/>
|
304
721
|
</element>
|
305
722
|
</define>
|
306
|
-
<define name="TextElement" combine="choice">
|
307
|
-
<ref name="concept"/>
|
308
|
-
</define>
|
309
723
|
</include>
|
310
724
|
<!-- end overrides -->
|
725
|
+
<define name="TextElement" combine="choice">
|
726
|
+
<ref name="concept"/>
|
727
|
+
</define>
|
311
728
|
<define name="concept">
|
312
729
|
<element name="concept">
|
313
730
|
<optional>
|
@@ -899,7 +1316,36 @@
|
|
899
1316
|
<attribute name="id">
|
900
1317
|
<data type="ID"/>
|
901
1318
|
</attribute>
|
902
|
-
<
|
1319
|
+
<optional>
|
1320
|
+
<attribute name="unnumbered">
|
1321
|
+
<data type="boolean"/>
|
1322
|
+
</attribute>
|
1323
|
+
</optional>
|
1324
|
+
<optional>
|
1325
|
+
<attribute name="number"/>
|
1326
|
+
</optional>
|
1327
|
+
<optional>
|
1328
|
+
<attribute name="subsequence"/>
|
1329
|
+
</optional>
|
1330
|
+
<optional>
|
1331
|
+
<attribute name="keep-with-next">
|
1332
|
+
<data type="boolean"/>
|
1333
|
+
</attribute>
|
1334
|
+
</optional>
|
1335
|
+
<optional>
|
1336
|
+
<attribute name="keep-lines-together">
|
1337
|
+
<data type="boolean"/>
|
1338
|
+
</attribute>
|
1339
|
+
</optional>
|
1340
|
+
<oneOrMore>
|
1341
|
+
<choice>
|
1342
|
+
<ref name="paragraph"/>
|
1343
|
+
<ref name="ul"/>
|
1344
|
+
<ref name="ol"/>
|
1345
|
+
<ref name="dl"/>
|
1346
|
+
<ref name="formula"/>
|
1347
|
+
</choice>
|
1348
|
+
</oneOrMore>
|
903
1349
|
</element>
|
904
1350
|
</define>
|
905
1351
|
<define name="termexample">
|
data/grammars/un.rng
CHANGED
@@ -119,6 +119,9 @@
|
|
119
119
|
<optional>
|
120
120
|
<ref name="session"/>
|
121
121
|
</optional>
|
122
|
+
<optional>
|
123
|
+
<ref name="job_number"/>
|
124
|
+
</optional>
|
122
125
|
</define>
|
123
126
|
<define name="preface">
|
124
127
|
<element name="preface">
|
@@ -138,6 +141,109 @@
|
|
138
141
|
<ref name="Basic-Section"/>
|
139
142
|
</element>
|
140
143
|
</define>
|
144
|
+
<define name="Clause-Section">
|
145
|
+
<optional>
|
146
|
+
<attribute name="id">
|
147
|
+
<data type="ID"/>
|
148
|
+
</attribute>
|
149
|
+
</optional>
|
150
|
+
<optional>
|
151
|
+
<attribute name="language"/>
|
152
|
+
</optional>
|
153
|
+
<optional>
|
154
|
+
<attribute name="script"/>
|
155
|
+
</optional>
|
156
|
+
<optional>
|
157
|
+
<attribute name="inline-header">
|
158
|
+
<data type="boolean"/>
|
159
|
+
</attribute>
|
160
|
+
</optional>
|
161
|
+
<optional>
|
162
|
+
<attribute name="obligation">
|
163
|
+
<choice>
|
164
|
+
<value>normative</value>
|
165
|
+
<value>informative</value>
|
166
|
+
</choice>
|
167
|
+
</attribute>
|
168
|
+
</optional>
|
169
|
+
<optional>
|
170
|
+
<attribute name="unnumbered">
|
171
|
+
<data type="boolean"/>
|
172
|
+
</attribute>
|
173
|
+
</optional>
|
174
|
+
<optional>
|
175
|
+
<ref name="section-title"/>
|
176
|
+
</optional>
|
177
|
+
<group>
|
178
|
+
<group>
|
179
|
+
<zeroOrMore>
|
180
|
+
<ref name="BasicBlock"/>
|
181
|
+
</zeroOrMore>
|
182
|
+
<zeroOrMore>
|
183
|
+
<ref name="note"/>
|
184
|
+
</zeroOrMore>
|
185
|
+
</group>
|
186
|
+
<zeroOrMore>
|
187
|
+
<choice>
|
188
|
+
<ref name="clause-subsection"/>
|
189
|
+
<ref name="terms"/>
|
190
|
+
<ref name="definitions"/>
|
191
|
+
</choice>
|
192
|
+
</zeroOrMore>
|
193
|
+
</group>
|
194
|
+
</define>
|
195
|
+
<define name="Annex-Section">
|
196
|
+
<optional>
|
197
|
+
<attribute name="id">
|
198
|
+
<data type="ID"/>
|
199
|
+
</attribute>
|
200
|
+
</optional>
|
201
|
+
<optional>
|
202
|
+
<attribute name="language"/>
|
203
|
+
</optional>
|
204
|
+
<optional>
|
205
|
+
<attribute name="script"/>
|
206
|
+
</optional>
|
207
|
+
<optional>
|
208
|
+
<attribute name="inline-header">
|
209
|
+
<data type="boolean"/>
|
210
|
+
</attribute>
|
211
|
+
</optional>
|
212
|
+
<optional>
|
213
|
+
<attribute name="obligation">
|
214
|
+
<choice>
|
215
|
+
<value>normative</value>
|
216
|
+
<value>informative</value>
|
217
|
+
</choice>
|
218
|
+
</attribute>
|
219
|
+
</optional>
|
220
|
+
<optional>
|
221
|
+
<attribute name="unnumbered">
|
222
|
+
<data type="boolean"/>
|
223
|
+
</attribute>
|
224
|
+
</optional>
|
225
|
+
<optional>
|
226
|
+
<ref name="section-title"/>
|
227
|
+
</optional>
|
228
|
+
<group>
|
229
|
+
<group>
|
230
|
+
<zeroOrMore>
|
231
|
+
<ref name="BasicBlock"/>
|
232
|
+
</zeroOrMore>
|
233
|
+
<zeroOrMore>
|
234
|
+
<ref name="note"/>
|
235
|
+
</zeroOrMore>
|
236
|
+
</group>
|
237
|
+
<zeroOrMore>
|
238
|
+
<choice>
|
239
|
+
<ref name="annex-subsection"/>
|
240
|
+
<ref name="terms"/>
|
241
|
+
<ref name="definitions"/>
|
242
|
+
<ref name="references"/>
|
243
|
+
</choice>
|
244
|
+
</zeroOrMore>
|
245
|
+
</group>
|
246
|
+
</define>
|
141
247
|
</include>
|
142
248
|
<define name="session">
|
143
249
|
<element name="session">
|
@@ -227,6 +333,11 @@
|
|
227
333
|
</choice>
|
228
334
|
</element>
|
229
335
|
</define>
|
336
|
+
<define name="job_number">
|
337
|
+
<element name="job_number">
|
338
|
+
<text/>
|
339
|
+
</element>
|
340
|
+
</define>
|
230
341
|
<define name="un-standard">
|
231
342
|
<element name="un-standard">
|
232
343
|
<ref name="bibdata"/>
|
data/lib/relaton_un.rb
CHANGED
@@ -21,5 +21,13 @@ module RelatonUn
|
|
21
21
|
def to_hash
|
22
22
|
single_element_array(committee.map { |c| { "committee" => c } })
|
23
23
|
end
|
24
|
+
|
25
|
+
# @param prefix [String]
|
26
|
+
# @return [String]
|
27
|
+
def to_asciibib(prefix)
|
28
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
29
|
+
pref += "editorialgroup"
|
30
|
+
committee.map { |c| "#{pref}.committee:: #{c}\n" }.join
|
31
|
+
end
|
24
32
|
end
|
25
33
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RelatonUn
|
2
|
-
class HashConverter <
|
2
|
+
class HashConverter < RelatonBib::HashConverter
|
3
3
|
class << self
|
4
4
|
# @override RelatonIsoBib::HashConverter.hash_to_bib
|
5
5
|
# @param args [Hash]
|
@@ -9,6 +9,7 @@ module RelatonUn
|
|
9
9
|
ret = super
|
10
10
|
return if ret.nil?
|
11
11
|
|
12
|
+
ret[:submissionlanguage] = array ret[:submissionlanguage]
|
12
13
|
session_hash_to_bib ret
|
13
14
|
ret
|
14
15
|
end
|
data/lib/relaton_un/hit.rb
CHANGED
@@ -59,7 +59,7 @@ module RelatonUn
|
|
59
59
|
# rubocop:disable Metrics/MethodLength
|
60
60
|
|
61
61
|
# @return [RelatonUn::UnBibliographicItem]
|
62
|
-
def un_bib_item
|
62
|
+
def un_bib_item # rubocop:disable Metrics/AbcSize
|
63
63
|
UnBibliographicItem.new(
|
64
64
|
type: "standard",
|
65
65
|
fetched: Date.today.to_s,
|
@@ -75,6 +75,7 @@ module RelatonUn
|
|
75
75
|
distribution: fetch_distribution,
|
76
76
|
editorialgroup: fetch_editorialgroup,
|
77
77
|
classification: fetch_classification,
|
78
|
+
job_number: hit[:job_number]
|
78
79
|
)
|
79
80
|
end
|
80
81
|
# rubocop:enable Metrics/MethodLength
|
@@ -88,11 +89,7 @@ module RelatonUn
|
|
88
89
|
|
89
90
|
# @return [Array<RelatonBib::TypedTitleString>]
|
90
91
|
def fetch_title
|
91
|
-
|
92
|
-
# content: hit[:title], language: "en", script: "Latn",
|
93
|
-
# )
|
94
|
-
# [RelatonBib::TypedTitleString.new(type: "main", title: fs)]
|
95
|
-
[{ title_main: hit[:title], language: "en", script: "Latn" }]
|
92
|
+
RelatonBib::TypedTitleString.from_string hit[:title], "en", "Latn"
|
96
93
|
end
|
97
94
|
|
98
95
|
# @return [Array<RelatonBib::BibliographicDate>]
|
@@ -134,7 +131,7 @@ module RelatonUn
|
|
134
131
|
def fetch_editorialgroup
|
135
132
|
tc = hit[:ref].match(/^[\S]+/).to_s.split(/\/|-/).reduce([]) do |m, v|
|
136
133
|
if BODY[v] then m << BODY[v]
|
137
|
-
elsif v
|
134
|
+
elsif v.match? /(AC|C|CN|CONF|GC|SC|Sub|WG).\d+|PC/ then m << v
|
138
135
|
else m
|
139
136
|
end
|
140
137
|
end.uniq
|
@@ -48,12 +48,12 @@ module RelatonUn
|
|
48
48
|
# @param form [Nokogiri::HTML::Document]
|
49
49
|
# @param text [String]
|
50
50
|
# @return [Array<String>]
|
51
|
-
def form_data(form, text)
|
51
|
+
def form_data(form, text) # rubocop:disable Metrics/CyclomaticComplexity
|
52
52
|
fd = form.xpath(
|
53
53
|
"//input[@type!='radio']",
|
54
54
|
"//input[@type='radio'][@checked]",
|
55
55
|
"//select[@name!='view:_id1:_id2:cbLang']",
|
56
|
-
"//textarea"
|
56
|
+
"//textarea"
|
57
57
|
).reduce([]) do |m, i|
|
58
58
|
v = case i[:name]
|
59
59
|
when "view:_id1:_id2:txtSymbol" then text
|
@@ -91,7 +91,7 @@ module RelatonUn
|
|
91
91
|
|
92
92
|
# @param item [Nokogiri::XML::Element]
|
93
93
|
# @return [Hash]
|
94
|
-
def hit_data(item)
|
94
|
+
def hit_data(item) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
95
95
|
en = item.at("//span[.='ENGLISH']/../..")
|
96
96
|
{
|
97
97
|
ref: item.at("div/div/a")&.text&.sub("\u00A0", ""),
|
@@ -103,7 +103,8 @@ module RelatonUn
|
|
103
103
|
link: link(en),
|
104
104
|
session: session(item),
|
105
105
|
agenda: agenda(item),
|
106
|
-
distribution: distribution(item)
|
106
|
+
distribution: distribution(item),
|
107
|
+
job_number: job_number(item),
|
107
108
|
}
|
108
109
|
end
|
109
110
|
|
@@ -155,6 +156,10 @@ module RelatonUn
|
|
155
156
|
item.at("//label[.='Distribution:']/following-sibling::span")&.text
|
156
157
|
end
|
157
158
|
|
159
|
+
def job_number(item)
|
160
|
+
item.at("//span[contains(@id, 'cfJobNumE')]")&.text
|
161
|
+
end
|
162
|
+
|
158
163
|
# rubocop:disable Metrics/MethodLength
|
159
164
|
|
160
165
|
# @param req [Net::HTTP::Get, Net::HTTP::Post]
|
data/lib/relaton_un/processor.rb
CHANGED
@@ -29,7 +29,7 @@ module RelatonUn
|
|
29
29
|
# @return [RelatonIsoBib::IsoBibliographicItem]
|
30
30
|
def hash_to_bib(hash)
|
31
31
|
item_hash = ::RelatonUn::HashConverter.hash_to_bib(hash)
|
32
|
-
::
|
32
|
+
::RelatonUn::UnBibliographicItem.new item_hash
|
33
33
|
end
|
34
34
|
|
35
35
|
# Returns hash of XML grammar
|
data/lib/relaton_un/session.rb
CHANGED
@@ -3,7 +3,7 @@ module RelatonUn
|
|
3
3
|
include RelatonBib
|
4
4
|
|
5
5
|
# @return [String, NilClass]
|
6
|
-
attr_reader :session_number, :
|
6
|
+
attr_reader :session_number, :collaborator, :agenda_id, :item_footnote
|
7
7
|
|
8
8
|
# @return [Date, NilClass]
|
9
9
|
attr_reader :session_date
|
@@ -16,7 +16,7 @@ module RelatonUn
|
|
16
16
|
# @param item_number [Array<String>]
|
17
17
|
# @pqrqm item_name [Array<String>]
|
18
18
|
# @pqrqm subitem_name [Array<String>]
|
19
|
-
# @param
|
19
|
+
# @param collaborator [String]
|
20
20
|
# @param agenda_id [String]
|
21
21
|
# @param item_footnote [String]
|
22
22
|
def initialize(**args)
|
@@ -25,12 +25,12 @@ module RelatonUn
|
|
25
25
|
@item_number = args.fetch(:item_number, [])
|
26
26
|
@item_name = args.fetch(:item_name, [])
|
27
27
|
@subitem_name = args.fetch(:subitem_name, [])
|
28
|
-
@
|
28
|
+
@collaborator = args[:collaborator]
|
29
29
|
@agenda_id = args[:agenda_id]
|
30
30
|
@item_footnote = args[:item_footnote]
|
31
31
|
end
|
32
32
|
|
33
|
-
# rubocop:disable Metrics/AbcSize
|
33
|
+
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
|
34
34
|
|
35
35
|
# @param [Nokogiri::XML::Builder]
|
36
36
|
def to_xml(builder)
|
@@ -40,26 +40,48 @@ module RelatonUn
|
|
40
40
|
item_number.each { |n| b.send "item-number", n }
|
41
41
|
item_name.each { |n| b.send "item-name", n }
|
42
42
|
subitem_name.each { |n| b.send "subitem-name", n }
|
43
|
-
b.
|
43
|
+
b.collaborator collaborator if collaborator
|
44
44
|
b.send "agenda-id", agenda_id if agenda_id
|
45
45
|
b.send "item-footnote", item_footnote if item_footnote
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
# rubocop:disable Metrics/
|
49
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/MethodLength
|
50
50
|
# @return [Hash]
|
51
51
|
def to_hash
|
52
52
|
hash = {}
|
53
53
|
hash["session_number"] = session_number if session_number
|
54
54
|
hash["session_date"] = session_date.to_s if session_date
|
55
|
-
|
55
|
+
if item_number.any?
|
56
|
+
hash["item_number"] = single_element_array(item_number)
|
57
|
+
end
|
56
58
|
hash["item_name"] = single_element_array(item_name) if item_name.any?
|
57
|
-
|
58
|
-
|
59
|
+
if subitem_name.any?
|
60
|
+
hash["subitem_name"] = single_element_array(subitem_name)
|
61
|
+
end
|
62
|
+
hash["collaborator"] = collaborator if collaborator
|
59
63
|
hash["agenda_id"] = agenda_id if agenda_id
|
60
64
|
hash["item_footnote"] = item_footnote if item_footnote
|
61
65
|
hash
|
62
66
|
end
|
63
|
-
# rubocop:enable Metrics/
|
67
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
68
|
+
|
69
|
+
# @param prefix [String]
|
70
|
+
# @return [String]
|
71
|
+
def to_asciibib(prefix = "")
|
72
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
73
|
+
pref += "session"
|
74
|
+
out = ""
|
75
|
+
out += "#{pref}.session_number:: #{session_number}\n" if session_number
|
76
|
+
out += "#{pref}.session_date:: #{session_date}\n" if session_date
|
77
|
+
item_number.each { |n| out += "#{pref}.item_number:: #{n}\n" }
|
78
|
+
item_name.each { |n| out += "#{pref}.item_name:: #{n}\n" }
|
79
|
+
subitem_name.each { |n| out += "#{pref}.subitem_name:: #{n}\n" }
|
80
|
+
out += "#{pref}.collaborator:: #{collaborator}\n" if collaborator
|
81
|
+
out += "#{pref}.agenda_id:: #{agenda_id}\n" if agenda_id
|
82
|
+
out += "#{pref}.item_footnote:: #{item_footnote}\n" if item_footnote
|
83
|
+
out
|
84
|
+
end
|
85
|
+
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/MethodLength
|
64
86
|
end
|
65
87
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module RelatonUn
|
2
|
-
class UnBibliographicItem <
|
2
|
+
class UnBibliographicItem < RelatonBib::BibliographicItem
|
3
|
+
include RelatonBib
|
4
|
+
|
3
5
|
TYPES = %w[
|
4
6
|
recommendation plenary addendum communication corrigendum reissue agenda
|
5
7
|
budgetary sec-gen-notes expert-report resolution
|
@@ -12,33 +14,66 @@ module RelatonUn
|
|
12
14
|
attr_reader :session
|
13
15
|
|
14
16
|
# @return [String, NilClass]
|
15
|
-
attr_reader :distribution
|
17
|
+
attr_reader :distribution, :job_number
|
18
|
+
|
19
|
+
# @return [Array<String>]
|
20
|
+
attr_reader :submissionlanguage
|
16
21
|
|
17
22
|
# @param session [RelatonUn::Session, NilClass]
|
18
|
-
# @param distribution [String]
|
23
|
+
# @param distribution [String, nil]
|
24
|
+
# @param job_number [String, nil]
|
19
25
|
def initialize(**args)
|
20
26
|
if args[:distribution] && !DISTRIBUTIONS.has_value?(args[:distribution])
|
21
|
-
warn "[relaton-un] WARNING: invalid distribution:
|
27
|
+
warn "[relaton-un] WARNING: invalid distribution: "\
|
28
|
+
"#{args[:distribution]}"
|
22
29
|
end
|
30
|
+
@submissionlanguage = args.delete :submissionlanguage
|
23
31
|
@distribution = args.delete :distribution
|
24
32
|
@session = args.delete :session
|
33
|
+
@job_number = args.delete :job_number
|
25
34
|
super **args
|
26
35
|
end
|
27
36
|
|
28
37
|
# @param builder [Nokogiri::XML::Builder]
|
29
38
|
# @param bibdata [TrueClasss, FalseClass, NilClass]
|
30
|
-
def to_xml(builder = nil, **opts)
|
39
|
+
def to_xml(builder = nil, **opts) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
31
40
|
super(builder, **opts) do |b|
|
32
|
-
b.
|
33
|
-
|
41
|
+
b.ext do
|
42
|
+
b.doctype doctype if doctype
|
43
|
+
submissionlanguage&.each { |sl| b.submissionlanguage sl }
|
44
|
+
editorialgroup&.to_xml b
|
45
|
+
ics&.each { |i| i.to_xml b }
|
46
|
+
b.distribution distribution if distribution
|
47
|
+
session&.to_xml b if session
|
48
|
+
b.job_number job_number if job_number
|
49
|
+
end
|
34
50
|
end
|
35
51
|
end
|
36
52
|
|
37
53
|
# @return [Hash]
|
38
54
|
def to_hash
|
39
55
|
hash = super
|
56
|
+
if submissionlanguage&.any?
|
57
|
+
hash["submissionlanguage"] = single_element_array submissionlanguage
|
58
|
+
end
|
59
|
+
hash["distribution"] = distribution if distribution
|
40
60
|
hash["session"] = session.to_hash if session
|
61
|
+
hash["job_number"] = job_number if job_number
|
41
62
|
hash
|
42
63
|
end
|
64
|
+
|
65
|
+
# @param prefix [String]
|
66
|
+
# @return [String]
|
67
|
+
def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
|
68
|
+
pref = prefix.empty? ? prefix : prefix + "."
|
69
|
+
out = super
|
70
|
+
submissionlanguage.each do |sl|
|
71
|
+
out += "#{pref}submissionlanguage:: #{sl}\n"
|
72
|
+
end
|
73
|
+
out += "#{pref}distribution:: #{distribution}\n" if distribution
|
74
|
+
out += session.to_asciibib prefix if session
|
75
|
+
out += "#{pref}job_number:: #{job_number}\n" if job_number
|
76
|
+
out
|
77
|
+
end
|
43
78
|
end
|
44
79
|
end
|
data/lib/relaton_un/version.rb
CHANGED
@@ -1,48 +1,43 @@
|
|
1
1
|
module RelatonUn
|
2
|
-
class XMLParser <
|
2
|
+
class XMLParser < RelatonBib::XMLParser
|
3
3
|
class << self
|
4
|
-
# @param xml [String]
|
5
|
-
# @return [RelatonUn::UnBibliographicItem, NilClass]
|
6
|
-
def from_xml(xml)
|
7
|
-
doc = Nokogiri::XML xml
|
8
|
-
doc.remove_namespaces!
|
9
|
-
item = doc.at("/bibitem|/bibdata")
|
10
|
-
if item
|
11
|
-
UnBibliographicItem.new(item_data(item))
|
12
|
-
else
|
13
|
-
warn "[relaton-un] WARNING: can't find bibitem or bibdata element in"\
|
14
|
-
" the XML"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
4
|
private
|
19
5
|
|
6
|
+
# @param item_hash [Hash]
|
7
|
+
# @return [RelatonBib::BibliographicItem]
|
8
|
+
def bib_item(item_hash)
|
9
|
+
UnBibliographicItem.new item_hash
|
10
|
+
end
|
11
|
+
|
20
12
|
# @param item [Nokogiri::XML::Element]
|
21
13
|
# @return [Hash]
|
22
14
|
def item_data(item)
|
23
15
|
data = super
|
24
|
-
|
25
|
-
data
|
16
|
+
ext = item.at "./ext"
|
17
|
+
return data unless ext
|
18
|
+
|
19
|
+
data[:submissionlanguage] = fetch_submissionlanguage ext
|
20
|
+
data[:session] = fetch_session ext
|
21
|
+
data[:distribution] = ext.at("distribution")&.text
|
22
|
+
data[:job_number] = ext.at("job_number")&.text
|
26
23
|
data
|
27
24
|
end
|
28
25
|
|
29
26
|
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
30
27
|
|
31
|
-
# @param
|
28
|
+
# @param ext [Nokogiri::XML::Element]
|
32
29
|
# @return [RelatonUn::Session]
|
33
|
-
def fetch_session(
|
34
|
-
session =
|
35
|
-
return unless session
|
36
|
-
|
30
|
+
def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity
|
31
|
+
session = ext.at "./session"
|
37
32
|
RelatonUn::Session.new(
|
38
33
|
session_number: session.at("number")&.text,
|
39
34
|
session_date: session.at("session-date")&.text,
|
40
35
|
item_number: session.xpath("item-number").map(&:text),
|
41
36
|
item_name: session.xpath("item-name").map(&:text),
|
42
37
|
subitem_name: session.xpath("subitem-name").map(&:text),
|
43
|
-
|
38
|
+
collaborator: session.at("collaborator")&.text,
|
44
39
|
agenda_id: session.at("agenda-id")&.text,
|
45
|
-
item_footnote: session.at("item-footnote")&.text
|
40
|
+
item_footnote: session.at("item-footnote")&.text
|
46
41
|
)
|
47
42
|
end
|
48
43
|
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
@@ -53,9 +48,15 @@ module RelatonUn
|
|
53
48
|
eg = ext.at("./editorialgroup")
|
54
49
|
return unless eg
|
55
50
|
|
56
|
-
committee = eg
|
51
|
+
committee = eg.xpath("committee").map &:text
|
57
52
|
EditorialGroup.new committee
|
58
53
|
end
|
54
|
+
|
55
|
+
# @param ext [Nokogiri::XML::Element]
|
56
|
+
# @return [Array<String>]
|
57
|
+
def fetch_submissionlanguage(ext)
|
58
|
+
ext.xpath("./submissionlanguage").map(&:text)
|
59
|
+
end
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
data/relaton_un.gemspec
CHANGED
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
|
44
44
|
spec.add_dependency "faraday"
|
45
45
|
spec.add_dependency "http-cookie"
|
46
|
-
spec.add_dependency "relaton-
|
46
|
+
spec.add_dependency "relaton-bib", "~> 1.3.0"
|
47
47
|
spec.add_dependency "unf_ext", ">= 0.0.7.7"
|
48
48
|
end
|
49
49
|
# rubocop:enable Metrics/BlockLength
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-un
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.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
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: debase
|
@@ -151,19 +151,19 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name: relaton-
|
154
|
+
name: relaton-bib
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 1.
|
159
|
+
version: 1.3.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.3.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: unf_ext
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|