metanorma-iso 1.5.0 → 1.5.5

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.
@@ -8,15 +8,19 @@ module IsoDoc
8
8
  def initialize(options)
9
9
  @libdir = File.dirname(__FILE__)
10
10
  super
11
+ @wordToClevels = options[:doctoclevels].to_i
12
+ @wordToClevels = 3 if @wordToClevels.zero?
13
+ @htmlToClevels = options[:htmltoclevels].to_i
14
+ @htmlToClevels = 3 if @htmlToClevels.zero?
11
15
  end
12
16
 
13
17
  def default_fonts(options)
14
18
  {
15
19
  bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
16
20
  '"Cambria",serif'),
17
- headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
18
- '"Cambria",serif'),
19
- monospacefont: '"Courier New",monospace',
21
+ headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
22
+ '"Cambria",serif'),
23
+ monospacefont: '"Courier New",monospace',
20
24
  }
21
25
  end
22
26
 
@@ -24,16 +28,16 @@ module IsoDoc
24
28
  {
25
29
  htmlstylesheet: (options[:alt] ? html_doc_path("style-human.scss") :
26
30
  html_doc_path("style-iso.scss")),
27
- htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
28
- htmlintropage: html_doc_path("html_iso_intro.html"),
29
- scripts: html_doc_path("scripts.html"),
30
- wordstylesheet: html_doc_path("wordstyle.scss"),
31
- standardstylesheet: html_doc_path("isodoc.scss"),
32
- header: html_doc_path("header.html"),
33
- wordcoverpage: html_doc_path("word_iso_titlepage.html"),
34
- wordintropage: html_doc_path("word_iso_intro.html"),
35
- ulstyle: "l3",
36
- olstyle: "l2",
31
+ htmlcoverpage: html_doc_path("html_iso_titlepage.html"),
32
+ htmlintropage: html_doc_path("html_iso_intro.html"),
33
+ scripts: html_doc_path("scripts.html"),
34
+ wordstylesheet: html_doc_path("wordstyle.scss"),
35
+ standardstylesheet: html_doc_path("isodoc.scss"),
36
+ header: html_doc_path("header.html"),
37
+ wordcoverpage: html_doc_path("word_iso_titlepage.html"),
38
+ wordintropage: html_doc_path("word_iso_intro.html"),
39
+ ulstyle: "l3",
40
+ olstyle: "l2",
37
41
  }
38
42
  end
39
43
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "1.5.0".freeze
3
+ VERSION = "1.5.5".freeze
4
4
  end
5
5
  end
@@ -186,6 +186,7 @@ RSpec.describe Asciidoctor::ISO do
186
186
  :language: el
187
187
  :script: Grek
188
188
  :publisher: IEC,IETF,ISO
189
+ :copyright-holder: ISO,IETF
189
190
  :copyright-year: 2001
190
191
  :doctype: technical-report
191
192
  INPUT
@@ -248,8 +249,8 @@ RSpec.describe Asciidoctor::ISO do
248
249
  <from>2001</from>
249
250
  <owner>
250
251
  <organization>
251
- <name>International Electrotechnical Commission</name>
252
- <abbreviation>IEC</abbreviation>
252
+ <name>International Organization for Standardization</name>
253
+ <abbreviation>ISO</abbreviation>
253
254
  </organization>
254
255
  </owner>
255
256
  </copyright>
@@ -261,15 +262,6 @@ RSpec.describe Asciidoctor::ISO do
261
262
  </organization>
262
263
  </owner>
263
264
  </copyright>
264
- <copyright>
265
- <from>2001</from>
266
- <owner>
267
- <organization>
268
- <name>International Organization for Standardization</name>
269
- <abbreviation>ISO</abbreviation>
270
- </organization>
271
- </owner>
272
- </copyright>
273
265
  <ext>
274
266
  <doctype>technical-report</doctype>
275
267
  <editorialgroup>
@@ -32,7 +32,19 @@ RSpec.describe Asciidoctor::ISO do
32
32
  <terms id="_" obligation="normative">
33
33
  <title>Terms and definitions</title>
34
34
  #{TERM_BOILERPLATE}
35
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>91</mn></msub></math></stem></admitted>
35
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
36
+ <mi>t</mi>
37
+ </mrow>
38
+ <mrow>
39
+ <mn>90</mn>
40
+ </mrow>
41
+ </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
42
+ <mi>t</mi>
43
+ </mrow>
44
+ <mrow>
45
+ <mn>91</mn>
46
+ </mrow>
47
+ </msub></math></stem></admitted>
36
48
  <definition><p id="_">Time</p></definition></term>
37
49
  </terms>
38
50
  </sections>
@@ -90,8 +102,20 @@ RSpec.describe Asciidoctor::ISO do
90
102
  <terms id="_" obligation="normative">
91
103
  <title>Terms and definitions</title>
92
104
  #{TERM_BOILERPLATE}
93
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mn>90</mn></msub></math></stem></preferred><definition><formula id="_">
94
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>t</mi><mi>A</mi></msub></math></stem>
105
+ <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
106
+ <mi>t</mi>
107
+ </mrow>
108
+ <mrow>
109
+ <mn>90</mn>
110
+ </mrow>
111
+ </msub></math></stem></preferred><definition><formula id="_">
112
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
113
+ <mi>t</mi>
114
+ </mrow>
115
+ <mrow>
116
+ <mi>A</mi>
117
+ </mrow>
118
+ </msub></math></stem>
95
119
  </formula><p id="_">This paragraph is extraneous</p></definition>
96
120
  </term>
97
121
  </terms>
@@ -28,7 +28,13 @@ RSpec.describe Asciidoctor::ISO do
28
28
  ‘single quote’
29
29
  super<sup>script</sup>
30
30
  sub<sub>script</sub>
31
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>a</mi><mn>90</mn></msub></math></stem>
31
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
32
+ <mi>a</mi>
33
+ </mrow>
34
+ <mrow>
35
+ <mn>90</mn>
36
+ </mrow>
37
+ </msub></math></stem>
32
38
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
33
39
  <admitted>alt</admitted>
34
40
  <deprecates>deprecated</deprecates>
@@ -150,7 +150,13 @@ RSpec.describe Asciidoctor::ISO do
150
150
  <tr>
151
151
  <th rowspan="2" align="left">Defect</th>
152
152
  <th colspan="4" align="center">Maximum permissible mass fraction of defects in husked rice<br/>
153
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mi>w</mi><mo>max</mo></msub></math></stem></th>
153
+ <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub><mrow>
154
+ <mi>w</mi>
155
+ </mrow>
156
+ <mrow>
157
+ <mo>max</mo>
158
+ </mrow>
159
+ </msub></math></stem></th>
154
160
  </tr>
155
161
  <tr>
156
162
  <th align="left">in husked rice</th>
@@ -3,6 +3,93 @@ require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::ISO do
5
5
 
6
+ it "Warns of missing scope" do
7
+ FileUtils.rm_f "test.err"
8
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
9
+ = Document title
10
+ Author
11
+ :docfile: test.adoc
12
+ :nodoc:
13
+ :no-isobib:
14
+ :doctype: pizza
15
+
16
+ text
17
+ INPUT
18
+ expect(File.read("test.err")).to include "Scope clause missing"
19
+ FileUtils.rm_f "test.err"
20
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
21
+ = Document title
22
+ Author
23
+ :docfile: test.adoc
24
+ :nodoc:
25
+ :no-isobib:
26
+ :doctype: pizza
27
+
28
+ == Scope
29
+ INPUT
30
+ expect(File.read("test.err")).not_to include "Scope clause missing"
31
+
32
+ end
33
+
34
+ it "Warns of missing normative references" do
35
+ FileUtils.rm_f "test.err"
36
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
37
+ = Document title
38
+ Author
39
+ :docfile: test.adoc
40
+ :nodoc:
41
+ :no-isobib:
42
+ :doctype: pizza
43
+
44
+ text
45
+ INPUT
46
+ expect(File.read("test.err")).to include "Normative references missing"
47
+ FileUtils.rm_f "test.err"
48
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
49
+ = Document title
50
+ Author
51
+ :docfile: test.adoc
52
+ :nodoc:
53
+ :no-isobib:
54
+ :doctype: pizza
55
+
56
+ [bibliography]
57
+ == Normative references
58
+ INPUT
59
+ expect(File.read("test.err")).not_to include "Normative references missing"
60
+
61
+ end
62
+
63
+ it "Warns of missing terms & definitions" do
64
+ FileUtils.rm_f "test.err"
65
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
66
+ = Document title
67
+ Author
68
+ :docfile: test.adoc
69
+ :nodoc:
70
+ :no-isobib:
71
+ :doctype: pizza
72
+
73
+ text
74
+ INPUT
75
+ expect(File.read("test.err")).to include "Terms & definitions missing"
76
+ FileUtils.rm_f "test.err"
77
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
78
+ = Document title
79
+ Author
80
+ :docfile: test.adoc
81
+ :nodoc:
82
+ :no-isobib:
83
+ :doctype: pizza
84
+
85
+ == Terms and definitions
86
+ === Term 1
87
+ INPUT
88
+ expect(File.read("test.err")).not_to include "Terms & definitions missing"
89
+
90
+ end
91
+
92
+
6
93
  it "Warns of illegal doctype" do
7
94
  FileUtils.rm_f "test.err"
8
95
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
@@ -215,7 +215,7 @@ RSpec.describe IsoDoc do
215
215
  expect(xmlpp("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") )).to be_equivalent_to xmlpp(<<~'OUTPUT')
216
216
  <div>
217
217
  <p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes">&#xA0;</span>TOC
218
- \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
218
+ \o "1-3" \h \z \u <span style="mso-element:field-separator"></span></span>
219
219
  <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
220
220
  <a href="#_Toc">1 Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
221
221
  <span style="mso-tab-count:1 dotted">. </span>
@@ -705,4 +705,79 @@ expect((IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/wo
705
705
  expect(word).to include '<p class="zzWarning">This document is not an ISO International Standard'
706
706
  end
707
707
 
708
+ it "populates Word ToC" do
709
+ FileUtils.rm_f "test.doc"
710
+ IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
711
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
712
+ <sections>
713
+ <clause id="A" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
714
+ <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
715
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
716
+ </fn></title>
717
+ </clause>
718
+ <clause id="O" inline-header="false" obligation="normative">
719
+ <title>Clause 4.2</title>
720
+ <p>A<fn reference="1">
721
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
722
+ </fn></p>
723
+ <clause id="P" inline-header="false" obligation="normative">
724
+ <title>Clause 4.2.1</title>
725
+ </clause>
726
+ </clause></clause>
727
+ </sections>
728
+ </iso-standard>
729
+ INPUT
730
+ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
731
+ sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
732
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
733
+ <div class="WordSection2">
734
+ An empty word intro page.
735
+
736
+ <p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes">&#xA0;</span>TOC
737
+ \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
738
+ <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
739
+ <a href="#_Toc">Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
740
+ <span style="mso-tab-count:1 dotted">. </span>
741
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
742
+ <span style="mso-element:field-begin"></span></span>
743
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
744
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
745
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
746
+ <p class="MsoToc2">
747
+ <span class="MsoHyperlink">
748
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
749
+ <a href="#_Toc">Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
750
+ <span style="mso-tab-count:1 dotted">. </span>
751
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
752
+ <span style="mso-element:field-begin"></span></span>
753
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
754
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
755
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
756
+ </span>
757
+ </p>
758
+ <p class="MsoToc2">
759
+ <span class="MsoHyperlink">
760
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
761
+ <a href="#_Toc">Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
762
+ <span style="mso-tab-count:1 dotted">. </span>
763
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
764
+ <span style="mso-element:field-begin"></span></span>
765
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
766
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
767
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
768
+ </span>
769
+ </p>
770
+ <p class="MsoToc1">
771
+ <span lang="EN-GB" xml:lang="EN-GB">
772
+ <span style="mso-element:field-end"></span>
773
+ </span>
774
+ <span lang="EN-GB" xml:lang="EN-GB">
775
+ <p class="MsoNormal">&#xA0;</p>
776
+ </span>
777
+ </p>
778
+ <p class="MsoNormal">&#xA0;</p>
779
+ </div>
780
+ OUTPUT
781
+ end
782
+
708
783
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-29 00:00:00.000000000 Z
11
+ date: 2020-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing