metanorma-iec 1.2.2 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +63 -0
  3. data/README.adoc +3 -4
  4. data/lib/asciidoctor/iec/basicdoc.rng +23 -0
  5. data/lib/asciidoctor/iec/converter.rb +1 -0
  6. data/lib/asciidoctor/iec/front.rb +5 -3
  7. data/lib/asciidoctor/iec/iec.rng +7 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +138 -58
  9. data/lib/asciidoctor/iec/isostandard.rng +8 -1
  10. data/lib/isodoc/iec/base_convert.rb +0 -20
  11. data/lib/isodoc/iec/html/htmlstyle.css +5 -1
  12. data/lib/isodoc/iec/html/isodoc.css +16 -4
  13. data/lib/isodoc/iec/html/isodoc.scss +19 -4
  14. data/lib/isodoc/iec/html/wordstyle.css +10 -10
  15. data/lib/isodoc/iec/html/wordstyle.scss +15 -10
  16. data/lib/isodoc/iec/iec.international-standard.xsl +1212 -380
  17. data/lib/metanorma/iec/version.rb +1 -1
  18. data/metanorma-iec.gemspec +1 -1
  19. data/spec/asciidoctor-iec/base_spec.rb +14 -5
  20. data/spec/asciidoctor-iec/cleanup_spec.rb +27 -87
  21. data/spec/asciidoctor-iec/iev_spec.rb +3 -3
  22. data/spec/asciidoctor-iec/inline_spec.rb +7 -1
  23. data/spec/asciidoctor-iec/validate_spec.rb +21 -1
  24. data/spec/assets/xref_error.adoc +7 -0
  25. data/spec/isodoc/blocks_spec.rb +1 -1
  26. data/spec/isodoc/i18n_spec.rb +9 -9
  27. data/spec/isodoc/iev_spec.rb +13 -17
  28. data/spec/isodoc/inline_spec.rb +1 -1
  29. data/spec/isodoc/metadata_spec.rb +36 -23
  30. data/spec/isodoc/ref_spec.rb +17 -17
  31. data/spec/isodoc/section_spec.rb +2 -2
  32. data/spec/isodoc/terms_spec.rb +1 -1
  33. data/spec/spec_helper.rb +5 -1
  34. metadata +6 -7
  35. data/.github/workflows/macos.yml +0 -38
  36. data/.github/workflows/ubuntu.yml +0 -56
  37. data/.github/workflows/windows.yml +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45688db5644887e9b7ac5dc95fb4af57229a3c0d4b0cb1d931f19657e4473af7
4
- data.tar.gz: b0d43cd6942cc0eb05c847406b0ab971b11bc76973e271c7b533ce99d86072c9
3
+ metadata.gz: be313ed8f65e342c6adcaa1ff76274c73fdde6dac85574478738546a7ed053e2
4
+ data.tar.gz: ea8b8af41ee6a45908d6511c5bac96cac3abec5f26b804a829f35d394bc1d10b
5
5
  SHA512:
6
- metadata.gz: 3e7eec9b4315b9471bc74160b53c8317858f24b0fd9f4ea302798fd93d15dd05fc61717ea657555b67d7d790664bda8e0f93919aafbd53e9e531e97a6f0811a9
7
- data.tar.gz: 4304df37874a6fce41f69d88d85ada2e201a809137af439cad37ff76626a045367e8fb812b4c3fff639107bea49ba8bb545f61e69e4522476fe651fc6cf2f460
6
+ metadata.gz: 604b9cccc08a30d7b253abb751f0e5bd65802d29fdce52487d6691b0bc5618afe458fa90acfdfc84199f256aa42d3ea9936d8051a8a85198ceefb3288e96325a
7
+ data.tar.gz: 12f1f61274fb6ead57ca15578cccbe8f90bd34afa4c2b82074c4ebc1263fb7313c9e60f21809c1a05cd85a1f5a5cebfcc85e0d7a5bea2c8d9d5f7f456dd087ec
@@ -0,0 +1,63 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '2.7'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '2.7'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '2.7'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@master
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+
39
+ - uses: actions/cache@v1
40
+ with:
41
+ path: vendor/bundle
42
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
43
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
44
+
45
+ - run: bundle config set path 'vendor/bundle'
46
+
47
+ - run: bundle install --jobs 4 --retry 3
48
+
49
+ - run: bundle exec rake
50
+
51
+ notify:
52
+ name: Trigger notify workflow
53
+ needs: rake
54
+ runs-on: ubuntu-latest
55
+ steps:
56
+ - name: Trigger notify workflow
57
+ uses: Sibz/github-status-action@v1
58
+ with:
59
+ authToken: ${{ secrets.GITHUB_TOKEN }}
60
+ context: 'tests-passed-successfully'
61
+ description: 'Tests passed successfully'
62
+ state: 'success'
63
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,16 +1,15 @@
1
1
  = metanorma-iec: Metanorma processor for the International Electrotechnical Commission
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-iec.svg["Gem Version", link="https://rubygems.org/gems/metanorma-iec"]
4
- image:https://github.com/metanorma/metanorma-iec/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-iec/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-iec/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-iec/actions?workflow=windows"]
4
+ image:https://github.com/metanorma/metanorma-iec/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-iec/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-iec/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-iec"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-iec.svg["Pull Requests", link="https://github.com/metanorma/metanorma-iec/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-iec/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-iec/releases"]
10
8
 
11
9
  == Functionality
12
10
 
13
- This gem processes Metanorma documents into the IEC document class.
11
+ This gem processes https://www.metanorma.com[Metanorma documents] following
12
+ the Metanorma model for generating IEC standards.
14
13
 
15
14
  The gem is basically the https://github.com/metanorma/metanorma-iso gem, with some tweaking of rendering to meet the particular requirements of the IEC.
16
15
 
@@ -402,6 +402,16 @@
402
402
  </choice>
403
403
  </attribute>
404
404
  </optional>
405
+ <optional>
406
+ <attribute name="valign">
407
+ <choice>
408
+ <value>top</value>
409
+ <value>middle</value>
410
+ <value>bottom</value>
411
+ <value>baseline</value>
412
+ </choice>
413
+ </attribute>
414
+ </optional>
405
415
  <choice>
406
416
  <zeroOrMore>
407
417
  <ref name="TextElement"/>
@@ -429,6 +439,16 @@
429
439
  </choice>
430
440
  </attribute>
431
441
  </optional>
442
+ <optional>
443
+ <attribute name="valign">
444
+ <choice>
445
+ <value>top</value>
446
+ <value>middle</value>
447
+ <value>bottom</value>
448
+ <value>baseline</value>
449
+ </choice>
450
+ </attribute>
451
+ </optional>
432
452
  <choice>
433
453
  <zeroOrMore>
434
454
  <ref name="TextElement"/>
@@ -998,6 +1018,9 @@
998
1018
  <value>alphabet_upper</value>
999
1019
  </choice>
1000
1020
  </attribute>
1021
+ <optional>
1022
+ <attribute name="start"/>
1023
+ </optional>
1001
1024
  <oneOrMore>
1002
1025
  <ref name="li"/>
1003
1026
  </oneOrMore>
@@ -49,6 +49,7 @@ module Asciidoctor
49
49
  end
50
50
 
51
51
  def pdf_converter(node)
52
+ return if node.attr("no-pdf")
52
53
  node.nil? ? IsoDoc::Iec::PdfConvert.new({}) :
53
54
  IsoDoc::Iec::PdfConvert.new(doc_extract_attributes(node))
54
55
  end
@@ -6,7 +6,7 @@ module Asciidoctor
6
6
  csv_split(publishers)&.each do |p|
7
7
  xml.contributor do |c|
8
8
  c.role **{ type: "author" }
9
- c.organization { |a| organization(a, p) }
9
+ c.organization { |a| organization(a, p, node, !node.attr("publisher")) }
10
10
  end
11
11
  end
12
12
  end
@@ -16,7 +16,7 @@ module Asciidoctor
16
16
  csv_split(publishers)&.each do |p|
17
17
  xml.contributor do |c|
18
18
  c.role **{ type: "publisher" }
19
- c.organization { |a| organization(a, p) }
19
+ c.organization { |a| organization(a, p, node, !node.attr("publisher")) }
20
20
  end
21
21
  end
22
22
  end
@@ -27,7 +27,9 @@ module Asciidoctor
27
27
  xml.copyright do |c|
28
28
  c.from (node.attr("copyright-year") || Date.today.year)
29
29
  c.owner do |owner|
30
- owner.organization { |o| organization(o, p) }
30
+ owner.organization do |o|
31
+ organization(o, p, node, !node.attr("copyright-holder") || node.attr("publisher"))
32
+ end
31
33
  end
32
34
  end
33
35
  end
@@ -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"/>
@@ -24,6 +24,14 @@
24
24
  <start>
25
25
  <ref name="standard-document"/>
26
26
  </start>
27
+ <define name="doctype">
28
+ <element name="doctype">
29
+ <optional>
30
+ <attribute name="abbreviation"/>
31
+ </optional>
32
+ <ref name="DocumentType"/>
33
+ </element>
34
+ </define>
27
35
  <define name="hyperlink">
28
36
  <element name="link">
29
37
  <attribute name="target">
@@ -43,7 +51,9 @@
43
51
  <define name="xref">
44
52
  <element name="xref">
45
53
  <attribute name="target">
46
- <data type="IDREF"/>
54
+ <data type="string">
55
+ <param name="pattern">\i\c*|\c+#\c+</param>
56
+ </data>
47
57
  </attribute>
48
58
  <optional>
49
59
  <attribute name="type">
@@ -61,6 +71,11 @@
61
71
  </choice>
62
72
  </attribute>
63
73
  </optional>
74
+ <optional>
75
+ <attribute name="droploc">
76
+ <data type="boolean"/>
77
+ </attribute>
78
+ </optional>
64
79
  <text/>
65
80
  </element>
66
81
  </define>
@@ -134,6 +149,11 @@
134
149
  <data type="boolean"/>
135
150
  </attribute>
136
151
  </optional>
152
+ <optional>
153
+ <attribute name="key">
154
+ <data type="boolean"/>
155
+ </attribute>
156
+ </optional>
137
157
  <oneOrMore>
138
158
  <ref name="dt"/>
139
159
  <ref name="dd"/>
@@ -578,6 +598,8 @@
578
598
  <ref name="ol"/>
579
599
  <ref name="dl"/>
580
600
  <ref name="formula"/>
601
+ <ref name="quote"/>
602
+ <ref name="sourcecode"/>
581
603
  </choice>
582
604
  </oneOrMore>
583
605
  </element>
@@ -661,6 +683,16 @@
661
683
  </choice>
662
684
  </attribute>
663
685
  </optional>
686
+ <optional>
687
+ <attribute name="valign">
688
+ <choice>
689
+ <value>top</value>
690
+ <value>middle</value>
691
+ <value>bottom</value>
692
+ <value>baseline</value>
693
+ </choice>
694
+ </attribute>
695
+ </optional>
664
696
  <choice>
665
697
  <zeroOrMore>
666
698
  <choice>
@@ -697,6 +729,16 @@
697
729
  </choice>
698
730
  </attribute>
699
731
  </optional>
732
+ <optional>
733
+ <attribute name="valign">
734
+ <choice>
735
+ <value>top</value>
736
+ <value>middle</value>
737
+ <value>bottom</value>
738
+ <value>baseline</value>
739
+ </choice>
740
+ </attribute>
741
+ </optional>
700
742
  <choice>
701
743
  <zeroOrMore>
702
744
  <choice>
@@ -834,6 +876,13 @@
834
876
  </define>
835
877
  <define name="standard-document">
836
878
  <element name="standard-document">
879
+ <attribute name="version"/>
880
+ <attribute name="type">
881
+ <choice>
882
+ <value>semantic</value>
883
+ <value>presentation</value>
884
+ </choice>
885
+ </attribute>
837
886
  <ref name="bibdata"/>
838
887
  <optional>
839
888
  <ref name="boilerplate"/>
@@ -855,7 +904,7 @@
855
904
  <oneOrMore>
856
905
  <choice>
857
906
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
907
+ <ref name="abstract"/>
859
908
  <ref name="foreword"/>
860
909
  <ref name="introduction"/>
861
910
  <ref name="acknowledgements"/>
@@ -1049,14 +1098,17 @@
1049
1098
  <ref name="section-title"/>
1050
1099
  </optional>
1051
1100
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </group>
1101
+ <choice>
1102
+ <group>
1103
+ <zeroOrMore>
1104
+ <ref name="BasicBlock"/>
1105
+ </zeroOrMore>
1106
+ <zeroOrMore>
1107
+ <ref name="note"/>
1108
+ </zeroOrMore>
1109
+ </group>
1110
+ <ref name="amend"/>
1111
+ </choice>
1060
1112
  <zeroOrMore>
1061
1113
  <choice>
1062
1114
  <ref name="clause-subsection"/>
@@ -1125,49 +1177,7 @@
1125
1177
  </define>
1126
1178
  <define name="annex">
1127
1179
  <element name="annex">
1128
- <optional>
1129
- <attribute name="id">
1130
- <data type="ID"/>
1131
- </attribute>
1132
- </optional>
1133
- <optional>
1134
- <attribute name="language"/>
1135
- </optional>
1136
- <optional>
1137
- <attribute name="script"/>
1138
- </optional>
1139
- <optional>
1140
- <attribute name="inline-header">
1141
- <data type="boolean"/>
1142
- </attribute>
1143
- </optional>
1144
- <attribute name="obligation">
1145
- <choice>
1146
- <value>normative</value>
1147
- <value>informative</value>
1148
- </choice>
1149
- </attribute>
1150
- <optional>
1151
- <ref name="section-title"/>
1152
- </optional>
1153
- <group>
1154
- <group>
1155
- <zeroOrMore>
1156
- <ref name="BasicBlock"/>
1157
- </zeroOrMore>
1158
- <zeroOrMore>
1159
- <ref name="note"/>
1160
- </zeroOrMore>
1161
- </group>
1162
- <zeroOrMore>
1163
- <choice>
1164
- <ref name="annex-subsection"/>
1165
- <ref name="terms"/>
1166
- <ref name="definitions"/>
1167
- <ref name="references"/>
1168
- </choice>
1169
- </zeroOrMore>
1170
- </group>
1180
+ <ref name="Annex-Section"/>
1171
1181
  </element>
1172
1182
  </define>
1173
1183
  <define name="terms">
@@ -1453,11 +1463,6 @@
1453
1463
  </optional>
1454
1464
  </element>
1455
1465
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1466
  <define name="term-clause">
1462
1467
  <element name="clause">
1463
1468
  <optional>
@@ -1507,4 +1512,79 @@
1507
1512
  <ref name="CitationType"/>
1508
1513
  </element>
1509
1514
  </define>
1515
+ <define name="amend">
1516
+ <element name="amend">
1517
+ <optional>
1518
+ <attribute name="id">
1519
+ <data type="ID"/>
1520
+ </attribute>
1521
+ </optional>
1522
+ <attribute name="change">
1523
+ <choice>
1524
+ <value>add</value>
1525
+ <value>modify</value>
1526
+ <value>delete</value>
1527
+ </choice>
1528
+ </attribute>
1529
+ <optional>
1530
+ <attribute name="path"/>
1531
+ </optional>
1532
+ <optional>
1533
+ <attribute name="path_end"/>
1534
+ </optional>
1535
+ <optional>
1536
+ <attribute name="title"/>
1537
+ </optional>
1538
+ <optional>
1539
+ <element name="location">
1540
+ <zeroOrMore>
1541
+ <ref name="locality"/>
1542
+ </zeroOrMore>
1543
+ </element>
1544
+ </optional>
1545
+ <zeroOrMore>
1546
+ <ref name="autonumber"/>
1547
+ </zeroOrMore>
1548
+ <optional>
1549
+ <element name="description">
1550
+ <zeroOrMore>
1551
+ <ref name="BasicBlock"/>
1552
+ </zeroOrMore>
1553
+ </element>
1554
+ </optional>
1555
+ <optional>
1556
+ <element name="newcontent">
1557
+ <zeroOrMore>
1558
+ <ref name="BasicBlock"/>
1559
+ </zeroOrMore>
1560
+ </element>
1561
+ </optional>
1562
+ <optional>
1563
+ <element name="description">
1564
+ <zeroOrMore>
1565
+ <ref name="BasicBlock"/>
1566
+ </zeroOrMore>
1567
+ </element>
1568
+ </optional>
1569
+ </element>
1570
+ </define>
1571
+ <define name="autonumber">
1572
+ <element name="autonumber">
1573
+ <attribute name="type">
1574
+ <choice>
1575
+ <value>requirement</value>
1576
+ <value>recommendation</value>
1577
+ <value>permission</value>
1578
+ <value>table</value>
1579
+ <value>figure</value>
1580
+ <value>admonition</value>
1581
+ <value>formula</value>
1582
+ <value>sourcecode</value>
1583
+ <value>example</value>
1584
+ <value>note</value>
1585
+ </choice>
1586
+ </attribute>
1587
+ <text/>
1588
+ </element>
1589
+ </define>
1510
1590
  </grammar>