relaton-un 1.7.1 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +3 -1
- data/README.adoc +12 -0
- data/grammars/basicdoc.rng +191 -27
- data/grammars/biblio.rng +7 -8
- data/grammars/isodoc.rng +1156 -112
- data/grammars/reqt.rng +46 -6
- data/grammars/un.rng +21 -17
- data/lib/relaton_un/hit.rb +5 -5
- data/lib/relaton_un/processor.rb +1 -1
- data/lib/relaton_un/un_bibliographic_item.rb +4 -4
- data/lib/relaton_un/un_bibliography.rb +3 -3
- data/lib/relaton_un/version.rb +1 -1
- data/lib/relaton_un/xml_parser.rb +3 -3
- data/relaton_un.gemspec +2 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8cddb509c1d3493c6e33544358f4e1826e2431f3fc1425c5a101e8fc30ed3bf
|
4
|
+
data.tar.gz: 0a9090a2aa04fe9fa9432fbc5ea96ff66db4a1345becf4db6c4cb92baa3e2a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86723673e87178d39bb6b41208d33820e8d518e2db675b1f7e5cc3afa6340603868332281b08e5d42c2200a0e8f63ce379476746453ffe7accc0098f6607d999
|
7
|
+
data.tar.gz: 63e99c6607c427466c13e68304b067d0e76b250e766eb0c5407609c47f96d28ac7bef78ee62f66ed97b5a58520473343b46d5b2eefe5dac47df200ec22376d71
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,19 +16,9 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '
|
19
|
+
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
|
-
include:
|
23
|
-
- ruby: '3.0'
|
24
|
-
os: 'ubuntu-latest'
|
25
|
-
experimental: true
|
26
|
-
- ruby: '3.0'
|
27
|
-
os: 'windows-latest'
|
28
|
-
experimental: true
|
29
|
-
- ruby: '3.0'
|
30
|
-
os: 'macos-latest'
|
31
|
-
experimental: true
|
32
22
|
steps:
|
33
23
|
- uses: actions/checkout@v2
|
34
24
|
with:
|
data/.rubocop.yml
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
# https://github.com/riboseinc/oss-guides
|
3
3
|
# All project-specific additions and overrides should be specified in this file.
|
4
4
|
|
5
|
+
require: rubocop-rails
|
6
|
+
|
5
7
|
inherit_from:
|
6
8
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
7
9
|
AllCops:
|
8
|
-
TargetRubyVersion: 2.
|
10
|
+
TargetRubyVersion: 2.5
|
9
11
|
Rails:
|
10
12
|
Enabled: false
|
data/README.adoc
CHANGED
@@ -89,6 +89,18 @@ RelatonUn::UnBibliography.get "UN TRADE/CEFACT/2004/32"
|
|
89
89
|
...
|
90
90
|
----
|
91
91
|
|
92
|
+
=== Typed links
|
93
|
+
|
94
|
+
UN documens may have `pdf` and `word` link types.
|
95
|
+
|
96
|
+
[source,ruby]
|
97
|
+
----
|
98
|
+
item.link
|
99
|
+
=> [#<RelatonBib::TypedUri:0x00007f81af368250
|
100
|
+
@content=#<Addressable::URI:0x9ec URI:https://documents-dds-ny.un.org/doc/UNDOC/GEN/G04/306/83/pdf/G0430683.pdf?OpenElement>, @type="pdf">,
|
101
|
+
#<RelatonBib::TypedUri:0x00007f81af3630e8 @content=#<Addressable::URI:0xa00 URI:https://documents-dds-ny.un.org/doc/UNDOC/GEN/G04/306/83/doc/G0430683.DOC?OpenElement>, @type="word">]
|
102
|
+
----
|
103
|
+
|
92
104
|
=== Create bibliographic item from XML
|
93
105
|
[source,ruby]
|
94
106
|
----
|
data/grammars/basicdoc.rng
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
-
<include href="biblio.rng"
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
<include href="biblio.rng">
|
4
|
+
<start>
|
5
|
+
<ref name="document"/>
|
6
|
+
</start>
|
7
|
+
</include>
|
7
8
|
<define name="document">
|
8
9
|
<element name="document">
|
9
10
|
<optional>
|
@@ -43,13 +44,16 @@
|
|
43
44
|
</attribute>
|
44
45
|
</optional>
|
45
46
|
<optional>
|
46
|
-
<
|
47
|
+
<attribute name="language"/>
|
47
48
|
</optional>
|
48
49
|
<optional>
|
49
|
-
<
|
50
|
+
<attribute name="script"/>
|
51
|
+
</optional>
|
52
|
+
<optional>
|
53
|
+
<ref name="section-title"/>
|
50
54
|
</optional>
|
51
55
|
<zeroOrMore>
|
52
|
-
<ref name="
|
56
|
+
<ref name="BasicBlock"/>
|
53
57
|
</zeroOrMore>
|
54
58
|
</define>
|
55
59
|
<define name="references">
|
@@ -92,6 +96,10 @@
|
|
92
96
|
<ref name="example"/>
|
93
97
|
<ref name="review"/>
|
94
98
|
<ref name="pre"/>
|
99
|
+
<ref name="note"/>
|
100
|
+
<ref name="pagebreak"/>
|
101
|
+
<ref name="hr"/>
|
102
|
+
<ref name="bookmark"/>
|
95
103
|
</choice>
|
96
104
|
</define>
|
97
105
|
<define name="paragraph">
|
@@ -165,9 +173,11 @@
|
|
165
173
|
<data type="dateTime"/>
|
166
174
|
</attribute>
|
167
175
|
</optional>
|
168
|
-
<
|
169
|
-
<
|
170
|
-
|
176
|
+
<optional>
|
177
|
+
<attribute name="from">
|
178
|
+
<data type="IDREF"/>
|
179
|
+
</attribute>
|
180
|
+
</optional>
|
171
181
|
<optional>
|
172
182
|
<attribute name="to">
|
173
183
|
<data type="IDREF"/>
|
@@ -188,6 +198,14 @@
|
|
188
198
|
<data type="boolean"/>
|
189
199
|
</attribute>
|
190
200
|
</optional>
|
201
|
+
<optional>
|
202
|
+
<attribute name="subsequence"/>
|
203
|
+
</optional>
|
204
|
+
<optional>
|
205
|
+
<attribute name="inequality">
|
206
|
+
<data type="boolean"/>
|
207
|
+
</attribute>
|
208
|
+
</optional>
|
191
209
|
<ref name="stem"/>
|
192
210
|
<optional>
|
193
211
|
<ref name="dl"/>
|
@@ -241,6 +259,9 @@
|
|
241
259
|
<data type="boolean"/>
|
242
260
|
</attribute>
|
243
261
|
</optional>
|
262
|
+
<optional>
|
263
|
+
<attribute name="subsequence"/>
|
264
|
+
</optional>
|
244
265
|
<optional>
|
245
266
|
<attribute name="lang"/>
|
246
267
|
</optional>
|
@@ -266,6 +287,9 @@
|
|
266
287
|
<attribute name="id">
|
267
288
|
<data type="ID"/>
|
268
289
|
</attribute>
|
290
|
+
<optional>
|
291
|
+
<attribute name="alt"/>
|
292
|
+
</optional>
|
269
293
|
<optional>
|
270
294
|
<ref name="tname"/>
|
271
295
|
</optional>
|
@@ -285,9 +309,15 @@
|
|
285
309
|
<data type="boolean"/>
|
286
310
|
</attribute>
|
287
311
|
</optional>
|
312
|
+
<optional>
|
313
|
+
<attribute name="subsequence"/>
|
314
|
+
</optional>
|
288
315
|
<optional>
|
289
316
|
<attribute name="alt"/>
|
290
317
|
</optional>
|
318
|
+
<optional>
|
319
|
+
<attribute name="summary"/>
|
320
|
+
</optional>
|
291
321
|
<optional>
|
292
322
|
<attribute name="uri">
|
293
323
|
<data type="anyURI"/>
|
@@ -313,12 +343,16 @@
|
|
313
343
|
</define>
|
314
344
|
<define name="tname">
|
315
345
|
<element name="name">
|
316
|
-
<
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
346
|
+
<oneOrMore>
|
347
|
+
<choice>
|
348
|
+
<ref name="PureTextElement"/>
|
349
|
+
<ref name="eref"/>
|
350
|
+
<ref name="stem"/>
|
351
|
+
<ref name="keyword"/>
|
352
|
+
<ref name="xref"/>
|
353
|
+
<ref name="hyperlink"/>
|
354
|
+
</choice>
|
355
|
+
</oneOrMore>
|
322
356
|
</element>
|
323
357
|
</define>
|
324
358
|
<define name="thead">
|
@@ -370,6 +404,16 @@
|
|
370
404
|
</choice>
|
371
405
|
</attribute>
|
372
406
|
</optional>
|
407
|
+
<optional>
|
408
|
+
<attribute name="valign">
|
409
|
+
<choice>
|
410
|
+
<value>top</value>
|
411
|
+
<value>middle</value>
|
412
|
+
<value>bottom</value>
|
413
|
+
<value>baseline</value>
|
414
|
+
</choice>
|
415
|
+
</attribute>
|
416
|
+
</optional>
|
373
417
|
<choice>
|
374
418
|
<zeroOrMore>
|
375
419
|
<ref name="TextElement"/>
|
@@ -397,6 +441,16 @@
|
|
397
441
|
</choice>
|
398
442
|
</attribute>
|
399
443
|
</optional>
|
444
|
+
<optional>
|
445
|
+
<attribute name="valign">
|
446
|
+
<choice>
|
447
|
+
<value>top</value>
|
448
|
+
<value>middle</value>
|
449
|
+
<value>bottom</value>
|
450
|
+
<value>baseline</value>
|
451
|
+
</choice>
|
452
|
+
</attribute>
|
453
|
+
</optional>
|
400
454
|
<choice>
|
401
455
|
<zeroOrMore>
|
402
456
|
<ref name="TextElement"/>
|
@@ -417,6 +471,12 @@
|
|
417
471
|
<data type="boolean"/>
|
418
472
|
</attribute>
|
419
473
|
</optional>
|
474
|
+
<optional>
|
475
|
+
<attribute name="subsequence"/>
|
476
|
+
</optional>
|
477
|
+
<optional>
|
478
|
+
<ref name="tname"/>
|
479
|
+
</optional>
|
420
480
|
<oneOrMore>
|
421
481
|
<choice>
|
422
482
|
<ref name="formula"/>
|
@@ -481,17 +541,25 @@
|
|
481
541
|
</attribute>
|
482
542
|
</optional>
|
483
543
|
<optional>
|
484
|
-
<
|
544
|
+
<attribute name="subsequence"/>
|
485
545
|
</optional>
|
486
546
|
<optional>
|
487
|
-
<
|
547
|
+
<attribute name="class"/>
|
488
548
|
</optional>
|
489
549
|
<optional>
|
490
|
-
<ref name="
|
550
|
+
<ref name="source"/>
|
551
|
+
</optional>
|
552
|
+
<optional>
|
553
|
+
<ref name="tname"/>
|
491
554
|
</optional>
|
492
555
|
<choice>
|
493
556
|
<ref name="image"/>
|
557
|
+
<ref name="video"/>
|
558
|
+
<ref name="audio"/>
|
494
559
|
<ref name="pre"/>
|
560
|
+
<oneOrMore>
|
561
|
+
<ref name="paragraph-with-footnote"/>
|
562
|
+
</oneOrMore>
|
495
563
|
<zeroOrMore>
|
496
564
|
<ref name="figure"/>
|
497
565
|
</zeroOrMore>
|
@@ -529,6 +597,8 @@
|
|
529
597
|
<ref name="pagebreak"/>
|
530
598
|
<ref name="bookmark"/>
|
531
599
|
<ref name="image"/>
|
600
|
+
<ref name="index"/>
|
601
|
+
<ref name="index-xref"/>
|
532
602
|
</choice>
|
533
603
|
</define>
|
534
604
|
<define name="PureTextElement">
|
@@ -553,21 +623,38 @@
|
|
553
623
|
<define name="em">
|
554
624
|
<element name="em">
|
555
625
|
<zeroOrMore>
|
556
|
-
<
|
626
|
+
<choice>
|
627
|
+
<ref name="PureTextElement"/>
|
628
|
+
<ref name="stem"/>
|
629
|
+
<ref name="eref"/>
|
630
|
+
<ref name="xref"/>
|
631
|
+
<ref name="hyperlink"/>
|
632
|
+
</choice>
|
557
633
|
</zeroOrMore>
|
558
634
|
</element>
|
559
635
|
</define>
|
560
636
|
<define name="strong">
|
561
637
|
<element name="strong">
|
562
638
|
<zeroOrMore>
|
563
|
-
<
|
639
|
+
<choice>
|
640
|
+
<ref name="PureTextElement"/>
|
641
|
+
<ref name="stem"/>
|
642
|
+
<ref name="eref"/>
|
643
|
+
<ref name="xref"/>
|
644
|
+
<ref name="hyperlink"/>
|
645
|
+
</choice>
|
564
646
|
</zeroOrMore>
|
565
647
|
</element>
|
566
648
|
</define>
|
567
649
|
<define name="tt">
|
568
650
|
<element name="tt">
|
569
651
|
<zeroOrMore>
|
570
|
-
<
|
652
|
+
<choice>
|
653
|
+
<ref name="PureTextElement"/>
|
654
|
+
<ref name="eref"/>
|
655
|
+
<ref name="xref"/>
|
656
|
+
<ref name="hyperlink"/>
|
657
|
+
</choice>
|
571
658
|
</zeroOrMore>
|
572
659
|
</element>
|
573
660
|
</define>
|
@@ -653,6 +740,65 @@
|
|
653
740
|
<empty/>
|
654
741
|
</element>
|
655
742
|
</define>
|
743
|
+
<define name="index">
|
744
|
+
<element name="index">
|
745
|
+
<optional>
|
746
|
+
<attribute name="to">
|
747
|
+
<data type="IDREF"/>
|
748
|
+
</attribute>
|
749
|
+
</optional>
|
750
|
+
<element name="primary">
|
751
|
+
<oneOrMore>
|
752
|
+
<ref name="PureTextElement"/>
|
753
|
+
</oneOrMore>
|
754
|
+
</element>
|
755
|
+
<optional>
|
756
|
+
<element name="secondary">
|
757
|
+
<oneOrMore>
|
758
|
+
<ref name="PureTextElement"/>
|
759
|
+
</oneOrMore>
|
760
|
+
</element>
|
761
|
+
</optional>
|
762
|
+
<optional>
|
763
|
+
<element name="tertiary">
|
764
|
+
<oneOrMore>
|
765
|
+
<ref name="PureTextElement"/>
|
766
|
+
</oneOrMore>
|
767
|
+
</element>
|
768
|
+
</optional>
|
769
|
+
</element>
|
770
|
+
</define>
|
771
|
+
<define name="index-xref">
|
772
|
+
<element name="index-xref">
|
773
|
+
<attribute name="also">
|
774
|
+
<data type="boolean"/>
|
775
|
+
</attribute>
|
776
|
+
<element name="primary">
|
777
|
+
<oneOrMore>
|
778
|
+
<ref name="PureTextElement"/>
|
779
|
+
</oneOrMore>
|
780
|
+
</element>
|
781
|
+
<optional>
|
782
|
+
<element name="secondary">
|
783
|
+
<oneOrMore>
|
784
|
+
<ref name="PureTextElement"/>
|
785
|
+
</oneOrMore>
|
786
|
+
</element>
|
787
|
+
</optional>
|
788
|
+
<optional>
|
789
|
+
<element name="tertiary">
|
790
|
+
<oneOrMore>
|
791
|
+
<ref name="PureTextElement"/>
|
792
|
+
</oneOrMore>
|
793
|
+
</element>
|
794
|
+
</optional>
|
795
|
+
<element name="target">
|
796
|
+
<oneOrMore>
|
797
|
+
<ref name="PureTextElement"/>
|
798
|
+
</oneOrMore>
|
799
|
+
</element>
|
800
|
+
</element>
|
801
|
+
</define>
|
656
802
|
<!-- bare ID element, used for referencing arbitrary spans of text -->
|
657
803
|
<define name="bookmark">
|
658
804
|
<element name="bookmark">
|
@@ -689,7 +835,9 @@
|
|
689
835
|
<attribute name="alt"/>
|
690
836
|
</optional>
|
691
837
|
<ref name="CitationType"/>
|
692
|
-
<
|
838
|
+
<oneOrMore>
|
839
|
+
<ref name="PureTextElement"/>
|
840
|
+
</oneOrMore>
|
693
841
|
</define>
|
694
842
|
<define name="hyperlink">
|
695
843
|
<element name="link">
|
@@ -702,7 +850,9 @@
|
|
702
850
|
<optional>
|
703
851
|
<attribute name="alt"/>
|
704
852
|
</optional>
|
705
|
-
<
|
853
|
+
<oneOrMore>
|
854
|
+
<ref name="PureTextElement"/>
|
855
|
+
</oneOrMore>
|
706
856
|
</element>
|
707
857
|
</define>
|
708
858
|
<define name="xref">
|
@@ -716,7 +866,9 @@
|
|
716
866
|
<optional>
|
717
867
|
<attribute name="alt"/>
|
718
868
|
</optional>
|
719
|
-
<
|
869
|
+
<oneOrMore>
|
870
|
+
<ref name="PureTextElement"/>
|
871
|
+
</oneOrMore>
|
720
872
|
</element>
|
721
873
|
</define>
|
722
874
|
<define name="fn">
|
@@ -778,6 +930,9 @@
|
|
778
930
|
<optional>
|
779
931
|
<attribute name="alt"/>
|
780
932
|
</optional>
|
933
|
+
<optional>
|
934
|
+
<attribute name="title"/>
|
935
|
+
</optional>
|
781
936
|
<optional>
|
782
937
|
<attribute name="longdesc">
|
783
938
|
<data type="anyURI"/>
|
@@ -786,7 +941,7 @@
|
|
786
941
|
</element>
|
787
942
|
</define>
|
788
943
|
<define name="video">
|
789
|
-
<element name="
|
944
|
+
<element name="video">
|
790
945
|
<attribute name="id">
|
791
946
|
<data type="ID"/>
|
792
947
|
</attribute>
|
@@ -816,6 +971,9 @@
|
|
816
971
|
<optional>
|
817
972
|
<attribute name="alt"/>
|
818
973
|
</optional>
|
974
|
+
<optional>
|
975
|
+
<attribute name="title"/>
|
976
|
+
</optional>
|
819
977
|
<optional>
|
820
978
|
<attribute name="longdesc">
|
821
979
|
<data type="anyURI"/>
|
@@ -827,7 +985,7 @@
|
|
827
985
|
</element>
|
828
986
|
</define>
|
829
987
|
<define name="audio">
|
830
|
-
<element name="
|
988
|
+
<element name="audio">
|
831
989
|
<attribute name="id">
|
832
990
|
<data type="ID"/>
|
833
991
|
</attribute>
|
@@ -841,6 +999,9 @@
|
|
841
999
|
<optional>
|
842
1000
|
<attribute name="alt"/>
|
843
1001
|
</optional>
|
1002
|
+
<optional>
|
1003
|
+
<attribute name="title"/>
|
1004
|
+
</optional>
|
844
1005
|
<optional>
|
845
1006
|
<attribute name="longdesc">
|
846
1007
|
<data type="anyURI"/>
|
@@ -925,6 +1086,9 @@
|
|
925
1086
|
<value>alphabet_upper</value>
|
926
1087
|
</choice>
|
927
1088
|
</attribute>
|
1089
|
+
<optional>
|
1090
|
+
<attribute name="start"/>
|
1091
|
+
</optional>
|
928
1092
|
<oneOrMore>
|
929
1093
|
<ref name="li"/>
|
930
1094
|
</oneOrMore>
|
data/grammars/biblio.rng
CHANGED
@@ -124,7 +124,7 @@
|
|
124
124
|
<value>application/tei+xml</value>
|
125
125
|
<value>text/x-asciidoc</value>
|
126
126
|
<value>text/markdown</value>
|
127
|
-
<value>application/x-
|
127
|
+
<value>application/x-metanorma+xml</value>
|
128
128
|
<text/>
|
129
129
|
</choice>
|
130
130
|
</attribute>
|
@@ -401,9 +401,9 @@
|
|
401
401
|
<choice>
|
402
402
|
<!-- iso191606 TODO -->
|
403
403
|
<group>
|
404
|
-
<
|
404
|
+
<zeroOrMore>
|
405
405
|
<ref name="street"/>
|
406
|
-
</
|
406
|
+
</zeroOrMore>
|
407
407
|
<ref name="city"/>
|
408
408
|
<optional>
|
409
409
|
<ref name="state"/>
|
@@ -452,6 +452,7 @@
|
|
452
452
|
<attribute name="type">
|
453
453
|
<choice>
|
454
454
|
<value>isni</value>
|
455
|
+
<value>orcid</value>
|
455
456
|
<value>uri</value>
|
456
457
|
</choice>
|
457
458
|
</attribute>
|
@@ -461,10 +462,7 @@
|
|
461
462
|
<define name="org-identifier">
|
462
463
|
<element name="identifier">
|
463
464
|
<attribute name="type">
|
464
|
-
<
|
465
|
-
<value>orcid</value>
|
466
|
-
<value>uri</value>
|
467
|
-
</choice>
|
465
|
+
<data type="string" datatypeLibrary=""/>
|
468
466
|
</attribute>
|
469
467
|
<text/>
|
470
468
|
</element>
|
@@ -789,6 +787,7 @@
|
|
789
787
|
<value>adapted</value>
|
790
788
|
<value>vote-started</value>
|
791
789
|
<value>vote-ended</value>
|
790
|
+
<value>announced</value>
|
792
791
|
</choice>
|
793
792
|
</define>
|
794
793
|
<define name="bdate">
|
@@ -1106,7 +1105,7 @@
|
|
1106
1105
|
<value>complementOf</value>
|
1107
1106
|
<value>obsoletes</value>
|
1108
1107
|
<value>obsoletedBy</value>
|
1109
|
-
<value>
|
1108
|
+
<value>cites</value>
|
1110
1109
|
<value>isCitedIn</value>
|
1111
1110
|
</choice>
|
1112
1111
|
</define>
|