metanorma-iec 1.2.1 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +44 -0
  3. data/lib/asciidoctor/iec/basicdoc.rng +23 -0
  4. data/lib/asciidoctor/iec/converter.rb +1 -0
  5. data/lib/asciidoctor/iec/front.rb +9 -7
  6. data/lib/asciidoctor/iec/iec.rng +7 -0
  7. data/lib/asciidoctor/iec/isodoc.rng +125 -58
  8. data/lib/asciidoctor/iec/isostandard.rng +8 -1
  9. data/lib/isodoc/iec/base_convert.rb +0 -20
  10. data/lib/isodoc/iec/html/htmlstyle.css +5 -1
  11. data/lib/isodoc/iec/html/isodoc.css +16 -4
  12. data/lib/isodoc/iec/html/isodoc.scss +19 -4
  13. data/lib/isodoc/iec/html/wordstyle.css +10 -10
  14. data/lib/isodoc/iec/html/wordstyle.scss +15 -10
  15. data/lib/isodoc/iec/iec.international-standard.xsl +1279 -391
  16. data/lib/metanorma/iec/version.rb +1 -1
  17. data/metanorma-iec.gemspec +1 -1
  18. data/spec/asciidoctor-iec/base_spec.rb +14 -5
  19. data/spec/asciidoctor-iec/cleanup_spec.rb +30 -6
  20. data/spec/asciidoctor-iec/iev_spec.rb +3 -3
  21. data/spec/asciidoctor-iec/inline_spec.rb +7 -1
  22. data/spec/asciidoctor-iec/validate_spec.rb +21 -1
  23. data/spec/assets/xref_error.adoc +7 -0
  24. data/spec/isodoc/blocks_spec.rb +1 -1
  25. data/spec/isodoc/i18n_spec.rb +9 -9
  26. data/spec/isodoc/iev_spec.rb +13 -17
  27. data/spec/isodoc/inline_spec.rb +1 -1
  28. data/spec/isodoc/metadata_spec.rb +36 -23
  29. data/spec/isodoc/ref_spec.rb +15 -15
  30. data/spec/isodoc/section_spec.rb +2 -2
  31. data/spec/isodoc/terms_spec.rb +1 -1
  32. data/spec/spec_helper.rb +5 -1
  33. metadata +6 -7
  34. data/.github/workflows/macos.yml +0 -38
  35. data/.github/workflows/ubuntu.yml +0 -56
  36. data/.github/workflows/windows.yml +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6954eeb16e4eacebb2da8b23af6e8e539d94e057dcb307a3bed74e605f12511
4
- data.tar.gz: 59bbd02eea1ee16223631ce0a21feabfbb5ce37381cafb84ff079bdb223cb6f4
3
+ metadata.gz: 065b3fdee8a57faf2f698c80f57ece1e0c234b10833e3187cb879bb683778257
4
+ data.tar.gz: 12ca28a168eab53a8970421542b883e06c638a535f0648cc7d64babcba4a1314
5
5
  SHA512:
6
- metadata.gz: 376cbd9860701e0e7d191ea4af5918b341633c072ea78dac21f94fcc06beb1ce33c980715ef03d5d2f7a3776593fffb4e41a41b0a889275bbc0d48ff24db5da9
7
- data.tar.gz: 74603e98c28bed3c4e7c97f28ab94eccbfbd54895207c8cd83f192c751f3194d280e426714f5fd1fe6d412c38c4118c3af063de6cc319819707244c1e979ad77
6
+ metadata.gz: 164fecc81e42574d17b366f0f04fde0e12476197fa9d7866d9652854fd181c2eb90a08fffa7ef30d5c7382f6caf318069fef95426a28314be7d22e7d0a105e5e
7
+ data.tar.gz: dda40f72589b9a8de4ae3a56a86101a480c1e570880962bec551410e190fc2b5a0d83383124037f5135ef419e0a901a0a68626fb5241da5f33b7ed9c1ccf4217
@@ -0,0 +1,44 @@
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 ]
8
+ pull_request:
9
+
10
+ jobs:
11
+ rake:
12
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ continue-on-error: ${{ matrix.experimental }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
20
+ experimental: [ false ]
21
+ include:
22
+ - ruby: '2.7'
23
+ os: 'ubuntu-latest'
24
+ experimental: true
25
+ - ruby: '2.7'
26
+ os: 'windows-latest'
27
+ experimental: true
28
+ - ruby: '2.7'
29
+ os: 'macos-latest'
30
+ experimental: true
31
+ steps:
32
+ - uses: actions/checkout@master
33
+
34
+ - name: Use Ruby
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+
40
+ - name: Update gems
41
+ run: bundle install --jobs 4 --retry 3
42
+
43
+ - name: Run specs
44
+ run: bundle exec rake
@@ -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
@@ -3,31 +3,33 @@ module Asciidoctor
3
3
  class Converter < ISO::Converter
4
4
  def metadata_author(node, xml)
5
5
  publishers = node.attr("publisher") || "IEC"
6
- publishers.split(/,[ ]?/).each do |p|
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
13
13
 
14
14
  def metadata_publisher(node, xml)
15
15
  publishers = node.attr("publisher") || "IEC"
16
- publishers.split(/,[ ]?/).each do |p|
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
23
23
 
24
24
  def metadata_copyright(node, xml)
25
- publishers = node.attr("publisher") || "IEC"
26
- publishers.split(/,[ ]?/).each do |p|
25
+ publishers = node.attr("copyright-holder") || node.attr("publisher") || "IEC"
26
+ csv_split(publishers)&.each do |p|
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"/>
@@ -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,6 +63,11 @@
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>
@@ -578,6 +585,8 @@
578
585
  <ref name="ol"/>
579
586
  <ref name="dl"/>
580
587
  <ref name="formula"/>
588
+ <ref name="quote"/>
589
+ <ref name="sourcecode"/>
581
590
  </choice>
582
591
  </oneOrMore>
583
592
  </element>
@@ -661,6 +670,16 @@
661
670
  </choice>
662
671
  </attribute>
663
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>
664
683
  <choice>
665
684
  <zeroOrMore>
666
685
  <choice>
@@ -697,6 +716,16 @@
697
716
  </choice>
698
717
  </attribute>
699
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>
700
729
  <choice>
701
730
  <zeroOrMore>
702
731
  <choice>
@@ -834,6 +863,13 @@
834
863
  </define>
835
864
  <define name="standard-document">
836
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>
837
873
  <ref name="bibdata"/>
838
874
  <optional>
839
875
  <ref name="boilerplate"/>
@@ -855,7 +891,7 @@
855
891
  <oneOrMore>
856
892
  <choice>
857
893
  <ref name="content"/>
858
- <ref name="preface_abstract"/>
894
+ <ref name="abstract"/>
859
895
  <ref name="foreword"/>
860
896
  <ref name="introduction"/>
861
897
  <ref name="acknowledgements"/>
@@ -1049,14 +1085,17 @@
1049
1085
  <ref name="section-title"/>
1050
1086
  </optional>
1051
1087
  <group>
1052
- <group>
1053
- <zeroOrMore>
1054
- <ref name="BasicBlock"/>
1055
- </zeroOrMore>
1056
- <zeroOrMore>
1057
- <ref name="note"/>
1058
- </zeroOrMore>
1059
- </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>
1060
1099
  <zeroOrMore>
1061
1100
  <choice>
1062
1101
  <ref name="clause-subsection"/>
@@ -1125,49 +1164,7 @@
1125
1164
  </define>
1126
1165
  <define name="annex">
1127
1166
  <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>
1167
+ <ref name="Annex-Section"/>
1171
1168
  </element>
1172
1169
  </define>
1173
1170
  <define name="terms">
@@ -1453,11 +1450,6 @@
1453
1450
  </optional>
1454
1451
  </element>
1455
1452
  </define>
1456
- <define name="preface_abstract">
1457
- <element name="abstract">
1458
- <ref name="Basic-Section"/>
1459
- </element>
1460
- </define>
1461
1453
  <define name="term-clause">
1462
1454
  <element name="clause">
1463
1455
  <optional>
@@ -1507,4 +1499,79 @@
1507
1499
  <ref name="CitationType"/>
1508
1500
  </element>
1509
1501
  </define>
1502
+ <define name="amend">
1503
+ <element name="amend">
1504
+ <optional>
1505
+ <attribute name="id">
1506
+ <data type="ID"/>
1507
+ </attribute>
1508
+ </optional>
1509
+ <attribute name="change">
1510
+ <choice>
1511
+ <value>add</value>
1512
+ <value>modify</value>
1513
+ <value>delete</value>
1514
+ </choice>
1515
+ </attribute>
1516
+ <optional>
1517
+ <attribute name="path"/>
1518
+ </optional>
1519
+ <optional>
1520
+ <attribute name="path_end"/>
1521
+ </optional>
1522
+ <optional>
1523
+ <attribute name="title"/>
1524
+ </optional>
1525
+ <optional>
1526
+ <element name="location">
1527
+ <zeroOrMore>
1528
+ <ref name="locality"/>
1529
+ </zeroOrMore>
1530
+ </element>
1531
+ </optional>
1532
+ <zeroOrMore>
1533
+ <ref name="autonumber"/>
1534
+ </zeroOrMore>
1535
+ <optional>
1536
+ <element name="description">
1537
+ <zeroOrMore>
1538
+ <ref name="BasicBlock"/>
1539
+ </zeroOrMore>
1540
+ </element>
1541
+ </optional>
1542
+ <optional>
1543
+ <element name="newcontent">
1544
+ <zeroOrMore>
1545
+ <ref name="BasicBlock"/>
1546
+ </zeroOrMore>
1547
+ </element>
1548
+ </optional>
1549
+ <optional>
1550
+ <element name="description">
1551
+ <zeroOrMore>
1552
+ <ref name="BasicBlock"/>
1553
+ </zeroOrMore>
1554
+ </element>
1555
+ </optional>
1556
+ </element>
1557
+ </define>
1558
+ <define name="autonumber">
1559
+ <element name="autonumber">
1560
+ <attribute name="type">
1561
+ <choice>
1562
+ <value>requirement</value>
1563
+ <value>recommendation</value>
1564
+ <value>permission</value>
1565
+ <value>table</value>
1566
+ <value>figure</value>
1567
+ <value>admonition</value>
1568
+ <value>formula</value>
1569
+ <value>sourcecode</value>
1570
+ <value>example</value>
1571
+ <value>note</value>
1572
+ </choice>
1573
+ </attribute>
1574
+ <text/>
1575
+ </element>
1576
+ </define>
1510
1577
  </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>
@@ -405,6 +405,13 @@
405
405
  -->
406
406
  <define name="iso-standard">
407
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>
408
415
  <ref name="bibdata"/>
409
416
  <zeroOrMore>
410
417
  <ref name="termdocsource"/>
@@ -52,21 +52,6 @@ module IsoDoc
52
52
  out.p(**{ class: "zzSTDTitle1" }) { |p| p << "&nbsp;" }
53
53
  end
54
54
 
55
- =begin
56
- def introduction(isoxml, out)
57
- return super unless @is_iev
58
- f = isoxml.at(ns("//introduction")) || return
59
- title_attr = { class: "IntroTitle" }
60
- page_break(out)
61
- out.div **{ class: "Section3", id: f["id"] } do |div|
62
- clause_name(nil, @i18n.get["introduction_iev"], div, title_attr)
63
- f.elements.each do |e|
64
- parse(e, div) unless e.name == "title"
65
- end
66
- end
67
- end
68
- =end
69
-
70
55
  def bibliography(isoxml, out)
71
56
  return super unless @is_iev
72
57
  end
@@ -137,11 +122,6 @@ module IsoDoc
137
122
  term_suffix(node, p)
138
123
  end
139
124
  end
140
-
141
- def biblio_list(f, div, biblio)
142
- biblio = false
143
- super
144
- end
145
125
  end
146
126
  end
147
127
  end