relaton-iec 1.7.8 → 1.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -11
  3. data/.rubocop.yml +3 -1
  4. data/README.adoc +23 -0
  5. data/grammars/basicdoc.rng +191 -27
  6. data/grammars/biblio.rng +12 -11
  7. data/grammars/iec.rng +144 -1
  8. data/grammars/isodoc.rng +1156 -112
  9. data/grammars/isostandard.rng +69 -115
  10. data/grammars/reqt.rng +65 -7
  11. data/lib/relaton_iec/basic_block/alignment.rb +30 -0
  12. data/lib/relaton_iec/basic_block/basic_block.rb +15 -0
  13. data/lib/relaton_iec/basic_block/citation_type.rb +32 -0
  14. data/lib/relaton_iec/basic_block/dl.rb +60 -0
  15. data/lib/relaton_iec/basic_block/eref.rb +10 -0
  16. data/lib/relaton_iec/basic_block/eref_type.rb +39 -0
  17. data/lib/relaton_iec/basic_block/formula.rb +34 -0
  18. data/lib/relaton_iec/basic_block/image.rb +41 -0
  19. data/lib/relaton_iec/basic_block/index.rb +27 -0
  20. data/lib/relaton_iec/basic_block/index_xref.rb +31 -0
  21. data/lib/relaton_iec/basic_block/note.rb +21 -0
  22. data/lib/relaton_iec/basic_block/paragraph.rb +27 -0
  23. data/lib/relaton_iec/basic_block/paragraph_with_footnote.rb +29 -0
  24. data/lib/relaton_iec/basic_block/reference_format.rb +38 -0
  25. data/lib/relaton_iec/basic_block/stem.rb +30 -0
  26. data/lib/relaton_iec/basic_block/table.rb +115 -0
  27. data/lib/relaton_iec/basic_block/text_element.rb +27 -0
  28. data/lib/relaton_iec/hit_collection.rb +1 -1
  29. data/lib/relaton_iec/iec_bibliographic_item.rb +86 -1
  30. data/lib/relaton_iec/scrapper.rb +18 -17
  31. data/lib/relaton_iec/tc_sc_officers_note.rb +24 -0
  32. data/lib/relaton_iec/version.rb +1 -1
  33. data/lib/relaton_iec/xml_parser.rb +20 -0
  34. data/relaton_iec.gemspec +2 -4
  35. metadata +23 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbb0f0c060c611ed09b0bfb72313ebc933dce55cd7ea5063e55e4329e683d4ea
4
- data.tar.gz: 05b97bda3a0f1815beda4437248434b26e539e52905b53e724d1dbbeedb1e890
3
+ metadata.gz: 3e449c90e5d42349f83529a764d1eb502658dae2dd993e2597f2051c0ac14b9e
4
+ data.tar.gz: 5cfa9fb5734c5467f22de8bd6629c02d60b7f0f3ac13fb06892530519eaa3af3
5
5
  SHA512:
6
- metadata.gz: 637d0b99821d7a2ec94b853064cb7958028e79a3855524707677ebc711879713f3d4ef34d6df699d5f3c9b1b3644f11edf342b6e9baaaa90deea6be53478e183
7
- data.tar.gz: d3e445689acae837e55f7b92fb95cb52a97afa23813d908d3bf41b8e82a77077e55d67bf51b181590d9b2c883e958ccdf07047cff6436404aa735537ffa78ce2
6
+ metadata.gz: f4c2d5a7969cd29d8cf4311d636bf5ff8f1567acf5e11d003e2b1bfee8dc35df79a9bcfe5d3a9d738eccfb2b8fbb604c00b408873226c7f21734a3fc1b9dfa5b
7
+ data.tar.gz: ed09a6035d0f056097f8cf4c0f34f7b0af1d44723e968114f1090652f2aa3ae8aa73ac1f1864f2b45a1ea0ae7696b5082fe18419af286be1a5245c7fcdc82ae9
@@ -16,19 +16,9 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.7', '2.6', '2.5', '2.4' ]
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.4
10
+ TargetRubyVersion: 2.5
9
11
  Rails:
10
12
  Enabled: false
data/README.adoc CHANGED
@@ -93,6 +93,18 @@ item.docidentifier.first
93
93
  => #<RelatonBib::DocumentIdentifier:0x007fa69f2a65f0 @id="IEC 60050-112:2010", @scope=nil, @type="IEC">
94
94
  ----
95
95
 
96
+ === Search for ISO/IEC Directives
97
+
98
+ The ISO/IEC Derectives are stored in a static cache in a relaton gem. It needs to use the relaton gem to fetch the ISO/IEC Directives. Folloving reaferences are allowed to fetch:
99
+
100
+ - ISO/IEC DIR 1 - Procedures for the technical work
101
+ - ISO/IEC DIR 1 IEC SUP - Procedures for the technical work – Procedures specific to IEC
102
+ - ISO/IEC DIR 1 ISO SUP - Consolidated ISO Supplement -- Procedures specific to ISO
103
+ - ISO/IEC DIR 2 IEC - Principles and rules for the structure and drafting of ISO and IEC documents
104
+ - ISO/IEC DIR 2 ISO - Principles and rules for the structure and drafting of ISO and IEC documents
105
+ - ISO/IEC DIR IEC SUP - Procedures specific to IEC
106
+ - ISO/IEC DIR JTC 1 SUP - Procedures specific to JTC 1
107
+
96
108
  === XML serialization
97
109
 
98
110
  Possible options:
@@ -184,6 +196,17 @@ item.to_xml note: [{ text: "Note", type: "note" }]
184
196
  </bibitem>"
185
197
  ----
186
198
 
199
+ === Typed links
200
+
201
+ Each IEC document has `src` type link and optional `obp` type link.
202
+
203
+ [source,ruby]
204
+ ----
205
+ item.link
206
+ => [#<RelatonBib::TypedUri:0x00007ffe9d9b6420 @content=#<Addressable::URI:0x80c URI:https://webstore.iec.ch/publication/162>, @type="src">,
207
+ #<RelatonBib::TypedUri:0x00007ffe9d9af080 @content=#<Addressable::URI:0x820 URI:/preview/info_iec60050-112%7Bed1.0%7Db.pdf>, @type="obp">]
208
+ ----
209
+
187
210
  === Create bibliography item from hash
188
211
 
189
212
  [source,ruby]
@@ -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
- <start>
5
- <ref name="document"/>
6
- </start>
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
- <ref name="section-title"/>
47
+ <attribute name="language"/>
47
48
  </optional>
48
49
  <optional>
49
- <ref name="BasicBlock"/>
50
+ <attribute name="script"/>
51
+ </optional>
52
+ <optional>
53
+ <ref name="section-title"/>
50
54
  </optional>
51
55
  <zeroOrMore>
52
- <ref name="note"/>
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
- <attribute name="from">
169
- <data type="IDREF"/>
170
- </attribute>
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
- <text/>
317
- </element>
318
- </define>
319
- <define name="tclass">
320
- <element name="name">
321
- <text/>
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
- <ref name="source"/>
544
+ <attribute name="subsequence"/>
485
545
  </optional>
486
546
  <optional>
487
- <ref name="tname"/>
547
+ <attribute name="class"/>
488
548
  </optional>
489
549
  <optional>
490
- <ref name="tclass"/>
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
- <ref name="PureTextElement"/>
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
- <ref name="PureTextElement"/>
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
- <ref name="PureTextElement"/>
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
- <text/>
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
- <text/>
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
- <text/>
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="image">
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="image">
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-isodoc+xml</value>
127
+ <value>application/x-metanorma+xml</value>
128
128
  <text/>
129
129
  </choice>
130
130
  </attribute>
@@ -209,9 +209,6 @@
209
209
  <zeroOrMore>
210
210
  <ref name="contact"/>
211
211
  </zeroOrMore>
212
- <zeroOrMore>
213
- <ref name="uri"/>
214
- </zeroOrMore>
215
212
  </element>
216
213
  </define>
217
214
  <define name="fullname">
@@ -401,9 +398,9 @@
401
398
  <choice>
402
399
  <!-- iso191606 TODO -->
403
400
  <group>
404
- <oneOrMore>
401
+ <zeroOrMore>
405
402
  <ref name="street"/>
406
- </oneOrMore>
403
+ </zeroOrMore>
407
404
  <ref name="city"/>
408
405
  <optional>
409
406
  <ref name="state"/>
@@ -452,6 +449,7 @@
452
449
  <attribute name="type">
453
450
  <choice>
454
451
  <value>isni</value>
452
+ <value>orcid</value>
455
453
  <value>uri</value>
456
454
  </choice>
457
455
  </attribute>
@@ -461,10 +459,7 @@
461
459
  <define name="org-identifier">
462
460
  <element name="identifier">
463
461
  <attribute name="type">
464
- <choice>
465
- <value>orcid</value>
466
- <value>uri</value>
467
- </choice>
462
+ <data type="string" datatypeLibrary=""/>
468
463
  </attribute>
469
464
  <text/>
470
465
  </element>
@@ -789,6 +784,7 @@
789
784
  <value>adapted</value>
790
785
  <value>vote-started</value>
791
786
  <value>vote-ended</value>
787
+ <value>announced</value>
792
788
  </choice>
793
789
  </define>
794
790
  <define name="bdate">
@@ -829,6 +825,11 @@
829
825
  <optional>
830
826
  <attribute name="scope"/>
831
827
  </optional>
828
+ <optional>
829
+ <attribute name="primary">
830
+ <data type="boolean"/>
831
+ </attribute>
832
+ </optional>
832
833
  <text/>
833
834
  </element>
834
835
  </define>
@@ -1106,7 +1107,7 @@
1106
1107
  <value>complementOf</value>
1107
1108
  <value>obsoletes</value>
1108
1109
  <value>obsoletedBy</value>
1109
- <value>cited</value>
1110
+ <value>cites</value>
1110
1111
  <value>isCitedIn</value>
1111
1112
  </choice>
1112
1113
  </define>