relaton-un 0.2.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/grammars/biblio.rng +145 -50
- data/grammars/isodoc.rng +481 -5
- data/grammars/un.rng +112 -0
- data/lib/relaton_un.rb +1 -1
- data/lib/relaton_un/hash_converter.rb +2 -1
- data/lib/relaton_un/hit.rb +8 -5
- data/lib/relaton_un/hit_collection.rb +6 -1
- data/lib/relaton_un/processor.rb +1 -1
- data/lib/relaton_un/un_bibliographic_item.rb +26 -6
- data/lib/relaton_un/version.rb +1 -1
- data/lib/relaton_un/xml_parser.rb +24 -23
- data/relaton_un.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd7b73723491abfe38ea7c1018dbb1844114f5c22160dd11af15cd6a858e899
|
4
|
+
data.tar.gz: ef0e87e1c151a3affb21b16d3257b7d5a025fbbe81354749f1b21897532b4b9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8347b35ddab7041cf6c7478457731d9e76ae8e84acfb9bbe9d10e17fcec7cbe71aeb3f7ef2e35b979ceb544066c7c7a2ea302dde95796a092f1115391b97587c
|
7
|
+
data.tar.gz: 7b003c2eb2f8c3baa4110c01292d68d044a19359a30b297ee885080db0e979f587e59f7478733c15376de4dc4dad92a7c16d7292ef3fb92a76019808341210d9
|
data/grammars/biblio.rng
CHANGED
@@ -49,11 +49,17 @@
|
|
49
49
|
</define>
|
50
50
|
<define name="stage">
|
51
51
|
<element name="stage">
|
52
|
+
<optional>
|
53
|
+
<attribute name="abbreviation"/>
|
54
|
+
</optional>
|
52
55
|
<text/>
|
53
56
|
</element>
|
54
57
|
</define>
|
55
58
|
<define name="substage">
|
56
59
|
<element name="substage">
|
60
|
+
<optional>
|
61
|
+
<attribute name="abbreviation"/>
|
62
|
+
</optional>
|
57
63
|
<text/>
|
58
64
|
</element>
|
59
65
|
</define>
|
@@ -82,7 +88,7 @@
|
|
82
88
|
<text/>
|
83
89
|
</element>
|
84
90
|
</define>
|
85
|
-
<define name="
|
91
|
+
<define name="LocalizedString1">
|
86
92
|
<optional>
|
87
93
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
88
94
|
<attribute name="language"/>
|
@@ -92,6 +98,16 @@
|
|
92
98
|
</optional>
|
93
99
|
<text/>
|
94
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>
|
95
111
|
<!--
|
96
112
|
Unlike UML, change type to format: type is overloaded
|
97
113
|
Would be need if plain were default value and could omit the attribute
|
@@ -115,7 +131,7 @@
|
|
115
131
|
</optional>
|
116
132
|
<ref name="LocalizedStringOrXsAny"/>
|
117
133
|
</define>
|
118
|
-
<define name="
|
134
|
+
<define name="LocalizedStringOrXsAny1">
|
119
135
|
<optional>
|
120
136
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
121
137
|
<attribute name="language"/>
|
@@ -130,6 +146,16 @@
|
|
130
146
|
</choice>
|
131
147
|
</oneOrMore>
|
132
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>
|
133
159
|
<define name="contributor">
|
134
160
|
<element name="contributor">
|
135
161
|
<zeroOrMore>
|
@@ -452,9 +478,14 @@
|
|
452
478
|
<attribute name="bibitemid">
|
453
479
|
<data type="IDREF"/>
|
454
480
|
</attribute>
|
455
|
-
<
|
456
|
-
<
|
457
|
-
|
481
|
+
<choice>
|
482
|
+
<zeroOrMore>
|
483
|
+
<ref name="locality"/>
|
484
|
+
</zeroOrMore>
|
485
|
+
<zeroOrMore>
|
486
|
+
<ref name="localityStack"/>
|
487
|
+
</zeroOrMore>
|
488
|
+
</choice>
|
458
489
|
<optional>
|
459
490
|
<ref name="date"/>
|
460
491
|
</optional>
|
@@ -469,6 +500,25 @@
|
|
469
500
|
<ref name="BibItemLocality"/>
|
470
501
|
</element>
|
471
502
|
</define>
|
503
|
+
<define name="localityStack">
|
504
|
+
<element name="localityStack">
|
505
|
+
<zeroOrMore>
|
506
|
+
<ref name="locality"/>
|
507
|
+
</zeroOrMore>
|
508
|
+
</element>
|
509
|
+
</define>
|
510
|
+
<define name="sourceLocality">
|
511
|
+
<element name="sourceLocality">
|
512
|
+
<ref name="BibItemLocality"/>
|
513
|
+
</element>
|
514
|
+
</define>
|
515
|
+
<define name="sourceLocalityStack">
|
516
|
+
<element name="sourceLocalityStack">
|
517
|
+
<zeroOrMore>
|
518
|
+
<ref name="sourceLocality"/>
|
519
|
+
</zeroOrMore>
|
520
|
+
</element>
|
521
|
+
</define>
|
472
522
|
<define name="BibItemLocality">
|
473
523
|
<attribute name="type">
|
474
524
|
<ref name="LocalityType"/>
|
@@ -482,7 +532,7 @@
|
|
482
532
|
</define>
|
483
533
|
<define name="LocalityType">
|
484
534
|
<data type="string">
|
485
|
-
<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>
|
486
536
|
</data>
|
487
537
|
</define>
|
488
538
|
<define name="referenceFrom">
|
@@ -611,9 +661,9 @@
|
|
611
661
|
<optional>
|
612
662
|
<ref name="status"/>
|
613
663
|
</optional>
|
614
|
-
<
|
664
|
+
<zeroOrMore>
|
615
665
|
<ref name="copyright"/>
|
616
|
-
</
|
666
|
+
</zeroOrMore>
|
617
667
|
<zeroOrMore>
|
618
668
|
<ref name="docrelation"/>
|
619
669
|
</zeroOrMore>
|
@@ -703,21 +753,11 @@
|
|
703
753
|
</define>
|
704
754
|
<define name="TypedTitleString">
|
705
755
|
<optional>
|
706
|
-
<attribute name="type"
|
707
|
-
<ref name="TitleType"/>
|
708
|
-
</attribute>
|
756
|
+
<attribute name="type"/>
|
709
757
|
</optional>
|
710
758
|
<ref name="FormattedString"/>
|
711
759
|
</define>
|
712
|
-
|
713
|
-
<choice>
|
714
|
-
<value>alternative</value>
|
715
|
-
<value>original</value>
|
716
|
-
<value>unofficial</value>
|
717
|
-
<value>subtitle</value>
|
718
|
-
<value>main</value>
|
719
|
-
</choice>
|
720
|
-
</define>
|
760
|
+
<!-- TitleType = ( "alternative" | "original" | "unofficial" | "subtitle" | "main" ) -->
|
721
761
|
<define name="TypedUri">
|
722
762
|
<optional>
|
723
763
|
<attribute name="type"/>
|
@@ -747,6 +787,8 @@
|
|
747
787
|
<value>unchanged</value>
|
748
788
|
<value>circulated</value>
|
749
789
|
<value>adapted</value>
|
790
|
+
<value>vote-started</value>
|
791
|
+
<value>vote-ended</value>
|
750
792
|
</choice>
|
751
793
|
</define>
|
752
794
|
<define name="bdate">
|
@@ -979,7 +1021,17 @@
|
|
979
1021
|
<optional>
|
980
1022
|
<ref name="to"/>
|
981
1023
|
</optional>
|
982
|
-
<
|
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/>
|
983
1035
|
</element>
|
984
1036
|
</define>
|
985
1037
|
<define name="from">
|
@@ -999,38 +1051,63 @@
|
|
999
1051
|
</define>
|
1000
1052
|
<define name="DocRelationType">
|
1001
1053
|
<choice>
|
1002
|
-
<value>obsoletes</value>
|
1003
|
-
<value>obsoletedBy</value>
|
1004
|
-
<value>supersedes</value>
|
1005
|
-
<value>supersededBy</value>
|
1006
|
-
<value>updates</value>
|
1007
|
-
<value>updatedBy</value>
|
1008
|
-
<value>complements</value>
|
1009
|
-
<value>derivedFrom</value>
|
1010
|
-
<value>translatedFrom</value>
|
1011
|
-
<value>hasTranslation</value>
|
1012
|
-
<value>adoptedFrom</value>
|
1013
|
-
<value>equivalent</value>
|
1014
|
-
<value>identical</value>
|
1015
|
-
<value>nonequivalent</value>
|
1016
|
-
<value>includedIn</value>
|
1017
1054
|
<value>includes</value>
|
1018
|
-
<value>
|
1019
|
-
<value>instanceOf</value>
|
1020
|
-
<value>partOf</value>
|
1055
|
+
<value>includedIn</value>
|
1021
1056
|
<value>hasPart</value>
|
1022
|
-
<value>
|
1023
|
-
<value>draftOf</value>
|
1057
|
+
<value>partOf</value>
|
1024
1058
|
<value>merges</value>
|
1059
|
+
<value>mergedInto</value>
|
1025
1060
|
<value>splits</value>
|
1026
|
-
<value>
|
1027
|
-
<value>
|
1028
|
-
<value>
|
1029
|
-
<value>
|
1030
|
-
<value>
|
1031
|
-
<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>
|
1032
1090
|
<value>describes</value>
|
1033
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>
|
1034
1111
|
</choice>
|
1035
1112
|
</define>
|
1036
1113
|
<define name="docrelation">
|
@@ -1038,12 +1115,30 @@
|
|
1038
1115
|
<attribute name="type">
|
1039
1116
|
<ref name="DocRelationType"/>
|
1040
1117
|
</attribute>
|
1118
|
+
<optional>
|
1119
|
+
<element name="description">
|
1120
|
+
<ref name="FormattedString"/>
|
1121
|
+
</element>
|
1122
|
+
</optional>
|
1041
1123
|
<element name="bibitem">
|
1042
1124
|
<ref name="BibliographicItem"/>
|
1043
1125
|
</element>
|
1044
|
-
<
|
1045
|
-
<
|
1046
|
-
|
1126
|
+
<choice>
|
1127
|
+
<zeroOrMore>
|
1128
|
+
<ref name="locality"/>
|
1129
|
+
</zeroOrMore>
|
1130
|
+
<zeroOrMore>
|
1131
|
+
<ref name="localityStack"/>
|
1132
|
+
</zeroOrMore>
|
1133
|
+
</choice>
|
1134
|
+
<choice>
|
1135
|
+
<zeroOrMore>
|
1136
|
+
<ref name="sourceLocality"/>
|
1137
|
+
</zeroOrMore>
|
1138
|
+
<zeroOrMore>
|
1139
|
+
<ref name="sourceLocalityStack"/>
|
1140
|
+
</zeroOrMore>
|
1141
|
+
</choice>
|
1047
1142
|
</element>
|
1048
1143
|
</define>
|
1049
1144
|
<define name="version">
|
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>
|
@@ -101,9 +491,7 @@
|
|
101
491
|
<ref name="structuredidentifier"/>
|
102
492
|
</zeroOrMore>
|
103
493
|
</define>
|
104
|
-
|
105
|
-
<text/>
|
106
|
-
</define>
|
494
|
+
<!-- TitleType = text -->
|
107
495
|
<define name="sections">
|
108
496
|
<element name="sections">
|
109
497
|
<oneOrMore>
|
@@ -131,6 +519,9 @@
|
|
131
519
|
</choice>
|
132
520
|
</attribute>
|
133
521
|
</optional>
|
522
|
+
<attribute name="normative">
|
523
|
+
<data type="boolean"/>
|
524
|
+
</attribute>
|
134
525
|
<optional>
|
135
526
|
<ref name="section-title"/>
|
136
527
|
</optional>
|
@@ -156,6 +547,30 @@
|
|
156
547
|
<attribute name="id">
|
157
548
|
<data type="ID"/>
|
158
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>
|
159
574
|
<oneOrMore>
|
160
575
|
<choice>
|
161
576
|
<ref name="paragraph"/>
|
@@ -307,6 +722,21 @@
|
|
307
722
|
</define>
|
308
723
|
</include>
|
309
724
|
<!-- end overrides -->
|
725
|
+
<define name="TextElement" combine="choice">
|
726
|
+
<ref name="concept"/>
|
727
|
+
</define>
|
728
|
+
<define name="concept">
|
729
|
+
<element name="concept">
|
730
|
+
<optional>
|
731
|
+
<attribute name="term"/>
|
732
|
+
</optional>
|
733
|
+
<choice>
|
734
|
+
<ref name="eref"/>
|
735
|
+
<ref name="xref"/>
|
736
|
+
<ref name="termref"/>
|
737
|
+
</choice>
|
738
|
+
</element>
|
739
|
+
</define>
|
310
740
|
<define name="BasicBlock" combine="choice">
|
311
741
|
<choice>
|
312
742
|
<ref name="requirement"/>
|
@@ -645,6 +1075,11 @@
|
|
645
1075
|
<optional>
|
646
1076
|
<attribute name="script"/>
|
647
1077
|
</optional>
|
1078
|
+
<optional>
|
1079
|
+
<attribute name="inline-header">
|
1080
|
+
<data type="boolean"/>
|
1081
|
+
</attribute>
|
1082
|
+
</optional>
|
648
1083
|
<optional>
|
649
1084
|
<attribute name="obligation">
|
650
1085
|
<choice>
|
@@ -881,7 +1316,36 @@
|
|
881
1316
|
<attribute name="id">
|
882
1317
|
<data type="ID"/>
|
883
1318
|
</attribute>
|
884
|
-
<
|
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>
|
885
1349
|
</element>
|
886
1350
|
</define>
|
887
1351
|
<define name="termexample">
|
@@ -908,7 +1372,10 @@
|
|
908
1372
|
</define>
|
909
1373
|
<define name="origin">
|
910
1374
|
<element name="origin">
|
911
|
-
<
|
1375
|
+
<choice>
|
1376
|
+
<ref name="erefType"/>
|
1377
|
+
<ref name="termref"/>
|
1378
|
+
</choice>
|
912
1379
|
</element>
|
913
1380
|
</define>
|
914
1381
|
<define name="modification">
|
@@ -916,6 +1383,15 @@
|
|
916
1383
|
<ref name="paragraph"/>
|
917
1384
|
</element>
|
918
1385
|
</define>
|
1386
|
+
<define name="termref">
|
1387
|
+
<element name="termref">
|
1388
|
+
<attribute name="base"/>
|
1389
|
+
<attribute name="target"/>
|
1390
|
+
<optional>
|
1391
|
+
<text/>
|
1392
|
+
</optional>
|
1393
|
+
</element>
|
1394
|
+
</define>
|
919
1395
|
<define name="structuredidentifier">
|
920
1396
|
<element name="structuredidentifier">
|
921
1397
|
<optional>
|
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">
|
@@ -223,9 +329,15 @@
|
|
223
329
|
<value>general</value>
|
224
330
|
<value>limited</value>
|
225
331
|
<value>restricted</value>
|
332
|
+
<value>provisional</value>
|
226
333
|
</choice>
|
227
334
|
</element>
|
228
335
|
</define>
|
336
|
+
<define name="job_number">
|
337
|
+
<element name="job_number">
|
338
|
+
<text/>
|
339
|
+
</element>
|
340
|
+
</define>
|
229
341
|
<define name="un-standard">
|
230
342
|
<element name="un-standard">
|
231
343
|
<ref name="bibdata"/>
|
data/lib/relaton_un.rb
CHANGED
@@ -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
@@ -74,6 +74,8 @@ module RelatonUn
|
|
74
74
|
session: fetch_session,
|
75
75
|
distribution: fetch_distribution,
|
76
76
|
editorialgroup: fetch_editorialgroup,
|
77
|
+
classification: fetch_classification,
|
78
|
+
job_number: hit[:job_number],
|
77
79
|
)
|
78
80
|
end
|
79
81
|
# rubocop:enable Metrics/MethodLength
|
@@ -87,11 +89,7 @@ module RelatonUn
|
|
87
89
|
|
88
90
|
# @return [Array<RelatonBib::TypedTitleString>]
|
89
91
|
def fetch_title
|
90
|
-
|
91
|
-
# content: hit[:title], language: "en", script: "Latn",
|
92
|
-
# )
|
93
|
-
# [RelatonBib::TypedTitleString.new(type: "main", title: fs)]
|
94
|
-
[{ title_main: hit[:title], language: "en", script: "Latn" }]
|
92
|
+
RelatonBib::TypedTitleString.from_string hit[:title], "en", "Latn"
|
95
93
|
end
|
96
94
|
|
97
95
|
# @return [Array<RelatonBib::BibliographicDate>]
|
@@ -141,5 +139,10 @@ module RelatonUn
|
|
141
139
|
|
142
140
|
RelatonUn::EditorialGroup.new tc
|
143
141
|
end
|
142
|
+
|
143
|
+
# @return [Array<RelatonBib::Classification>]
|
144
|
+
def fetch_classification
|
145
|
+
[RelatonBib::Classification.new(type: "area", value: "UNDOC")]
|
146
|
+
end
|
144
147
|
end
|
145
148
|
end
|
@@ -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
|
@@ -1,27 +1,35 @@
|
|
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
|
6
8
|
].freeze
|
7
9
|
|
8
10
|
DISTRIBUTIONS = { "GEN" => "general", "LTD" => "limited",
|
9
|
-
"DER" => "restricted" }.freeze
|
11
|
+
"DER" => "restricted", "PRO" => "provisional" }.freeze
|
10
12
|
|
11
13
|
# @return [RelatonUn::Session, NilClass]
|
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
27
|
warn "[relaton-un] WARNING: invalid distribution: #{args[:distribution]}"
|
22
28
|
end
|
29
|
+
@submissionlanguage = args.delete :submissionlanguage
|
23
30
|
@distribution = args.delete :distribution
|
24
31
|
@session = args.delete :session
|
32
|
+
@job_number = args.delete :job_number
|
25
33
|
super **args
|
26
34
|
end
|
27
35
|
|
@@ -29,15 +37,27 @@ module RelatonUn
|
|
29
37
|
# @param bibdata [TrueClasss, FalseClass, NilClass]
|
30
38
|
def to_xml(builder = nil, **opts)
|
31
39
|
super(builder, **opts) do |b|
|
32
|
-
b.
|
33
|
-
|
40
|
+
b.ext do
|
41
|
+
b.doctype doctype if doctype
|
42
|
+
submissionlanguage&.each { |sl| b.submissionlanguage sl }
|
43
|
+
editorialgroup&.to_xml b
|
44
|
+
ics&.each { |i| i.to_xml b }
|
45
|
+
b.distribution distribution if distribution
|
46
|
+
session&.to_xml b if session
|
47
|
+
b.job_number job_number if job_number
|
48
|
+
end
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
37
52
|
# @return [Hash]
|
38
53
|
def to_hash
|
39
54
|
hash = super
|
55
|
+
if submissionlanguage&.any?
|
56
|
+
hash["submissionlanguage"] = single_element_array submissionlanguage
|
57
|
+
end
|
58
|
+
hash["distribution"] = distribution if distribution
|
40
59
|
hash["session"] = session.to_hash if session
|
60
|
+
hash["job_number"] = job_number if job_number
|
41
61
|
hash
|
42
62
|
end
|
43
63
|
end
|
data/lib/relaton_un/version.rb
CHANGED
@@ -1,39 +1,34 @@
|
|
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)
|
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,
|
@@ -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.2.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:
|
4
|
+
version: 1.2.1
|
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-06-27 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:
|
159
|
+
version: 1.2.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:
|
166
|
+
version: 1.2.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: unf_ext
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|