metanorma-iec 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes IsoXML terms" do
5
- expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <sections>
8
8
  <terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
@@ -23,13 +23,14 @@ RSpec.describe IsoDoc do
23
23
  </termexample>
24
24
 
25
25
  <termsource status="modified">
26
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
26
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
27
27
  <modification>
28
28
  <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
29
29
  </modification>
30
30
  </termsource></term>
31
31
 
32
- <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
32
+ <term id="paddy">
33
+ <preferred>paddy</preferred><admitted>paddy rice</admitted>
33
34
  <admitted>rough rice</admitted>
34
35
  <deprecates>cargo rice</deprecates>
35
36
  <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
@@ -46,105 +47,113 @@ RSpec.describe IsoDoc do
46
47
  </ul>
47
48
  </termexample>
48
49
  <termsource status="identical">
49
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
50
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
50
51
  </termsource></term>
51
52
  </terms>
52
53
  </sections>
53
54
  </iso-standard>
54
55
  INPUT
55
- #{HTML_HDR}
56
- <div id="">
57
- <h1 class="ForewordTitle">FOREWORD</h1>
58
- <div class="boilerplate_legal"/>
59
- </div>
60
- #{IEC_TITLE1}
61
- <div id="_terms_and_definitions"><h1>1&#160; Terms and definitions</h1>
62
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
63
-
64
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
65
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span>&#160; Foreign seeds, husks, bran, sand, dust.</p><ul>
66
- <li>A</li>
67
- </ul></div>
68
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span>&#160; </p>
69
- <ul>
70
- <li>A</li>
71
- </ul>
72
- </div>
73
-
74
- <p>[TERMREF]
75
- <a href="#ISO7301">ISO 7301:2011, 3.1</a>
76
- [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
77
- [/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
78
- <p class="AltTerms" style="text-align:left;">rough rice</p>
79
- <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
80
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
81
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span>&#160; </p>
82
- <ul>
83
- <li>A</li>
84
- </ul>
85
- </div>
86
- <div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
87
- <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
88
- <p>[TERMREF]
89
- <a href="#ISO7301">ISO 7301:2011, 3.1</a>
90
- [/TERMREF]</p></div>
91
- </div>
92
- </body>
93
- </html>
94
- OUTPUT
95
- end
96
-
97
- it "processes IsoXML terms (Word)" do
98
- expect((IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div id="_terms_and_definitions">}m, '<div id="_terms_and_definitions">').sub(%r{</div>\s*<br[^>]*>\s*<div class="colophon"/>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
56
+ presxml = <<~INPUT
99
57
  <iso-standard xmlns="http://riboseinc.com/isoxml">
100
58
  <sections>
101
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
59
+ <terms id="_terms_and_definitions" obligation="normative"><title depth="1">1<tab/>Terms and definitions</title>
102
60
 
103
- <term id="paddy1"><preferred>paddy</preferred>
61
+ <term id="paddy1">
62
+ <name>1.1</name><preferred>paddy</preferred>
104
63
  <domain>rice</domain>
105
64
  <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
106
65
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
66
+ <name>EXAMPLE 1</name>
107
67
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
108
68
  <ul>
109
69
  <li>A</li>
110
70
  </ul>
111
71
  </termexample>
112
72
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
73
+ <name>EXAMPLE 2</name>
113
74
  <ul>
114
75
  <li>A</li>
115
76
  </ul>
116
77
  </termexample>
117
78
 
118
79
  <termsource status="modified">
119
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
80
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
120
81
  <modification>
121
82
  <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
122
83
  </modification>
123
84
  </termsource></term>
124
85
 
125
- <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
86
+ <term id="paddy">
87
+ <name>1.2</name>
88
+ <preferred>paddy</preferred><admitted>paddy rice</admitted>
126
89
  <admitted>rough rice</admitted>
127
90
  <deprecates>cargo rice</deprecates>
128
91
  <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
129
92
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
93
+ <name>Note 1 to entry</name>
130
94
  <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
131
95
  </termnote>
132
96
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
97
+ <name>Note 2 to entry</name>
133
98
  <ul><li>A</li></ul>
134
99
  <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
135
100
  </termnote>
136
101
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
102
+ <name>EXAMPLE</name>
137
103
  <ul>
138
104
  <li>A</li>
139
105
  </ul>
140
106
  </termexample>
141
107
  <termsource status="identical">
142
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
108
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
143
109
  </termsource></term>
144
110
  </terms>
145
111
  </sections>
146
112
  </iso-standard>
147
113
  INPUT
114
+ html = <<~OUTPUT
115
+ #{HTML_HDR}
116
+ <div id="">
117
+ <h1 class="ForewordTitle">FOREWORD</h1>
118
+ <div class="boilerplate_legal"/>
119
+ </div>
120
+ #{IEC_TITLE1}
121
+ <div id="_terms_and_definitions"><h1>1&#160; Terms and definitions</h1>
122
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
123
+
124
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
125
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span>&#160; Foreign seeds, husks, bran, sand, dust.</p><ul>
126
+ <li>A</li>
127
+ </ul></div>
128
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span>&#160; </p>
129
+ <ul>
130
+ <li>A</li>
131
+ </ul>
132
+ </div>
133
+
134
+ <p>[TERMREF]
135
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
136
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
137
+ [/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
138
+ <p class="AltTerms" style="text-align:left;">rough rice</p>
139
+ <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
140
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
141
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span>&#160; </p>
142
+ <ul>
143
+ <li>A</li>
144
+ </ul>
145
+ </div>
146
+ <div id="_671a1994-4783-40d0-bc81-987d06ffb74e" class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
147
+ <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
148
+ <p>[TERMREF]
149
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
150
+ [/TERMREF]</p></div>
151
+ </div>
152
+ </body>
153
+ </html>
154
+ OUTPUT
155
+
156
+ word = <<~OUTPUT
148
157
  <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and definitions</h1><p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
149
158
 
150
159
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
@@ -152,6 +161,7 @@ OUTPUT
152
161
  <li>A</li>
153
162
  </ul></div>
154
163
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span><span style="mso-tab-count:1">&#160; </span></p>
164
+
155
165
  <ul>
156
166
  <li>A</li>
157
167
  </ul>
@@ -164,6 +174,7 @@ OUTPUT
164
174
  <p class="AltTerms" style="text-align:left;">rough rice</p>
165
175
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
166
176
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p><div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">&#160; </span></p>
177
+
167
178
  <ul>
168
179
  <li>A</li>
169
180
  </ul>
@@ -175,5 +186,8 @@ OUTPUT
175
186
  <a href="#ISO7301">ISO 7301:2011, 3.1</a>
176
187
  [/TERMREF]</p></div>
177
188
  OUTPUT
189
+ expect(xmlpp(IsoDoc::Iec::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
190
+ expect(xmlpp(IsoDoc::Iec::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
191
+ expect(xmlpp(IsoDoc::Iec::WordConvert.new({}).convert("test", presxml, true).sub(%r{^.*<div id="_terms_and_definitions">}m, '<div id="_terms_and_definitions">').sub(%r{</div>\s*<br[^>]*>\s*<div class="colophon"/>.*$}m, ""))).to be_equivalent_to xmlpp(word)
178
192
  end
179
193
  end
@@ -38,8 +38,9 @@ RSpec.describe Metanorma::Iec::Processor do
38
38
  processor.output(<<~"INPUT", "test.xml", "test.html", :html)
39
39
  <iec-standard xmlns="http://riboseinc.com/isoxml">
40
40
  <sections>
41
- <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
41
+ <terms id="H" obligation="normative"><title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
42
42
  <term id="J">
43
+ <name>1.1</name>
43
44
  <preferred>Term2</preferred>
44
45
  </term>
45
46
  </terms>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
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-26 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.1.0
33
+ version: 1.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.0
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: metanorma-iso
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.0
47
+ version: 1.5.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.4.0
54
+ version: 1.5.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -232,9 +232,6 @@ files:
232
232
  - lib/asciidoctor/iec/biblio.rng
233
233
  - lib/asciidoctor/iec/converter.rb
234
234
  - lib/asciidoctor/iec/front.rb
235
- - lib/asciidoctor/iec/i18n-en.yaml
236
- - lib/asciidoctor/iec/i18n-fr.yaml
237
- - lib/asciidoctor/iec/i18n-zh-Hans.yaml
238
235
  - lib/asciidoctor/iec/iec.rng
239
236
  - lib/asciidoctor/iec/iec_intro_en.xml
240
237
  - lib/asciidoctor/iec/iec_intro_fr.xml
@@ -258,7 +255,9 @@ files:
258
255
  - lib/isodoc/iec/i18n-en.yaml
259
256
  - lib/isodoc/iec/i18n-fr.yaml
260
257
  - lib/isodoc/iec/i18n-zh-Hans.yaml
258
+ - lib/isodoc/iec/i18n.rb
261
259
  - lib/isodoc/iec/iec.international-standard.xsl
260
+ - lib/isodoc/iec/init.rb
262
261
  - lib/isodoc/iec/metadata.rb
263
262
  - lib/isodoc/iec/pdf_convert.rb
264
263
  - lib/isodoc/iec/presentation_xml_convert.rb
@@ -1,12 +0,0 @@
1
- term_def_boilerplate: |
2
- <p>ISO and IEC maintain terminological databases for use in
3
- standardization at the following addresses:</p>
4
-
5
- <ul>
6
- <li> <p>IEC Electropedia: available at
7
- <link target="http://www.electropedia.org"/>
8
- </p> </li>
9
- <li> <p>ISO Online browsing platform: available at
10
- <link target="http://www.iso.org/obp"/></p> </li>
11
- </ul>
12
-
@@ -1,11 +0,0 @@
1
- term_def_boilerplate: |
2
- <p>L'ISO et l'IEC tiennent à jour des bases de données terminologiques
3
- destinées à être utilisées en normalisation, consultables aux adresses
4
- suivantes:</p>
5
- <ul>
6
- <li> <p>IEC Electropedia: disponible à l'adresse
7
- <link target="http://www.electropedia.org"/>
8
- </p> </li>
9
- <li> <p>ISO Online browsing platform: disponible à l'adresse
10
- <link target="http://www.iso.org/obp"/></p> </li>
11
- </ul>
@@ -1,9 +0,0 @@
1
- term_def_boilerplate: |
2
- <p>ISO和IEC用于标准化的术语数据库地址如下:</p>
3
- <ul>
4
- <li> <p>IEC Electropedia:
5
- 位于<link target="http://www.electropedia.org"/>
6
- </p> </li>
7
- <li> <p>ISO在线浏览平台:
8
- 位于<link target="http://www.iso.org/obp"/></p></li>
9
- </ul>