relaton-iec 1.1.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: feed37a0cc997a6fbbc8ca4dd6b83dd3cb4496336f65eaeb03f20b12f3ff9f2d
4
- data.tar.gz: 7dd0c847253d5e44ad50e36b7352ed905d55c6155cf0bd1621f9b1a46b019160
3
+ metadata.gz: 585ff20a58cd576335e184b6e8e420222d03e51dcfd9299f3625755ffe2316cf
4
+ data.tar.gz: 7c3a6eb9a9ff6594186680e96d8b12bcec51019d27b349239c4a085f8c0d032b
5
5
  SHA512:
6
- metadata.gz: d8ded4181c4a2130743bef4664c411b435aa6e9d25b5c580340c6eb644049adc43313089640c4195838ae165a843cfcf869c1076afe92b4f35101c55977f7d22
7
- data.tar.gz: 764b7692397d25da284c7ef704ccbc56373d4b743c3c02864e1ede7b530f641ce5a53c3c0486f943a86b52843f7dd30c7ee9f66a0b618647c6bd4f7f1863eedb
6
+ metadata.gz: 262028dca7496435b233c1ec77b4b8fcbde6e93eca0276f9469835a063b0e3d0f8823cbe118af042516d90ab347560a4e2a963b6a0d6ad1a21333fb4b821dc8d
7
+ data.tar.gz: 99e68fa99988635c239ed7ecd07a458dbb1a8007f1d8e912a0a2576f1cf0f36af3e873e7eadaa0a27c30d4d4c7e765cebfa8d14e21b8c078d345e3575192baf1
@@ -29,4 +29,5 @@ jobs:
29
29
  bundle install --jobs 4 --retry 3
30
30
  - name: Run specs
31
31
  run: |
32
+ unset JAVA_TOOL_OPTIONS
32
33
  bundle exec rake
@@ -5,6 +5,6 @@
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
7
  AllCops:
8
- TargetRubyVersion: 2.3
8
+ TargetRubyVersion: 2.4
9
9
  Rails:
10
- Enabled: true
10
+ Enabled: false
@@ -31,7 +31,7 @@ Or install it yourself as:
31
31
 
32
32
  == Usage
33
33
 
34
- Refer to https://github.com/metanorma/relaton-iso/blob/master/README.adoc: the usage interface is identical.
34
+ Refer to https://github.com/relaton/relaton-iso/blob/master/README.adoc the usage interface is identical.
35
35
 
36
36
  == Development
37
37
 
@@ -532,7 +532,7 @@
532
532
  </define>
533
533
  <define name="LocalityType">
534
534
  <data type="string">
535
- <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>
536
536
  </data>
537
537
  </define>
538
538
  <define name="referenceFrom">
@@ -23,6 +23,13 @@
23
23
  -->
24
24
  <define name="iec-standard">
25
25
  <element name="iec-standard">
26
+ <attribute name="version"/>
27
+ <attribute name="type">
28
+ <choice>
29
+ <value>semantic</value>
30
+ <value>presentation</value>
31
+ </choice>
32
+ </attribute>
26
33
  <ref name="bibdata"/>
27
34
  <zeroOrMore>
28
35
  <ref name="termdocsource"/>
@@ -43,7 +43,9 @@
43
43
  <define name="xref">
44
44
  <element name="xref">
45
45
  <attribute name="target">
46
- <data type="IDREF"/>
46
+ <data type="string">
47
+ <param name="pattern">\i\c*|\c+#\c+</param>
48
+ </data>
47
49
  </attribute>
48
50
  <optional>
49
51
  <attribute name="type">
@@ -61,9 +63,93 @@
61
63
  </choice>
62
64
  </attribute>
63
65
  </optional>
66
+ <optional>
67
+ <attribute name="droploc">
68
+ <data type="boolean"/>
69
+ </attribute>
70
+ </optional>
64
71
  <text/>
65
72
  </element>
66
73
  </define>
74
+ <define name="ul">
75
+ <element name="ul">
76
+ <attribute name="id">
77
+ <data type="ID"/>
78
+ </attribute>
79
+ <optional>
80
+ <attribute name="keep-with-next">
81
+ <data type="boolean"/>
82
+ </attribute>
83
+ </optional>
84
+ <optional>
85
+ <attribute name="keep-lines-together">
86
+ <data type="boolean"/>
87
+ </attribute>
88
+ </optional>
89
+ <oneOrMore>
90
+ <ref name="li"/>
91
+ </oneOrMore>
92
+ <zeroOrMore>
93
+ <ref name="note"/>
94
+ </zeroOrMore>
95
+ </element>
96
+ </define>
97
+ <define name="ol">
98
+ <element name="ol">
99
+ <attribute name="id">
100
+ <data type="ID"/>
101
+ </attribute>
102
+ <optional>
103
+ <attribute name="keep-with-next">
104
+ <data type="boolean"/>
105
+ </attribute>
106
+ </optional>
107
+ <optional>
108
+ <attribute name="keep-lines-together">
109
+ <data type="boolean"/>
110
+ </attribute>
111
+ </optional>
112
+ <attribute name="type">
113
+ <choice>
114
+ <value>roman</value>
115
+ <value>alphabet</value>
116
+ <value>arabic</value>
117
+ <value>roman_upper</value>
118
+ <value>alphabet_upper</value>
119
+ </choice>
120
+ </attribute>
121
+ <oneOrMore>
122
+ <ref name="li"/>
123
+ </oneOrMore>
124
+ <zeroOrMore>
125
+ <ref name="note"/>
126
+ </zeroOrMore>
127
+ </element>
128
+ </define>
129
+ <define name="dl">
130
+ <element name="dl">
131
+ <attribute name="id">
132
+ <data type="ID"/>
133
+ </attribute>
134
+ <optional>
135
+ <attribute name="keep-with-next">
136
+ <data type="boolean"/>
137
+ </attribute>
138
+ </optional>
139
+ <optional>
140
+ <attribute name="keep-lines-together">
141
+ <data type="boolean"/>
142
+ </attribute>
143
+ </optional>
144
+ <oneOrMore>
145
+ <ref name="dt"/>
146
+ <ref name="dd"/>
147
+ </oneOrMore>
148
+ <zeroOrMore>
149
+ <ref name="note"/>
150
+ </zeroOrMore>
151
+ </element>
152
+ </define>
67
153
  <define name="example">
68
154
  <element name="example">
69
155
  <attribute name="id">
@@ -77,6 +163,19 @@
77
163
  <optional>
78
164
  <attribute name="subsequence"/>
79
165
  </optional>
166
+ <optional>
167
+ <attribute name="number"/>
168
+ </optional>
169
+ <optional>
170
+ <attribute name="keep-with-next">
171
+ <data type="boolean"/>
172
+ </attribute>
173
+ </optional>
174
+ <optional>
175
+ <attribute name="keep-lines-together">
176
+ <data type="boolean"/>
177
+ </attribute>
178
+ </optional>
80
179
  <optional>
81
180
  <ref name="tname"/>
82
181
  </optional>
@@ -97,6 +196,296 @@
97
196
  </zeroOrMore>
98
197
  </element>
99
198
  </define>
199
+ <define name="table">
200
+ <element name="table">
201
+ <attribute name="id">
202
+ <data type="ID"/>
203
+ </attribute>
204
+ <optional>
205
+ <attribute name="unnumbered">
206
+ <data type="boolean"/>
207
+ </attribute>
208
+ </optional>
209
+ <optional>
210
+ <attribute name="number"/>
211
+ </optional>
212
+ <optional>
213
+ <attribute name="subsequence"/>
214
+ </optional>
215
+ <optional>
216
+ <attribute name="alt"/>
217
+ </optional>
218
+ <optional>
219
+ <attribute name="summary"/>
220
+ </optional>
221
+ <optional>
222
+ <attribute name="uri">
223
+ <data type="anyURI"/>
224
+ </attribute>
225
+ </optional>
226
+ <optional>
227
+ <attribute name="keep-with-next">
228
+ <data type="boolean"/>
229
+ </attribute>
230
+ </optional>
231
+ <optional>
232
+ <attribute name="keep-lines-together">
233
+ <data type="boolean"/>
234
+ </attribute>
235
+ </optional>
236
+ <optional>
237
+ <ref name="tname"/>
238
+ </optional>
239
+ <optional>
240
+ <ref name="thead"/>
241
+ </optional>
242
+ <ref name="tbody"/>
243
+ <optional>
244
+ <ref name="tfoot"/>
245
+ </optional>
246
+ <zeroOrMore>
247
+ <ref name="table-note"/>
248
+ </zeroOrMore>
249
+ <optional>
250
+ <ref name="dl"/>
251
+ </optional>
252
+ </element>
253
+ </define>
254
+ <define name="figure">
255
+ <element name="figure">
256
+ <attribute name="id">
257
+ <data type="ID"/>
258
+ </attribute>
259
+ <optional>
260
+ <attribute name="unnumbered">
261
+ <data type="boolean"/>
262
+ </attribute>
263
+ </optional>
264
+ <optional>
265
+ <attribute name="number"/>
266
+ </optional>
267
+ <optional>
268
+ <attribute name="subsequence"/>
269
+ </optional>
270
+ <optional>
271
+ <attribute name="keep-with-next">
272
+ <data type="boolean"/>
273
+ </attribute>
274
+ </optional>
275
+ <optional>
276
+ <attribute name="keep-lines-together">
277
+ <data type="boolean"/>
278
+ </attribute>
279
+ </optional>
280
+ <optional>
281
+ <attribute name="class"/>
282
+ </optional>
283
+ <optional>
284
+ <ref name="source"/>
285
+ </optional>
286
+ <optional>
287
+ <ref name="tname"/>
288
+ </optional>
289
+ <choice>
290
+ <ref name="image"/>
291
+ <ref name="video"/>
292
+ <ref name="audio"/>
293
+ <ref name="pre"/>
294
+ <oneOrMore>
295
+ <ref name="paragraph-with-footnote"/>
296
+ </oneOrMore>
297
+ <zeroOrMore>
298
+ <ref name="figure"/>
299
+ </zeroOrMore>
300
+ </choice>
301
+ <zeroOrMore>
302
+ <ref name="fn"/>
303
+ </zeroOrMore>
304
+ <optional>
305
+ <ref name="dl"/>
306
+ </optional>
307
+ <zeroOrMore>
308
+ <ref name="note"/>
309
+ </zeroOrMore>
310
+ </element>
311
+ </define>
312
+ <define name="sourcecode">
313
+ <element name="sourcecode">
314
+ <attribute name="id">
315
+ <data type="ID"/>
316
+ </attribute>
317
+ <optional>
318
+ <attribute name="unnumbered">
319
+ <data type="boolean"/>
320
+ </attribute>
321
+ </optional>
322
+ <optional>
323
+ <attribute name="number"/>
324
+ </optional>
325
+ <optional>
326
+ <attribute name="subsequence"/>
327
+ </optional>
328
+ <optional>
329
+ <attribute name="keep-with-next">
330
+ <data type="boolean"/>
331
+ </attribute>
332
+ </optional>
333
+ <optional>
334
+ <attribute name="keep-lines-together">
335
+ <data type="boolean"/>
336
+ </attribute>
337
+ </optional>
338
+ <optional>
339
+ <attribute name="lang"/>
340
+ </optional>
341
+ <optional>
342
+ <ref name="tname"/>
343
+ </optional>
344
+ <oneOrMore>
345
+ <choice>
346
+ <text/>
347
+ <ref name="callout"/>
348
+ </choice>
349
+ </oneOrMore>
350
+ <zeroOrMore>
351
+ <ref name="annotation"/>
352
+ </zeroOrMore>
353
+ <zeroOrMore>
354
+ <ref name="note"/>
355
+ </zeroOrMore>
356
+ </element>
357
+ </define>
358
+ <define name="formula">
359
+ <element name="formula">
360
+ <attribute name="id">
361
+ <data type="ID"/>
362
+ </attribute>
363
+ <optional>
364
+ <attribute name="unnumbered">
365
+ <data type="boolean"/>
366
+ </attribute>
367
+ </optional>
368
+ <optional>
369
+ <attribute name="number"/>
370
+ </optional>
371
+ <optional>
372
+ <attribute name="subsequence"/>
373
+ </optional>
374
+ <optional>
375
+ <attribute name="keep-with-next">
376
+ <data type="boolean"/>
377
+ </attribute>
378
+ </optional>
379
+ <optional>
380
+ <attribute name="keep-lines-together">
381
+ <data type="boolean"/>
382
+ </attribute>
383
+ </optional>
384
+ <optional>
385
+ <attribute name="inequality">
386
+ <data type="boolean"/>
387
+ </attribute>
388
+ </optional>
389
+ <ref name="stem"/>
390
+ <optional>
391
+ <ref name="dl"/>
392
+ </optional>
393
+ <zeroOrMore>
394
+ <ref name="note"/>
395
+ </zeroOrMore>
396
+ </element>
397
+ </define>
398
+ <define name="ParagraphType">
399
+ <attribute name="id">
400
+ <data type="ID"/>
401
+ </attribute>
402
+ <optional>
403
+ <attribute name="align">
404
+ <ref name="Alignments"/>
405
+ </attribute>
406
+ </optional>
407
+ <optional>
408
+ <attribute name="keep-with-next">
409
+ <data type="boolean"/>
410
+ </attribute>
411
+ </optional>
412
+ <optional>
413
+ <attribute name="keep-lines-together">
414
+ <data type="boolean"/>
415
+ </attribute>
416
+ </optional>
417
+ <zeroOrMore>
418
+ <ref name="TextElement"/>
419
+ </zeroOrMore>
420
+ <zeroOrMore>
421
+ <ref name="note"/>
422
+ </zeroOrMore>
423
+ </define>
424
+ <define name="paragraph-with-footnote">
425
+ <element name="p">
426
+ <attribute name="id">
427
+ <data type="ID"/>
428
+ </attribute>
429
+ <optional>
430
+ <attribute name="align">
431
+ <ref name="Alignments"/>
432
+ </attribute>
433
+ </optional>
434
+ <optional>
435
+ <attribute name="keep-with-next">
436
+ <data type="boolean"/>
437
+ </attribute>
438
+ </optional>
439
+ <optional>
440
+ <attribute name="keep-lines-together">
441
+ <data type="boolean"/>
442
+ </attribute>
443
+ </optional>
444
+ <zeroOrMore>
445
+ <choice>
446
+ <ref name="TextElement"/>
447
+ <ref name="fn"/>
448
+ </choice>
449
+ </zeroOrMore>
450
+ <zeroOrMore>
451
+ <ref name="note"/>
452
+ </zeroOrMore>
453
+ </element>
454
+ </define>
455
+ <define name="quote">
456
+ <element name="quote">
457
+ <attribute name="id">
458
+ <data type="ID"/>
459
+ </attribute>
460
+ <optional>
461
+ <attribute name="alignment">
462
+ <ref name="Alignments"/>
463
+ </attribute>
464
+ </optional>
465
+ <optional>
466
+ <attribute name="keep-with-next">
467
+ <data type="boolean"/>
468
+ </attribute>
469
+ </optional>
470
+ <optional>
471
+ <attribute name="keep-lines-together">
472
+ <data type="boolean"/>
473
+ </attribute>
474
+ </optional>
475
+ <optional>
476
+ <ref name="quote-source"/>
477
+ </optional>
478
+ <optional>
479
+ <ref name="quote-author"/>
480
+ </optional>
481
+ <oneOrMore>
482
+ <ref name="paragraph-with-footnote"/>
483
+ </oneOrMore>
484
+ <zeroOrMore>
485
+ <ref name="note"/>
486
+ </zeroOrMore>
487
+ </element>
488
+ </define>
100
489
  <define name="BibDataExtensionType">
101
490
  <ref name="doctype"/>
102
491
  <optional>
@@ -165,6 +554,30 @@
165
554
  <attribute name="id">
166
555
  <data type="ID"/>
167
556
  </attribute>
557
+ <optional>
558
+ <attribute name="unnumbered">
559
+ <data type="boolean"/>
560
+ </attribute>
561
+ </optional>
562
+ <optional>
563
+ <attribute name="number"/>
564
+ </optional>
565
+ <optional>
566
+ <attribute name="subsequence"/>
567
+ </optional>
568
+ <optional>
569
+ <attribute name="keep-with-next">
570
+ <data type="boolean"/>
571
+ </attribute>
572
+ </optional>
573
+ <optional>
574
+ <attribute name="keep-lines-together">
575
+ <data type="boolean"/>
576
+ </attribute>
577
+ </optional>
578
+ <optional>
579
+ <attribute name="type"/>
580
+ </optional>
168
581
  <oneOrMore>
169
582
  <choice>
170
583
  <ref name="paragraph"/>
@@ -172,6 +585,8 @@
172
585
  <ref name="ol"/>
173
586
  <ref name="dl"/>
174
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
175
590
  </choice>
176
591
  </oneOrMore>
177
592
  </element>
@@ -255,6 +670,16 @@
255
670
  </choice>
256
671
  </attribute>
257
672
  </optional>
673
+ <optional>
674
+ <attribute name="valign">
675
+ <choice>
676
+ <value>top</value>
677
+ <value>middle</value>
678
+ <value>bottom</value>
679
+ <value>baseline</value>
680
+ </choice>
681
+ </attribute>
682
+ </optional>
258
683
  <choice>
259
684
  <zeroOrMore>
260
685
  <choice>
@@ -291,6 +716,16 @@
291
716
  </choice>
292
717
  </attribute>
293
718
  </optional>
719
+ <optional>
720
+ <attribute name="valign">
721
+ <choice>
722
+ <value>top</value>
723
+ <value>middle</value>
724
+ <value>bottom</value>
725
+ <value>baseline</value>
726
+ </choice>
727
+ </attribute>
728
+ </optional>
294
729
  <choice>
295
730
  <zeroOrMore>
296
731
  <choice>
@@ -428,6 +863,13 @@
428
863
  </define>
429
864
  <define name="standard-document">
430
865
  <element name="standard-document">
866
+ <attribute name="version"/>
867
+ <attribute name="type">
868
+ <choice>
869
+ <value>semantic</value>
870
+ <value>presentation</value>
871
+ </choice>
872
+ </attribute>
431
873
  <ref name="bibdata"/>
432
874
  <optional>
433
875
  <ref name="boilerplate"/>
@@ -449,7 +891,7 @@
449
891
  <oneOrMore>
450
892
  <choice>
451
893
  <ref name="content"/>
452
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
453
895
  <ref name="foreword"/>
454
896
  <ref name="introduction"/>
455
897
  <ref name="acknowledgements"/>
@@ -516,6 +958,9 @@
516
958
  <optional>
517
959
  <attribute name="script"/>
518
960
  </optional>
961
+ <optional>
962
+ <attribute name="type"/>
963
+ </optional>
519
964
  <optional>
520
965
  <attribute name="obligation">
521
966
  <choice>
@@ -555,9 +1000,6 @@
555
1000
  </define>
556
1001
  <define name="content-subsection">
557
1002
  <element name="clause">
558
- <optional>
559
- <attribute name="type"/>
560
- </optional>
561
1003
  <ref name="Content-Section"/>
562
1004
  </element>
563
1005
  </define>
@@ -586,6 +1028,9 @@
586
1028
  </choice>
587
1029
  </attribute>
588
1030
  </optional>
1031
+ <optional>
1032
+ <attribute name="type"/>
1033
+ </optional>
589
1034
  <optional>
590
1035
  <ref name="section-title"/>
591
1036
  </optional>
@@ -605,9 +1050,6 @@
605
1050
  </define>
606
1051
  <define name="clause">
607
1052
  <element name="clause">
608
- <optional>
609
- <attribute name="type"/>
610
- </optional>
611
1053
  <ref name="Clause-Section"/>
612
1054
  </element>
613
1055
  </define>
@@ -636,18 +1078,24 @@
636
1078
  </choice>
637
1079
  </attribute>
638
1080
  </optional>
1081
+ <optional>
1082
+ <attribute name="type"/>
1083
+ </optional>
639
1084
  <optional>
640
1085
  <ref name="section-title"/>
641
1086
  </optional>
642
1087
  <group>
643
- <group>
644
- <zeroOrMore>
645
- <ref name="BasicBlock"/>
646
- </zeroOrMore>
647
- <zeroOrMore>
648
- <ref name="note"/>
649
- </zeroOrMore>
650
- </group>
1088
+ <choice>
1089
+ <group>
1090
+ <zeroOrMore>
1091
+ <ref name="BasicBlock"/>
1092
+ </zeroOrMore>
1093
+ <zeroOrMore>
1094
+ <ref name="note"/>
1095
+ </zeroOrMore>
1096
+ </group>
1097
+ <ref name="amend"/>
1098
+ </choice>
651
1099
  <zeroOrMore>
652
1100
  <choice>
653
1101
  <ref name="clause-subsection"/>
@@ -774,6 +1222,9 @@
774
1222
  <optional>
775
1223
  <attribute name="script"/>
776
1224
  </optional>
1225
+ <optional>
1226
+ <attribute name="type"/>
1227
+ </optional>
777
1228
  <optional>
778
1229
  <attribute name="obligation">
779
1230
  <choice>
@@ -910,6 +1361,27 @@
910
1361
  <attribute name="id">
911
1362
  <data type="ID"/>
912
1363
  </attribute>
1364
+ <optional>
1365
+ <attribute name="unnumbered">
1366
+ <data type="boolean"/>
1367
+ </attribute>
1368
+ </optional>
1369
+ <optional>
1370
+ <attribute name="number"/>
1371
+ </optional>
1372
+ <optional>
1373
+ <attribute name="subsequence"/>
1374
+ </optional>
1375
+ <optional>
1376
+ <attribute name="keep-with-next">
1377
+ <data type="boolean"/>
1378
+ </attribute>
1379
+ </optional>
1380
+ <optional>
1381
+ <attribute name="keep-lines-together">
1382
+ <data type="boolean"/>
1383
+ </attribute>
1384
+ </optional>
913
1385
  <oneOrMore>
914
1386
  <choice>
915
1387
  <ref name="paragraph"/>
@@ -1020,11 +1492,6 @@
1020
1492
  </optional>
1021
1493
  </element>
1022
1494
  </define>
1023
- <define name="preface_abstract">
1024
- <element name="abstract">
1025
- <ref name="Basic-Section"/>
1026
- </element>
1027
- </define>
1028
1495
  <define name="term-clause">
1029
1496
  <element name="clause">
1030
1497
  <optional>
@@ -1074,4 +1541,79 @@
1074
1541
  <ref name="CitationType"/>
1075
1542
  </element>
1076
1543
  </define>
1544
+ <define name="amend">
1545
+ <element name="amend">
1546
+ <optional>
1547
+ <attribute name="id">
1548
+ <data type="ID"/>
1549
+ </attribute>
1550
+ </optional>
1551
+ <attribute name="change">
1552
+ <choice>
1553
+ <value>add</value>
1554
+ <value>modify</value>
1555
+ <value>delete</value>
1556
+ </choice>
1557
+ </attribute>
1558
+ <optional>
1559
+ <attribute name="path"/>
1560
+ </optional>
1561
+ <optional>
1562
+ <attribute name="path_end"/>
1563
+ </optional>
1564
+ <optional>
1565
+ <attribute name="title"/>
1566
+ </optional>
1567
+ <optional>
1568
+ <element name="location">
1569
+ <zeroOrMore>
1570
+ <ref name="locality"/>
1571
+ </zeroOrMore>
1572
+ </element>
1573
+ </optional>
1574
+ <zeroOrMore>
1575
+ <ref name="autonumber"/>
1576
+ </zeroOrMore>
1577
+ <optional>
1578
+ <element name="description">
1579
+ <zeroOrMore>
1580
+ <ref name="BasicBlock"/>
1581
+ </zeroOrMore>
1582
+ </element>
1583
+ </optional>
1584
+ <optional>
1585
+ <element name="newcontent">
1586
+ <zeroOrMore>
1587
+ <ref name="BasicBlock"/>
1588
+ </zeroOrMore>
1589
+ </element>
1590
+ </optional>
1591
+ <optional>
1592
+ <element name="description">
1593
+ <zeroOrMore>
1594
+ <ref name="BasicBlock"/>
1595
+ </zeroOrMore>
1596
+ </element>
1597
+ </optional>
1598
+ </element>
1599
+ </define>
1600
+ <define name="autonumber">
1601
+ <element name="autonumber">
1602
+ <attribute name="type">
1603
+ <choice>
1604
+ <value>requirement</value>
1605
+ <value>recommendation</value>
1606
+ <value>permission</value>
1607
+ <value>table</value>
1608
+ <value>figure</value>
1609
+ <value>admonition</value>
1610
+ <value>formula</value>
1611
+ <value>sourcecode</value>
1612
+ <value>example</value>
1613
+ <value>note</value>
1614
+ </choice>
1615
+ </attribute>
1616
+ <text/>
1617
+ </element>
1618
+ </define>
1077
1619
  </grammar>
@@ -253,7 +253,7 @@
253
253
  <define name="preface">
254
254
  <element name="preface">
255
255
  <optional>
256
- <ref name="preface_abstract"/>
256
+ <ref name="abstract"/>
257
257
  </optional>
258
258
  <ref name="foreword"/>
259
259
  <optional>
@@ -362,6 +362,9 @@
362
362
  <data type="boolean"/>
363
363
  </attribute>
364
364
  </optional>
365
+ <optional>
366
+ <attribute name="number"/>
367
+ </optional>
365
368
  <optional>
366
369
  <attribute name="subsequence"/>
367
370
  </optional>
@@ -402,6 +405,13 @@
402
405
  -->
403
406
  <define name="iso-standard">
404
407
  <element name="iso-standard">
408
+ <attribute name="version"/>
409
+ <attribute name="type">
410
+ <choice>
411
+ <value>semantic</value>
412
+ <value>presentation</value>
413
+ </choice>
414
+ </attribute>
405
415
  <ref name="bibdata"/>
406
416
  <zeroOrMore>
407
417
  <ref name="termdocsource"/>
@@ -1,3 +1,7 @@
1
+ require "relaton_iso_bib"
2
+ require "relaton_iec/hit"
3
+ require "nokogiri"
4
+ require "net/http"
1
5
  require "relaton_iec/version"
2
6
  require "relaton_iec/iec_bibliography"
3
7
  require "relaton_iec/iec_bibliographic_item"
@@ -22,7 +22,7 @@ module RelatonIec
22
22
  # @param opts [Hash] options; restricted to :all_parts if all-parts
23
23
  # reference is required
24
24
  # @return [String] Relaton XML serialisation of reference
25
- def get(code, year = nil, opts = {})
25
+ def get(code, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
26
26
  if year.nil?
27
27
  /^(?<code1>[^:]+):(?<year1>[^:]+)/ =~ code
28
28
  unless code1.nil?
@@ -45,27 +45,33 @@ module RelatonIec
45
45
 
46
46
  private
47
47
 
48
- def fetch_ref_err(code, year, missed_years)
48
+ def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
49
49
  id = year ? "#{code}:#{year}" : code
50
50
  warn "[relaton-iec] WARNING: no match found online for #{id}. "\
51
51
  "The code must be exactly like it is on the standards website."
52
- warn "[relaton-iec] (There was no match for #{year}, though there were matches "\
53
- "found for #{missed_years.join(', ')}.)" unless missed_years.empty?
54
- if /\d-\d/ =~ code
55
- warn "[relaton-iec] The provided document part may not exist, or the document "\
56
- "may no longer be published in parts."
52
+ unless missed_years.empty?
53
+ warn "[relaton-iec] (There was no match for #{year}, though there "\
54
+ "were matches found for #{missed_years.join(', ')}.)"
55
+ end
56
+ if /\d-\d/.match? code
57
+ warn "[relaton-iec] The provided document part may not exist, or "\
58
+ "the document may no longer be published in parts."
57
59
  else
58
- warn "[relaton-iec] If you wanted to cite all document parts for the reference, "\
59
- "use \"#{code} (all parts)\".\nIf the document is not a standard, "\
60
- "use its document type abbreviation (TS, TR, PAS, Guide)."
60
+ warn "[relaton-iec] If you wanted to cite all document parts for "\
61
+ "the reference, use \"#{code} (all parts)\".\nIf the document is "\
62
+ "not a standard, use its document type abbreviation (TS, TR, PAS, "\
63
+ "Guide)."
61
64
  end
62
65
  nil
63
66
  end
64
67
 
65
- def fetch_pages(s, n)
66
- workers = RelatonBib::WorkersPool.new n
68
+ # @param hits [Array<RelatonIec::Hit>]
69
+ # @param threads [Integer]
70
+ # @return [Array<RelatonIec::Hit>]
71
+ def fetch_pages(hits, threads)
72
+ workers = RelatonBib::WorkersPool.new threads
67
73
  workers.worker { |w| { i: w[:i], hit: w[:hit].fetch } }
68
- s.each_with_index { |hit, i| workers << { i: i, hit: hit } }
74
+ hits.each_with_index { |hit, i| workers << { i: i, hit: hit } }
69
75
  workers.end
70
76
  workers.result.sort_by { |a| a[:i] }.map { |x| x[:hit] }
71
77
  end
@@ -83,45 +89,47 @@ module RelatonIec
83
89
  end
84
90
 
85
91
  def iev(code = "IEC 60050")
86
- RelatonIsoBib::XMLParser.from_xml(<<~"END")
87
- <bibitem>
88
- <fetched>#{Date.today}</fetched>
89
- <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
90
- <link type="src">http://www.electropedia.org</link>
91
- <docidentifier>#{code}:2011</docidentifier>
92
- <date type="published"><on>2011</on></date>
93
- <contributor>
94
- <role type="publisher"/>
95
- <organization>
96
- <name>International Electrotechnical Commission</name>
97
- <abbreviation>IEC</abbreviation>
98
- <uri>www.iec.ch</uri>
99
- </organization>
100
- </contributor>
101
- <language>en</language> <language>fr</language>
102
- <script>Latn</script>
103
- <status> <stage>60</stage> </status>
104
- <copyright>
105
- <from>2018</from>
106
- <owner>
107
- <organization>
108
- <name>International Electrotechnical Commission</name>
109
- <abbreviation>IEC</abbreviation>
110
- <uri>www.iec.ch</uri>
111
- </organization>
112
- </owner>
113
- </copyright>
114
- </bibitem>
115
- END
92
+ RelatonIsoBib::XMLParser.from_xml(<<~"XML")
93
+ <bibitem>
94
+ <fetched>#{Date.today}</fetched>
95
+ <title format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary</title>
96
+ <link type="src">http://www.electropedia.org</link>
97
+ <docidentifier>#{code}:2011</docidentifier>
98
+ <date type="published"><on>2011</on></date>
99
+ <contributor>
100
+ <role type="publisher"/>
101
+ <organization>
102
+ <name>International Electrotechnical Commission</name>
103
+ <abbreviation>IEC</abbreviation>
104
+ <uri>www.iec.ch</uri>
105
+ </organization>
106
+ </contributor>
107
+ <language>en</language> <language>fr</language>
108
+ <script>Latn</script>
109
+ <status> <stage>60</stage> </status>
110
+ <copyright>
111
+ <from>2018</from>
112
+ <owner>
113
+ <organization>
114
+ <name>International Electrotechnical Commission</name>
115
+ <abbreviation>IEC</abbreviation>
116
+ <uri>www.iec.ch</uri>
117
+ </organization>
118
+ </owner>
119
+ </copyright>
120
+ </bibitem>
121
+ XML
116
122
  end
117
123
 
118
124
  # Sort through the results from Isobib, fetching them three at a time,
119
125
  # and return the first result that matches the code,
120
- # matches the year (if provided), and which # has a title (amendments do not).
126
+ # matches the year (if provided), and which
127
+ # has a title (amendments do not).
121
128
  # Only expects the first page of results to be populated.
122
129
  # Does not match corrigenda etc (e.g. ISO 3166-1:2006/Cor 1:2007)
123
- # If no match, returns any years which caused mismatch, for error reporting
124
- def isobib_results_filter(result, year)
130
+ # If no match, returns any years which caused mismatch, for error
131
+ # reporting
132
+ def isobib_results_filter(result, year) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
125
133
  missed_years = []
126
134
  result.each_slice(3) do |s| # ISO website only allows 3 connections
127
135
  fetch_pages(s, 3).each_with_index do |r, _i|
@@ -143,7 +151,8 @@ module RelatonIec
143
151
  result = isobib_search_filter(code) || return
144
152
  ret = isobib_results_filter(result, year)
145
153
  if ret[:ret]
146
- warn "[relaton-iec] (\"#{code}\") found #{ret[:ret].docidentifier.first.id}"
154
+ warn "[relaton-iec] (\"#{code}\") found "\
155
+ "#{ret[:ret].docidentifier.first.id}"
147
156
  ret[:ret]
148
157
  else
149
158
  fetch_ref_err(code, year, ret[:years])
@@ -1,10 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "relaton_iso_bib"
4
- require "relaton_iec/hit"
5
- require "nokogiri"
6
- require "net/http"
7
-
8
3
  # Capybara.request_driver :poltergeist do |app|
9
4
  # Capybara::Poltergeist::Driver.new app, js_errors: false
10
5
  # end
@@ -12,7 +7,6 @@ require "net/http"
12
7
 
13
8
  module RelatonIec
14
9
  # Scrapper.
15
- # rubocop:disable Metrics/ModuleLength
16
10
  module Scrapper
17
11
  DOMAIN = "https://webstore.iec.ch"
18
12
 
@@ -35,21 +29,21 @@ module RelatonIec
35
29
  # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
36
30
 
37
31
  # Parse page.
38
- # @param hit [Hash]
32
+ # @param hit_data [Hash]
39
33
  # @return [Hash]
40
34
  def parse_page(hit_data)
41
35
  doc = get_page hit_data[:url]
42
36
 
43
37
  # Fetch edition.
44
38
  edition = doc.at(
45
- "//th[contains(., 'Edition')]/following-sibling::td/span",
39
+ "//th[contains(., 'Edition')]/following-sibling::td/span"
46
40
  ).text
47
41
 
48
42
  status, relations = fetch_status_relations hit_data[:url]
49
43
 
50
44
  IecBibliographicItem.new(
51
45
  fetched: Date.today.to_s,
52
- docid: [RelatonBib::DocumentIdentifier.new(id: hit_data[:code], type: "IEC")],
46
+ docid: fetch_docid(hit_data),
53
47
  structuredidentifier: fetch_structuredidentifier(doc),
54
48
  edition: edition,
55
49
  language: ["en"],
@@ -65,13 +59,48 @@ module RelatonIec
65
59
  copyright: fetch_copyright(hit_data[:code], doc),
66
60
  link: fetch_link(doc, hit_data[:url]),
67
61
  relation: relations,
68
- place: ["Geneva"],
62
+ place: ["Geneva"]
69
63
  )
70
64
  end
71
65
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
72
66
 
73
67
  private
74
68
 
69
+ # @param hit [Hash]
70
+ # @return [Array<RelatonBib::DocumentIdentifier>]
71
+ def fetch_docid(hit)
72
+ rest = hit[:code].downcase.sub(%r{
73
+ (?<head>[^\s]+)\s
74
+ (?<type>is|ts|tr|pas|srd|guide|tec|wp)?(?(<type>)\s)
75
+ (?<pnum>[\d-]+)\s?
76
+ (?<_dd>:)?(?(<_dd>)(?<date>[\d-]+)\s?)
77
+ }x, "")
78
+ m = $~
79
+ deliv = /cmv|csv|exv|prv|rlv|ser/.match(hit[:code].downcase).to_s
80
+ urn = ["urn", "iec", "std", m[:head].split("/").join("-"), m[:pnum],
81
+ m[:date], m[:type], deliv, "en"]
82
+ urn += fetch_ajunct(rest)
83
+ [
84
+ RelatonBib::DocumentIdentifier.new(id: hit[:code], type: "IEC"),
85
+ RelatonBib::DocumentIdentifier.new(id: urn.join(":"), type: "URN"),
86
+ ]
87
+ end
88
+
89
+ # @param rest [String]
90
+ # @return [Array<String, nil>]
91
+ def fetch_ajunct(rest)
92
+ r = rest.sub(%r{
93
+ (?<_pl>\+)(?(<_pl>)(?<adjunct>amd)(?<adjnum>\d+)\s?)
94
+ (?<_d2>:)?(?(<_d2>)(?<adjdt>[\d-]+)\s?)
95
+ }x, "")
96
+ m = $~ || {}
97
+ return [] unless m[:adjunct]
98
+
99
+ plus = m[:adjunct] && "plus"
100
+ urn = [plus, m[:adjunct], m[:adjnum], m[:adjdt]]
101
+ urn + fetch_ajunct(r)
102
+ end
103
+
75
104
  # Fetch abstracts.
76
105
  # @param doc [Nokigiri::HTML::Document]
77
106
  # @return [Array<Array>]
@@ -117,12 +146,12 @@ module RelatonIec
117
146
  item_ref = doc.at("//span[@itemprop='productID']")
118
147
  unless item_ref
119
148
  return RelatonIsoBib::StructuredIdentifier.new(
120
- project_number: "?", part_number: "", prefix: nil, id: "?",
149
+ project_number: "?", part_number: "", prefix: nil, id: "?"
121
150
  )
122
151
  end
123
152
 
124
153
  m = item_ref.text.match(
125
- /(?<=\s)(?<project>\d+)-?(?<part>(?<=-)\d+|)-?(?<subpart>(?<=-)\d+|)/,
154
+ /(?<=\s)(?<project>\d+)-?(?<part>(?<=-)\d+|)-?(?<subpart>(?<=-)\d+|)/
126
155
  )
127
156
  RelatonIsoBib::StructuredIdentifier.new(
128
157
  project_number: m[:project],
@@ -130,7 +159,7 @@ module RelatonIec
130
159
  subpart_number: m[:subpart],
131
160
  prefix: nil,
132
161
  type: "IEC",
133
- id: item_ref.text,
162
+ id: item_ref.text
134
163
  )
135
164
  end
136
165
 
@@ -174,8 +203,8 @@ module RelatonIec
174
203
  # @return [Array<Hash>]
175
204
  # rubocop:disable Metrics/MethodLength
176
205
  def fetch_relations(doc)
177
- doc.xpath('//ROW[STATUS[.!="PREPARING"]][STATUS[.!="PUBLISHED"]]').
178
- map do |r|
206
+ doc.xpath('//ROW[STATUS[.!="PREPARING"]][STATUS[.!="PUBLISHED"]]')
207
+ .map do |r|
179
208
  r_type = r.at("STATUS").text.downcase
180
209
  type = case r_type
181
210
  # when 'published' then 'obsoletes' # Valid
@@ -184,7 +213,7 @@ module RelatonIec
184
213
  else r_type
185
214
  end
186
215
  fref = RelatonBib::FormattedRef.new(
187
- content: r.at("FULL_NAME").text, format: "text/plain",
216
+ content: r.at("FULL_NAME").text, format: "text/plain"
188
217
  )
189
218
  bibitem = IecBibliographicItem.new(formattedref: fref)
190
219
  { type: type, bibitem: bibitem }
@@ -209,46 +238,16 @@ module RelatonIec
209
238
  # @return [String]
210
239
  def fetch_type(doc)
211
240
  doc.at(
212
- '//th[contains(., "Publication type")]/following-sibling::td/span',
241
+ '//th[contains(., "Publication type")]/following-sibling::td/span'
213
242
  ).text.downcase.tr " ", "-"
214
243
  end
215
244
 
216
- # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
217
-
218
245
  # Fetch titles.
219
246
  # @param hit_data [Hash]
220
247
  # @return [Array<Hash>]
221
248
  def fetch_titles(hit_data)
222
- titles = hit_data[:title].split " - "
223
- case titles.size
224
- when 0
225
- intro, main, part = nil, "", nil
226
- when 1
227
- intro, main, part = nil, titles[0], nil
228
- when 2
229
- if /^(Part|Partie) \d+:/ =~ titles[1]
230
- intro, main, part = nil, titles[0], titles[1]
231
- else
232
- intro, main, part = titles[0], titles[1], nil
233
- end
234
- when 3
235
- if /^(Part|Partie) \d+:/ =~ titles[1]
236
- intro, main, part = nil, titles[0], titles[1..2].join(" - ")
237
- else
238
- intro, main, part = titles[0], titles[1], titles[2]
239
- end
240
- else
241
- intro, main, part = titles[0], titles[1], titles[2..-1]&.join(" -- ")
242
- end
243
- [{
244
- title_intro: intro,
245
- title_main: main,
246
- title_part: part,
247
- language: "en",
248
- script: "Latn",
249
- }]
249
+ RelatonBib::TypedTitleString.from_string hit_data[:title], "en", "Latn"
250
250
  end
251
- # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
252
251
 
253
252
  # Fetch dates
254
253
  # @param doc [Nokogiri::HTML::Document]
@@ -285,7 +284,7 @@ module RelatonIec
285
284
  # @return [Array<Hash>]
286
285
  def fetch_ics(doc)
287
286
  doc.xpath(
288
- '//th[contains(text(), "ICS")]/following-sibling::td/a',
287
+ '//th[contains(text(), "ICS")]/following-sibling::td/a'
289
288
  ).map do |i|
290
289
  code = i.text.match(/[\d\.]+/).to_s.split "."
291
290
  { field: code[0], group: code[1], subgroup: code[2] }
@@ -317,8 +316,8 @@ module RelatonIec
317
316
  end
318
317
  from = code.match(/(?<=:)\d{4}/).to_s
319
318
  if from.empty?
320
- from = doc.xpath("//span[@itemprop='releaseDate']").text.
321
- match(/\d{4}/).to_s
319
+ from = doc.xpath("//span[@itemprop='releaseDate']").text
320
+ .match(/\d{4}/).to_s
322
321
  end
323
322
  [{
324
323
  owner: [{ name: name, abbreviation: abbreviation, url: url }],
@@ -328,5 +327,4 @@ module RelatonIec
328
327
  # rubocop:enable Metrics/MethodLength
329
328
  end
330
329
  end
331
- # rubocop:enable Metrics/ModuleLength
332
330
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.1.0".freeze
2
+ VERSION = "1.5.0".freeze
3
3
  end
@@ -35,5 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "webmock"
36
36
 
37
37
  spec.add_dependency "addressable"
38
- spec.add_dependency "relaton-iso-bib", "~> 1.1.0"
38
+ spec.add_dependency "relaton-iso-bib", "~> 1.5.0"
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-03 00:00:00.000000000 Z
11
+ date: 2020-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 1.1.0
173
+ version: 1.5.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - "~>"
179
179
  - !ruby/object:Gem::Version
180
- version: 1.1.0
180
+ version: 1.5.0
181
181
  description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
182
182
  model'
183
183
  email:
@@ -220,7 +220,7 @@ homepage: https://github.com/metanorma/relaton-iec
220
220
  licenses:
221
221
  - MIT
222
222
  metadata: {}
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
236
236
  version: '0'
237
237
  requirements: []
238
238
  rubygems_version: 3.0.6
239
- signing_key:
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
242
242
  model'