metanorma-iso 1.5.11 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +83 -0
  3. data/README.adoc +5 -6
  4. data/lib/asciidoctor/iso/base.rb +5 -5
  5. data/lib/asciidoctor/iso/basicdoc.rng +50 -3
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +2 -2
  7. data/lib/asciidoctor/iso/cleanup.rb +33 -6
  8. data/lib/asciidoctor/iso/front.rb +5 -0
  9. data/lib/asciidoctor/iso/isodoc.rng +61 -3
  10. data/lib/asciidoctor/iso/isostandard-amd.rng +8 -4
  11. data/lib/asciidoctor/iso/isostandard.rng +27 -10
  12. data/lib/asciidoctor/iso/validate.rb +13 -1
  13. data/lib/asciidoctor/iso/validate_section.rb +21 -9
  14. data/lib/isodoc/iso/base_convert.rb +2 -1
  15. data/lib/isodoc/iso/html/header.html +4 -8
  16. data/lib/isodoc/iso/html/htmlstyle.css +1 -1
  17. data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
  18. data/lib/isodoc/iso/html/isodoc.css +42 -42
  19. data/lib/isodoc/iso/html/isodoc.scss +42 -42
  20. data/lib/isodoc/iso/html/style-human.css +9 -9
  21. data/lib/isodoc/iso/html/style-human.scss +7 -7
  22. data/lib/isodoc/iso/html/style-iso.css +7 -7
  23. data/lib/isodoc/iso/html/style-iso.scss +5 -5
  24. data/lib/isodoc/iso/html/wordstyle.css +67 -67
  25. data/lib/isodoc/iso/html/wordstyle.scss +67 -67
  26. data/lib/isodoc/iso/html_convert.rb +4 -0
  27. data/lib/isodoc/iso/i18n-en.yaml +1 -0
  28. data/lib/isodoc/iso/i18n-fr.yaml +2 -0
  29. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -0
  30. data/lib/isodoc/iso/i18n.rb +10 -11
  31. data/lib/isodoc/iso/iso.amendment.xsl +381 -86
  32. data/lib/isodoc/iso/iso.international-standard.xsl +381 -86
  33. data/lib/isodoc/iso/metadata.rb +1 -0
  34. data/lib/isodoc/iso/sections.rb +1 -1
  35. data/lib/isodoc/iso/word_convert.rb +4 -0
  36. data/lib/isodoc/iso/xref.rb +34 -8
  37. data/lib/metanorma/iso/processor.rb +11 -9
  38. data/lib/metanorma/iso/version.rb +1 -1
  39. data/metanorma-iso.gemspec +2 -2
  40. data/spec/asciidoctor-iso/amd_spec.rb +14 -14
  41. data/spec/asciidoctor-iso/base_spec.rb +20 -18
  42. data/spec/asciidoctor-iso/blocks_spec.rb +22 -22
  43. data/spec/asciidoctor-iso/cleanup_spec.rb +36 -30
  44. data/spec/asciidoctor-iso/inline_spec.rb +7 -7
  45. data/spec/asciidoctor-iso/lists_spec.rb +9 -9
  46. data/spec/asciidoctor-iso/refs_spec.rb +177 -146
  47. data/spec/asciidoctor-iso/section_spec.rb +12 -7
  48. data/spec/asciidoctor-iso/table_spec.rb +4 -4
  49. data/spec/asciidoctor-iso/validate_spec.rb +401 -85
  50. data/spec/isodoc/amd_spec.rb +13 -13
  51. data/spec/isodoc/blocks_spec.rb +1 -0
  52. data/spec/isodoc/metadata_spec.rb +2 -0
  53. data/spec/isodoc/ref_spec.rb +2 -2
  54. data/spec/isodoc/section_spec.rb +20 -0
  55. data/spec/isodoc/xref_spec.rb +12 -0
  56. metadata +7 -12
  57. data/.github/workflows/macos.yml +0 -49
  58. data/.github/workflows/ubuntu.yml +0 -53
  59. data/.github/workflows/windows.yml +0 -50
  60. data/lib/asciidoctor/iso/macros.rb +0 -21
  61. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
  62. data/spec/asciidoctor-iso/macros_spec.rb +0 -310
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b55ad63091753ec601585409d6eb07ecb5036273c4c0a25d4dc8933d1f8fe68e
4
- data.tar.gz: e4926508e1cbd008d5f8f9daf99746dd31fe599726ac3b40c3fbe21417425d92
3
+ metadata.gz: 769601244fc001de9523edde3e6b139a897df0c82a255b786659a83a2e32d8a5
4
+ data.tar.gz: 1ea613b3740ec30cc508fa5817bed662f3fe539b7bf03e2cf7e40e4ab1e1c8c4
5
5
  SHA512:
6
- metadata.gz: 5e91a33a23750e3f6bcc4a7b41b31a6543ab59bd28f7c82bc683e4e18c6e1ba0944b8662d29b74f95e548eac55da5d7b40bb842574d1739aba494e0058e07e3c
7
- data.tar.gz: d8c09a90f76d6d5872010b54001af4c7a8d8ebd809cef8c6c6d09e75bb303c7717d5f74f8e10230ed9a6dbbc47f166383ade0215d2f876dd948a202b08ada08c
6
+ metadata.gz: 870aaeca24c5e5878441a8346c2dc0d8d8cdd19604c50399c38b8af18bd29a90ab3c0dd8c8d080b977c35efc794bbfbffa4ca233113c3c3a103d90542981ba90
7
+ data.tar.gz: a6bb8b2d6f598ddf12b8982fa1203165d07f94df83a0f2f7d96eba635834b69e0420e7e46e5cfe86b5ba0283a553106a7941cd06be868032dec6e0179dc1fbb4
@@ -0,0 +1,83 @@
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
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
41
+
42
+ - uses: actions/cache@v2
43
+ with:
44
+ path: vendor/bundle
45
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
+
48
+ - run: bundle config set path 'vendor/bundle'
49
+
50
+ - run: bundle install --jobs 4 --retry 3
51
+
52
+ - name: install plantuml ubuntu
53
+ if: matrix.os == 'ubuntu-latest'
54
+ uses: nick-invision/retry@v1
55
+ with:
56
+ polling_interval_seconds: 5
57
+ timeout_minutes: 5
58
+ max_attempts: 3
59
+ command: >
60
+ sudo apt-get update -y && sudo bash -c
61
+ "curl -L https://github.com/metanorma/plantuml-install/raw/master/ubuntu.sh | bash"
62
+
63
+ - if: matrix.os == 'macos-latest'
64
+ run: brew install plantuml
65
+
66
+ - if: matrix.os == 'windows-latest'
67
+ run: cinst -y plantuml
68
+
69
+ - run: bundle exec rake
70
+
71
+ tests-passed:
72
+ needs: rake
73
+ runs-on: ubuntu-latest
74
+ continue-on-error: true
75
+ steps:
76
+ - name: Trigger tests passed event
77
+ uses: Sibz/github-status-action@v1
78
+ with:
79
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
80
+ context: 'tests-passed-successfully'
81
+ description: 'Tests passed successfully'
82
+ state: 'success'
83
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,22 +1,18 @@
1
1
  = Metanorma-ISO: Metanorma processor for ISO standards
2
2
 
3
3
  image:https://img.shields.io/gem/v/metanorma-iso.svg["Gem Version", link="https://rubygems.org/gems/metanorma-iso"]
4
- image:https://github.com/metanorma/metanorma-iso/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/metanorma/metanorma-iso/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-iso/workflows/ubuntu/badge.svg["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-iso/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-iso/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/metanorma/metanorma-iso/actions?workflow=windows"]
4
+ image:https://github.com/metanorma/metanorma-iso/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-iso/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/metanorma/metanorma-iso/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-iso"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-iso.svg["Pull Requests", link="https://github.com/metanorma/metanorma-iso/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/metanorma/metanorma-iso/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-iso/releases"]
10
8
 
11
- _Formerly known as_ `asciidoctor-iso`.
12
-
13
9
  == Functionality and Approach
14
10
 
15
11
  For the conceptual underpinnings of this gem, and the other gems in the Metanorma suite, see the https://github.com/metanorma/metanorma-model-standoc/blob/master/README.adoc[metanorma-standoc README].
16
12
 
17
13
  == Outputs
18
14
 
19
- This gem processes Metanorma documents following a template for generating ISO
15
+ This gem processes https://www.metanorma.com[Metanorma documents] following a template for generating ISO
20
16
  International Standards. The following outputs are generated.
21
17
 
22
18
  * The XML representation of the document, intended as a document model for ISO
@@ -79,3 +75,6 @@ See https://www.metanorma.com/author/iso/[The ISO flavor of Metanorma].
79
75
  * Example documents are avalable at the https://github.com/metanorma/mn-samples-iso[mn-samples-iso] repository.
80
76
  * Document templates are available at the https://github.com/metanorma/mn-templates-iso[mn-templates-iso] repository.
81
77
 
78
+ == Notes
79
+
80
+ Metanorma-ISO was formerly published as `asciidoctor-iso`.
@@ -5,7 +5,6 @@ require "pathname"
5
5
  require "open-uri"
6
6
  require "isodoc"
7
7
  require "fileutils"
8
- require 'asciidoctor/iso/macros'
9
8
 
10
9
  module Asciidoctor
11
10
  module ISO
@@ -13,10 +12,6 @@ module Asciidoctor
13
12
  XML_ROOT_TAG = "iso-standard".freeze
14
13
  XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
15
14
 
16
- Asciidoctor::Extensions.register do
17
- inline_macro Asciidoctor::Iso::TermRefInlineMacro
18
- end
19
-
20
15
  def html_converter(node)
21
16
  IsoDoc::Iso::HtmlConvert.new(html_extract_attributes(node))
22
17
  end
@@ -49,6 +44,11 @@ module Asciidoctor
49
44
  @amd = %w(amendment technical-corrigendum).include? doctype(node)
50
45
  end
51
46
 
47
+ def ol_attrs(node)
48
+ attr_code(keep_attrs(node).
49
+ merge(id: ::Asciidoctor::Standoc::Utils::anchor_or_uuid(node)))
50
+ end
51
+
52
52
  def outputs(node, ret)
53
53
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
54
54
  presentation_xml_converter(node).convert(@filename + ".xml")
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,15 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
+ <attribute name="to">
733
+ <data type="IDREF"/>
734
+ </attribute>
735
+ <element name="primary">
736
+ <oneOrMore>
737
+ <ref name="PureTextElement"/>
738
+ </oneOrMore>
739
+ </element>
732
740
  <optional>
733
- <attribute name="secondary"/>
741
+ <element name="secondary">
742
+ <oneOrMore>
743
+ <ref name="PureTextElement"/>
744
+ </oneOrMore>
745
+ </element>
734
746
  </optional>
735
747
  <optional>
736
- <attribute name="tertiary"/>
748
+ <element name="tertiary">
749
+ <oneOrMore>
750
+ <ref name="PureTextElement"/>
751
+ </oneOrMore>
752
+ </element>
737
753
  </optional>
738
754
  </element>
739
755
  </define>
756
+ <define name="index-xref">
757
+ <element name="index-xref">
758
+ <attribute name="also">
759
+ <data type="boolean"/>
760
+ </attribute>
761
+ <element name="primary">
762
+ <oneOrMore>
763
+ <ref name="PureTextElement"/>
764
+ </oneOrMore>
765
+ </element>
766
+ <optional>
767
+ <element name="secondary">
768
+ <oneOrMore>
769
+ <ref name="PureTextElement"/>
770
+ </oneOrMore>
771
+ </element>
772
+ </optional>
773
+ <optional>
774
+ <element name="tertiary">
775
+ <oneOrMore>
776
+ <ref name="PureTextElement"/>
777
+ </oneOrMore>
778
+ </element>
779
+ </optional>
780
+ <element name="target">
781
+ <oneOrMore>
782
+ <ref name="PureTextElement"/>
783
+ </oneOrMore>
784
+ </element>
785
+ </element>
786
+ </define>
740
787
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
788
  <define name="bookmark">
742
789
  <element name="bookmark">
@@ -32,8 +32,8 @@ l’adresse ci-après ou au comité membre de l’ISO dans le pays du demandeur.
32
32
  <clause>
33
33
  <title>Avertissement</title>
34
34
 
35
- <p>Ce document n'est pas une Norme internationale de l'ISO. Il est distribué pour examen et observations. Il est susceptible de modification sans préavis et ne peut être cité comme Norme internationale.</p>
36
- <p>Les destinataires du présent projet sont invités présenter, avec leurs observations, notification des droits de propriété dont ils auraient éventuellement connaissance et fournir une documentation explicative.</p>
35
+ <p>Ce document n'est pas une Norme internationale de l'ISO. Il est distribué pour examen et observations. Il est susceptible de modification sans préavis et ne peut être cité comme Norme internationale.</p>
36
+ <p>Les destinataires du présent projet sont invités à présenter, avec leurs observations, notification des droits de propriété dont ils auraient éventuellement connaissance et à fournir une documentation explicative.</p>
37
37
  </clause>
38
38
  </license-statement>
39
39
  {% endif %}
@@ -4,7 +4,6 @@ require "htmlentities"
4
4
  require "json"
5
5
  require "pathname"
6
6
  require "open-uri"
7
- require "asciidoctor/iso/term_lookup_cleanup"
8
7
 
9
8
  module Asciidoctor
10
9
  module ISO
@@ -89,11 +88,6 @@ module Asciidoctor
89
88
  end
90
89
  end
91
90
 
92
- def termdef_cleanup(xmldoc)
93
- Asciidoctor::ISO::TermLookupCleanup.new(xmldoc, @log).call
94
- super
95
- end
96
-
97
91
  # TODO sort by authors
98
92
  # sort by: doc class (ISO, IEC, other standard (not DOI &c), other
99
93
  # then standard class (docid class other than DOI &c)
@@ -129,6 +123,39 @@ module Asciidoctor
129
123
  file = @lang == "fr" ? "boilerplate-fr.xml" : "boilerplate.xml"
130
124
  File.join(@libdir, file)
131
125
  end
126
+
127
+ def footnote_cleanup(xmldoc)
128
+ unpub_footnotes(xmldoc)
129
+ super
130
+ end
131
+
132
+ def unpub_footnotes(xmldoc)
133
+ xmldoc.xpath("//bibitem/note[@type = 'Unpublished-Status']").each do |n|
134
+ id = n.parent["id"]
135
+ e = xmldoc.at("//eref[@bibitemid = '#{id}']") or next
136
+ e.next = n.dup
137
+ e.next.name = "fn"
138
+ e.next.delete("format")
139
+ e.next.delete("type")
140
+ end
141
+ end
142
+
143
+ def bibitem_cleanup(xmldoc)
144
+ super
145
+ unpublished_note(xmldoc)
146
+ end
147
+
148
+ def unpublished_note(xmldoc)
149
+ xmldoc.xpath("//bibitem[not(note[@type = 'Unpublished-Status'])]").each do |b|
150
+ next if pub_class(b) > 2
151
+ next unless s = b.at("./status/stage") and s.text.to_i < 60
152
+ id = b.at("docidentifier").text
153
+ b.at("./language | ./script | ./abstract | ./status").previous = <<~NOTE
154
+ <note type="Unpublished-Status">
155
+ <p>#{@i18n.under_preparation.sub(/%/, id)}</p></note>
156
+ NOTE
157
+ end
158
+ end
132
159
  end
133
160
  end
134
161
  end
@@ -18,6 +18,11 @@ module Asciidoctor
18
18
  xml.updates_document_type a
19
19
  end
20
20
 
21
+ def metadata_doctype(node, xml)
22
+ xml.doctype doctype(node)
23
+ a = node.attr("horizontal") and xml.horizontal a
24
+ end
25
+
21
26
  def org_abbrev
22
27
  { "International Organization for Standardization" => "ISO",
23
28
  "International Electrotechnical Commission" => "IEC" }
@@ -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">
@@ -47,6 +55,13 @@
47
55
  <param name="pattern">\i\c*|\c+#\c+</param>
48
56
  </data>
49
57
  </attribute>
58
+ <optional>
59
+ <attribute name="to">
60
+ <data type="string">
61
+ <param name="pattern">\i\c*|\c+#\c+</param>
62
+ </data>
63
+ </attribute>
64
+ </optional>
50
65
  <optional>
51
66
  <attribute name="type">
52
67
  <ref name="ReferenceFormat"/>
@@ -141,6 +156,11 @@
141
156
  <data type="boolean"/>
142
157
  </attribute>
143
158
  </optional>
159
+ <optional>
160
+ <attribute name="key">
161
+ <data type="boolean"/>
162
+ </attribute>
163
+ </optional>
144
164
  <oneOrMore>
145
165
  <ref name="dt"/>
146
166
  <ref name="dd"/>
@@ -233,6 +253,12 @@
233
253
  <data type="boolean"/>
234
254
  </attribute>
235
255
  </optional>
256
+ <optional>
257
+ <attribute name="width"/>
258
+ </optional>
259
+ <optional>
260
+ <ref name="colgroup"/>
261
+ </optional>
236
262
  <optional>
237
263
  <ref name="tname"/>
238
264
  </optional>
@@ -751,6 +777,18 @@
751
777
  </define>
752
778
  </include>
753
779
  <!-- end overrides -->
780
+ <define name="colgroup">
781
+ <element name="colgroup">
782
+ <oneOrMore>
783
+ <ref name="col"/>
784
+ </oneOrMore>
785
+ </element>
786
+ </define>
787
+ <define name="col">
788
+ <element name="col">
789
+ <attribute name="width"/>
790
+ </element>
791
+ </define>
754
792
  <define name="TextElement" combine="choice">
755
793
  <ref name="concept"/>
756
794
  </define>
@@ -801,6 +839,9 @@
801
839
  <data type="boolean"/>
802
840
  </attribute>
803
841
  </optional>
842
+ <optional>
843
+ <attribute name="number"/>
844
+ </optional>
804
845
  <optional>
805
846
  <attribute name="obligation">
806
847
  <choice>
@@ -856,9 +897,11 @@
856
897
  <element name="code">
857
898
  <text/>
858
899
  </element>
859
- <element name="text">
860
- <text/>
861
- </element>
900
+ <optional>
901
+ <element name="text">
902
+ <text/>
903
+ </element>
904
+ </optional>
862
905
  </element>
863
906
  </define>
864
907
  <define name="standard-document">
@@ -1028,6 +1071,9 @@
1028
1071
  </choice>
1029
1072
  </attribute>
1030
1073
  </optional>
1074
+ <optional>
1075
+ <attribute name="number"/>
1076
+ </optional>
1031
1077
  <optional>
1032
1078
  <attribute name="type"/>
1033
1079
  </optional>
@@ -1081,6 +1127,9 @@
1081
1127
  <optional>
1082
1128
  <attribute name="type"/>
1083
1129
  </optional>
1130
+ <optional>
1131
+ <attribute name="number"/>
1132
+ </optional>
1084
1133
  <optional>
1085
1134
  <ref name="section-title"/>
1086
1135
  </optional>
@@ -1183,6 +1232,9 @@
1183
1232
  <optional>
1184
1233
  <attribute name="type"/>
1185
1234
  </optional>
1235
+ <optional>
1236
+ <attribute name="number"/>
1237
+ </optional>
1186
1238
  <optional>
1187
1239
  <attribute name="obligation">
1188
1240
  <choice>
@@ -1511,6 +1563,7 @@
1511
1563
  <value>add</value>
1512
1564
  <value>modify</value>
1513
1565
  <value>delete</value>
1566
+ <value>replace</value>
1514
1567
  </choice>
1515
1568
  </attribute>
1516
1569
  <optional>
@@ -1541,6 +1594,11 @@
1541
1594
  </optional>
1542
1595
  <optional>
1543
1596
  <element name="newcontent">
1597
+ <optional>
1598
+ <attribute name="id">
1599
+ <data type="ID"/>
1600
+ </attribute>
1601
+ </optional>
1544
1602
  <zeroOrMore>
1545
1603
  <ref name="BasicBlock"/>
1546
1604
  </zeroOrMore>