relaton-iec 1.7.7 → 1.10.0

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 +36 -0
  5. data/grammars/basicdoc.rng +191 -27
  6. data/grammars/biblio.rng +7 -8
  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 +93 -1
  30. data/lib/relaton_iec/processor.rb +1 -2
  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: 6adf6dcf2372c1e9dff549a4d4145fcbbd9bd1aced1924183a30d5253a760757
4
- data.tar.gz: 26065c6b757cd9e1818568f6ef07b83041ea3e10cf4f6c331925c807a8c22c50
3
+ metadata.gz: 96d2d6999eefa5afb477c3c783a8c8ff9a68b22b69d431973a16417be21e37d9
4
+ data.tar.gz: 73437e701a2da723a1bc4d36113753dec5a99f9962937a2a7b1d61e50214e337
5
5
  SHA512:
6
- metadata.gz: d6c2a5cb8df0993d39c2d150f1f1abc6cddfe0b6ddc88e0ff3f309603de964eccf4242dc273c89659fcfd4323a73b8ecbcc152d9203bcdadc618df5171313f47
7
- data.tar.gz: b76ea74bdf8204c525d8db77b03d53157a26ae0f797edfb5be908b33c28c426add2de763e51ee92a98b778e64084230ea699b4c2a79420cb3166c72be7308b9f
6
+ metadata.gz: 2682e97e9005ab0e32be5bc672dc1a958501ecc7fc5b23b909a808add96a473a472cdf255b5fb2b5c51664be12c4ce078e318acb44eafb7c6e207b9f31f63190
7
+ data.tar.gz: 1361dc12bec431a896f5dab4a8d8230e62793da56f387bf8319e42bae35751df25cf79e09655cf111887292885e5105c0887377ebb81301bb33a0eda8dae8629
@@ -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,30 @@ 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
+
210
+ === Create bibliography item from hash
211
+
212
+ [source,ruby]
213
+ ----
214
+ hash = YAML.load_file "spec/examples/hit.yaml"
215
+ => {"id"=>"IEC61058-2-4-1995+AMD1-2003CSV",
216
+ ...
217
+
218
+ RelatonIec::IecBibliographicItem.from_hash hash
219
+ => #<RelatonIec::IecBibliographicItem:0x00007fe16f032d40
220
+ ...
221
+ ----
222
+
187
223
  === Converting reference to URN
188
224
 
189
225
  URN is document a identifier format. It has fields delimited by colon. If any field is absent then it's place is empty. All values are in lower-case.
@@ -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>
@@ -401,9 +401,9 @@
401
401
  <choice>
402
402
  <!-- iso191606 TODO -->
403
403
  <group>
404
- <oneOrMore>
404
+ <zeroOrMore>
405
405
  <ref name="street"/>
406
- </oneOrMore>
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
- <choice>
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>cited</value>
1108
+ <value>cites</value>
1110
1109
  <value>isCitedIn</value>
1111
1110
  </choice>
1112
1111
  </define>