metanorma-iso 1.6.0 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +16 -29
  3. data/.rubocop.yml +0 -4
  4. data/lib/asciidoctor/iso/base.rb +13 -13
  5. data/lib/asciidoctor/iso/basicdoc.rng +5 -3
  6. data/lib/asciidoctor/iso/cleanup.rb +1 -1
  7. data/lib/asciidoctor/iso/front.rb +5 -5
  8. data/lib/asciidoctor/iso/isodoc.rng +134 -5
  9. data/lib/asciidoctor/iso/isostandard-amd.rng +11 -4
  10. data/lib/asciidoctor/iso/isostandard.rng +33 -107
  11. data/lib/asciidoctor/iso/validate.rb +79 -0
  12. data/lib/asciidoctor/iso/validate_section.rb +12 -9
  13. data/lib/isodoc/iso/base_convert.rb +11 -0
  14. data/lib/isodoc/iso/html/header.html +12 -12
  15. data/lib/isodoc/iso/html/html_iso_intro.html +1 -1
  16. data/lib/isodoc/iso/html/html_iso_titlepage.html +1 -1
  17. data/lib/isodoc/iso/html/word_iso_intro.html +1 -1
  18. data/lib/isodoc/iso/html/word_iso_titlepage.html +1 -1
  19. data/lib/isodoc/iso/html_convert.rb +2 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +6 -0
  21. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  22. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  23. data/lib/isodoc/iso/index.rb +139 -0
  24. data/lib/isodoc/iso/iso.amendment.xsl +1006 -317
  25. data/lib/isodoc/iso/iso.international-standard.xsl +1006 -317
  26. data/lib/isodoc/iso/presentation_xml_convert.rb +1 -4
  27. data/lib/isodoc/iso/sections.rb +1 -1
  28. data/lib/isodoc/iso/word_convert.rb +2 -2
  29. data/lib/isodoc/iso/xref.rb +33 -12
  30. data/lib/metanorma/iso/version.rb +1 -1
  31. data/metanorma-iso.gemspec +3 -3
  32. data/spec/asciidoctor/amd_spec.rb +696 -0
  33. data/spec/asciidoctor/base_spec.rb +704 -0
  34. data/spec/asciidoctor/blocks_spec.rb +527 -0
  35. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  36. data/spec/asciidoctor/inline_spec.rb +195 -0
  37. data/spec/asciidoctor/lists_spec.rb +197 -0
  38. data/spec/asciidoctor/refs_spec.rb +375 -0
  39. data/spec/asciidoctor/section_spec.rb +393 -0
  40. data/spec/asciidoctor/table_spec.rb +329 -0
  41. data/spec/asciidoctor/validate_spec.rb +1555 -0
  42. data/spec/isodoc/amd_spec.rb +967 -946
  43. data/spec/isodoc/blocks_spec.rb +530 -507
  44. data/spec/isodoc/i18n_spec.rb +953 -911
  45. data/spec/isodoc/inline_spec.rb +355 -293
  46. data/spec/isodoc/iso_spec.rb +340 -316
  47. data/spec/isodoc/metadata_spec.rb +392 -382
  48. data/spec/isodoc/postproc_spec.rb +834 -656
  49. data/spec/isodoc/ref_spec.rb +374 -331
  50. data/spec/isodoc/section_spec.rb +821 -519
  51. data/spec/isodoc/table_spec.rb +472 -411
  52. data/spec/isodoc/terms_spec.rb +209 -185
  53. data/spec/isodoc/xref_spec.rb +1370 -1236
  54. data/spec/metanorma/processor_spec.rb +28 -26
  55. data/spec/spec_helper.rb +184 -189
  56. metadata +22 -23
  57. data/.rubocop.ribose.yml +0 -66
  58. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  59. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  60. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  61. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  62. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  63. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  64. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  65. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  66. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  67. data/spec/asciidoctor-iso/validate_spec.rb +0 -1251
  68. data/spec/assets/xref_error.adoc +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9ff94c61e35de46dc7952d37bfff144de3138445e1deac3634627a2fa6f7a6a
4
- data.tar.gz: 053100705b2af0c4d3d26359948fa8ba23f811010b2096475664ee5b44c0d3dc
3
+ metadata.gz: 04b55e3ca534c69d32ca0f9379574e2ea64af41abdcfcd723532917cce1dbb11
4
+ data.tar.gz: 9a4910e86d2792bf82e863ed1d57cd0bd492667acc2eef5eaf0d7443b99fd730
5
5
  SHA512:
6
- metadata.gz: a093a518a812e1fea3f5053f287b589010fc896954ff6da4a9674c72c4d0db566095ba0702ac85b6ba519f23e2d0a09d8697d984c998dbda6759698c6075726c
7
- data.tar.gz: 45b6dcdb5783272457a495e8c4f2ea2a3c4fab3114d48a8c7d6917782db82f3ee573af34c903fd07cda28447373721dd7cdb83c519bca9ae74208f4f9a77bd8c
6
+ metadata.gz: cee47fc2106cf2573bb9c5d1198c230c0b9c1e350a8c12b5c1764eb683e058579619cbcb26c33a8cd4f838ccaccc7282ba1e990777d672c5b0b1269f0f950ce7
7
+ data.tar.gz: 4515aa0402dddc620a72837044e3c47a8864a2503109a57846037f96041f7a88d9c4dca652c7392b9ce1ab45d158922316d565b32b8c35a6dc2695b108da46c7
@@ -16,17 +16,17 @@ jobs:
16
16
  strategy:
17
17
  fail-fast: false
18
18
  matrix:
19
- ruby: [ '2.6', '2.5', '2.4' ]
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
20
  os: [ ubuntu-latest, windows-latest, macos-latest ]
21
21
  experimental: [ false ]
22
22
  include:
23
- - ruby: '2.7'
23
+ - ruby: '3.0'
24
24
  os: 'ubuntu-latest'
25
25
  experimental: true
26
- - ruby: '2.7'
26
+ - ruby: '3.0'
27
27
  os: 'windows-latest'
28
28
  experimental: true
29
- - ruby: '2.7'
29
+ - ruby: '3.0'
30
30
  os: 'macos-latest'
31
31
  experimental: true
32
32
  steps:
@@ -35,32 +35,19 @@ jobs:
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
38
39
 
39
- - uses: actions/cache@v2
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'
40
+ - uses: metanorma/metanorma-build-scripts/plantuml-setup-action@master
46
41
 
47
- - run: bundle install --jobs 4 --retry 3
42
+ - run: bundle exec rake
48
43
 
49
- - name: install plantuml ubuntu
50
- if: matrix.os == 'ubuntu-latest'
51
- uses: nick-invision/retry@v1
44
+ tests-passed:
45
+ needs: rake
46
+ runs-on: ubuntu-latest
47
+ steps:
48
+ - uses: peter-evans/repository-dispatch@v1
52
49
  with:
53
- polling_interval_seconds: 5
54
- timeout_minutes: 5
55
- max_attempts: 3
56
- command: >
57
- sudo apt-get update -y && sudo bash -c
58
- "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
59
-
60
- - if: matrix.os == 'macos-latest'
61
- run: brew install plantuml
62
-
63
- - if: matrix.os == 'windows-latest'
64
- run: cinst -y plantuml
65
-
66
- - run: bundle exec rake
50
+ token: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
51
+ repository: ${{ github.repository }}
52
+ event-type: notify
53
+ client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
data/.rubocop.yml CHANGED
@@ -4,7 +4,3 @@
4
4
 
5
5
  inherit_from:
6
6
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
- AllCops:
8
- TargetRubyVersion: 2.3
9
- Rails:
10
- Enabled: true
@@ -44,23 +44,23 @@ module Asciidoctor
44
44
  @amd = %w(amendment technical-corrigendum).include? doctype(node)
45
45
  end
46
46
 
47
- def ol_attrs(node)
47
+ def ol_attrs(node)
48
48
  attr_code(keep_attrs(node).
49
- merge(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node)))
49
+ merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
50
50
  end
51
51
 
52
52
  def outputs(node, ret)
53
- File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
- presentation_xml_converter(node).convert(@filename + ".xml")
55
- html_converter_alt(node).convert(@filename + ".presentation.xml",
56
- nil, false, "#{@filename}_alt.html")
57
- html_converter(node).convert(@filename + ".presentation.xml",
58
- nil, false, "#{@filename}.html")
59
- doc_converter(node).convert(@filename + ".presentation.xml",
60
- nil, false, "#{@filename}.doc")
61
- pdf_converter(node)&.convert(@filename + ".presentation.xml",
62
- nil, false, "#{@filename}.pdf")
63
- #sts_converter(node)&.convert(@filename + ".xml")
53
+ File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
+ presentation_xml_converter(node).convert(@filename + ".xml")
55
+ html_converter_alt(node).convert(@filename + ".presentation.xml",
56
+ nil, false, "#{@filename}_alt.html")
57
+ html_converter(node).convert(@filename + ".presentation.xml",
58
+ nil, false, "#{@filename}.html")
59
+ doc_converter(node).convert(@filename + ".presentation.xml",
60
+ nil, false, "#{@filename}.doc")
61
+ pdf_converter(node)&.convert(@filename + ".presentation.xml",
62
+ nil, false, "#{@filename}.pdf")
63
+ #sts_converter(node)&.convert(@filename + ".xml")
64
64
  end
65
65
  end
66
66
  end
@@ -729,9 +729,11 @@
729
729
  </define>
730
730
  <define name="index">
731
731
  <element name="index">
732
- <attribute name="to">
733
- <data type="IDREF"/>
734
- </attribute>
732
+ <optional>
733
+ <attribute name="to">
734
+ <data type="IDREF"/>
735
+ </attribute>
736
+ </optional>
735
737
  <element name="primary">
736
738
  <oneOrMore>
737
739
  <ref name="PureTextElement"/>
@@ -61,7 +61,7 @@ module Asciidoctor
61
61
  id.content = id_prefix(prefix, id)
62
62
  end
63
63
 
64
- def format_ref(ref, type, isopub)
64
+ def format_ref(ref, type)
65
65
  ref = ref.sub(/ \(All Parts\)/i, "")
66
66
  super
67
67
  end
@@ -85,27 +85,27 @@ module Asciidoctor
85
85
  def title_intro(node, t, lang, at)
86
86
  return unless node.attr("title-intro-#{lang}")
87
87
  t.title(**attr_code(at.merge(type: "title-intro"))) do |t1|
88
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
88
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-intro-#{lang}"))
89
89
  end
90
90
  end
91
91
 
92
92
  def title_main(node, t, lang, at)
93
93
  t.title **attr_code(at.merge(type: "title-main")) do |t1|
94
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
94
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-main-#{lang}"))
95
95
  end
96
96
  end
97
97
 
98
98
  def title_part(node, t, lang, at)
99
99
  return unless node.attr("title-part-#{lang}")
100
100
  t.title(**attr_code(at.merge(type: "title-part"))) do |t1|
101
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
101
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-part-#{lang}"))
102
102
  end
103
103
  end
104
104
 
105
105
  def title_amd(node, t, lang, at)
106
106
  return unless node.attr("title-amendment-#{lang}")
107
107
  t.title(**attr_code(at.merge(type: "title-amd"))) do |t1|
108
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
108
+ t1 << Metanorma::Utils::asciidoc_sub(node.attr("title-amendment-#{lang}"))
109
109
  end
110
110
  end
111
111
 
@@ -118,7 +118,7 @@ module Asciidoctor
118
118
  title = "#{title} -- #{part}" if part
119
119
  title = "#{title} -- #{amd}" if amd && @amd
120
120
  t.title **attr_code(at.merge(type: "main")) do |t1|
121
- t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(title)
121
+ t1 << Metanorma::Utils::asciidoc_sub(title)
122
122
  end
123
123
  end
124
124
 
@@ -102,7 +102,7 @@
102
102
  </attribute>
103
103
  </optional>
104
104
  <oneOrMore>
105
- <ref name="li"/>
105
+ <ref name="ul_li"/>
106
106
  </oneOrMore>
107
107
  <zeroOrMore>
108
108
  <ref name="note"/>
@@ -253,6 +253,9 @@
253
253
  <data type="boolean"/>
254
254
  </attribute>
255
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
256
259
  <optional>
257
260
  <ref name="colgroup"/>
258
261
  </optional>
@@ -786,6 +789,9 @@
786
789
  <attribute name="width"/>
787
790
  </element>
788
791
  </define>
792
+ <define name="BibItemType" combine="choice">
793
+ <value>internal</value>
794
+ </define>
789
795
  <define name="TextElement" combine="choice">
790
796
  <ref name="concept"/>
791
797
  </define>
@@ -806,6 +812,8 @@
806
812
  <ref name="requirement"/>
807
813
  <ref name="recommendation"/>
808
814
  <ref name="permission"/>
815
+ <ref name="imagemap"/>
816
+ <ref name="svgmap"/>
809
817
  </choice>
810
818
  </define>
811
819
  <define name="bibliography">
@@ -836,6 +844,9 @@
836
844
  <data type="boolean"/>
837
845
  </attribute>
838
846
  </optional>
847
+ <optional>
848
+ <attribute name="number"/>
849
+ </optional>
839
850
  <optional>
840
851
  <attribute name="obligation">
841
852
  <choice>
@@ -891,9 +902,11 @@
891
902
  <element name="code">
892
903
  <text/>
893
904
  </element>
894
- <element name="text">
895
- <text/>
896
- </element>
905
+ <optional>
906
+ <element name="text">
907
+ <text/>
908
+ </element>
909
+ </optional>
897
910
  </element>
898
911
  </define>
899
912
  <define name="standard-document">
@@ -906,6 +919,9 @@
906
919
  </choice>
907
920
  </attribute>
908
921
  <ref name="bibdata"/>
922
+ <optional>
923
+ <ref name="misccontainer"/>
924
+ </optional>
909
925
  <optional>
910
926
  <ref name="boilerplate"/>
911
927
  </optional>
@@ -916,11 +932,21 @@
916
932
  <zeroOrMore>
917
933
  <ref name="annex"/>
918
934
  </zeroOrMore>
935
+ <optional>
936
+ <ref name="bibliography"/>
937
+ </optional>
919
938
  <zeroOrMore>
920
- <ref name="references"/>
939
+ <ref name="indexsect"/>
921
940
  </zeroOrMore>
922
941
  </element>
923
942
  </define>
943
+ <define name="misccontainer">
944
+ <element name="misc-container">
945
+ <oneOrMore>
946
+ <ref name="AnyElement"/>
947
+ </oneOrMore>
948
+ </element>
949
+ </define>
924
950
  <define name="preface">
925
951
  <element name="preface">
926
952
  <oneOrMore>
@@ -944,6 +970,11 @@
944
970
  <ref name="Content-Section"/>
945
971
  </element>
946
972
  </define>
973
+ <define name="indexsect">
974
+ <element name="indexsect">
975
+ <ref name="Content-Section"/>
976
+ </element>
977
+ </define>
947
978
  <define name="boilerplate">
948
979
  <element name="boilerplate">
949
980
  <optional>
@@ -1063,6 +1094,9 @@
1063
1094
  </choice>
1064
1095
  </attribute>
1065
1096
  </optional>
1097
+ <optional>
1098
+ <attribute name="number"/>
1099
+ </optional>
1066
1100
  <optional>
1067
1101
  <attribute name="type"/>
1068
1102
  </optional>
@@ -1116,6 +1150,9 @@
1116
1150
  <optional>
1117
1151
  <attribute name="type"/>
1118
1152
  </optional>
1153
+ <optional>
1154
+ <attribute name="number"/>
1155
+ </optional>
1119
1156
  <optional>
1120
1157
  <ref name="section-title"/>
1121
1158
  </optional>
@@ -1218,6 +1255,9 @@
1218
1255
  <optional>
1219
1256
  <attribute name="type"/>
1220
1257
  </optional>
1258
+ <optional>
1259
+ <attribute name="number"/>
1260
+ </optional>
1221
1261
  <optional>
1222
1262
  <attribute name="obligation">
1223
1263
  <choice>
@@ -1546,6 +1586,7 @@
1546
1586
  <value>add</value>
1547
1587
  <value>modify</value>
1548
1588
  <value>delete</value>
1589
+ <value>replace</value>
1549
1590
  </choice>
1550
1591
  </attribute>
1551
1592
  <optional>
@@ -1576,6 +1617,11 @@
1576
1617
  </optional>
1577
1618
  <optional>
1578
1619
  <element name="newcontent">
1620
+ <optional>
1621
+ <attribute name="id">
1622
+ <data type="ID"/>
1623
+ </attribute>
1624
+ </optional>
1579
1625
  <zeroOrMore>
1580
1626
  <ref name="BasicBlock"/>
1581
1627
  </zeroOrMore>
@@ -1609,4 +1655,87 @@
1609
1655
  <text/>
1610
1656
  </element>
1611
1657
  </define>
1658
+ <define name="imagemap">
1659
+ <element name="imagemap">
1660
+ <ref name="figure"/>
1661
+ <zeroOrMore>
1662
+ <element name="area">
1663
+ <attribute name="type">
1664
+ <choice>
1665
+ <value>rect</value>
1666
+ <value>circle</value>
1667
+ <value>ellipse</value>
1668
+ <value>poly</value>
1669
+ </choice>
1670
+ </attribute>
1671
+ <choice>
1672
+ <ref name="xref"/>
1673
+ <ref name="hyperlink"/>
1674
+ <ref name="eref"/>
1675
+ </choice>
1676
+ <oneOrMore>
1677
+ <element name="coords">
1678
+ <attribute name="x">
1679
+ <data type="float"/>
1680
+ </attribute>
1681
+ <attribute name="y">
1682
+ <data type="float"/>
1683
+ </attribute>
1684
+ </element>
1685
+ </oneOrMore>
1686
+ <optional>
1687
+ <element name="radius">
1688
+ <attribute name="x">
1689
+ <data type="float"/>
1690
+ </attribute>
1691
+ <optional>
1692
+ <attribute name="y">
1693
+ <data type="float"/>
1694
+ </attribute>
1695
+ </optional>
1696
+ </element>
1697
+ </optional>
1698
+ </element>
1699
+ </zeroOrMore>
1700
+ </element>
1701
+ </define>
1702
+ <define name="svgmap">
1703
+ <element name="svgmap">
1704
+ <ref name="figure"/>
1705
+ <zeroOrMore>
1706
+ <element name="target">
1707
+ <attribute name="href">
1708
+ <data type="anyURI"/>
1709
+ </attribute>
1710
+ <choice>
1711
+ <ref name="xref"/>
1712
+ <ref name="hyperlink"/>
1713
+ <ref name="eref"/>
1714
+ </choice>
1715
+ </element>
1716
+ </zeroOrMore>
1717
+ </element>
1718
+ </define>
1719
+ <define name="ul_li">
1720
+ <element name="li">
1721
+ <optional>
1722
+ <attribute name="id">
1723
+ <data type="ID"/>
1724
+ </attribute>
1725
+ </optional>
1726
+ <optional>
1727
+ <attribute name="uncheckedcheckbox">
1728
+ <data type="boolean"/>
1729
+ </attribute>
1730
+ </optional>
1731
+ <optional>
1732
+ <attribute name="checkedcheckbox">
1733
+ <data type="boolean"/>
1734
+ </attribute>
1735
+ </optional>
1736
+ <oneOrMore>
1737
+ <ref name="BasicBlock"/>
1738
+ </oneOrMore>
1739
+ </element>
1740
+ </define>
1612
1741
  </grammar>
@@ -14,9 +14,6 @@
14
14
  </define>
15
15
  <define name="clause">
16
16
  <element name="clause">
17
- <optional>
18
- <attribute name="type"/>
19
- </optional>
20
17
  <optional>
21
18
  <attribute name="change">
22
19
  <choice>
@@ -34,7 +31,17 @@
34
31
  </define>
35
32
  <define name="iso-standard">
36
33
  <element name="iso-standard">
34
+ <attribute name="version"/>
35
+ <attribute name="type">
36
+ <choice>
37
+ <value>semantic</value>
38
+ <value>presentation</value>
39
+ </choice>
40
+ </attribute>
37
41
  <ref name="bibdata"/>
42
+ <optional>
43
+ <ref name="misccontainer"/>
44
+ </optional>
38
45
  <optional>
39
46
  <ref name="boilerplate"/>
40
47
  </optional>
@@ -68,7 +75,7 @@
68
75
  </optional>
69
76
  <optional>
70
77
  <attribute name="origyr">
71
- <data type="int"/>
78
+ <ref name="ISO8601Date"/>
72
79
  </attribute>
73
80
  </optional>
74
81
  <text/>