isodoc 0.5.8 → 0.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.tb.yml +20 -10
  3. data/lib/isodoc/blocks.rb +13 -13
  4. data/lib/isodoc/cleanup.rb +19 -3
  5. data/lib/isodoc/comments.rb +1 -1
  6. data/lib/isodoc/convert.rb +2 -0
  7. data/lib/isodoc/footnotes.rb +4 -2
  8. data/lib/isodoc/html.rb +28 -10
  9. data/lib/isodoc/i18n-en.yaml +9 -0
  10. data/lib/isodoc/i18n-fr.yaml +12 -3
  11. data/lib/isodoc/i18n-zh-Hans.yaml +10 -1
  12. data/lib/isodoc/i18n.rb +9 -2
  13. data/lib/isodoc/inline.rb +5 -6
  14. data/lib/isodoc/iso2wordhtml.rb +9 -6
  15. data/lib/isodoc/lists.rb +7 -5
  16. data/lib/isodoc/metadata.rb +27 -10
  17. data/lib/isodoc/references.rb +12 -6
  18. data/lib/isodoc/section.rb +17 -11
  19. data/lib/isodoc/table.rb +2 -4
  20. data/lib/isodoc/terms.rb +3 -3
  21. data/lib/isodoc/utils.rb +15 -14
  22. data/lib/isodoc/version.rb +1 -1
  23. data/lib/isodoc/wordconvert/comments.rb +1 -1
  24. data/lib/isodoc/wordconvert/wordconvertmodule.rb +51 -12
  25. data/lib/isodoc/xref_gen.rb +30 -26
  26. data/lib/isodoc/xref_sect_gen.rb +31 -13
  27. data/spec/assets/scripts.html +1 -0
  28. data/spec/isodoc/blocks_spec.rb +50 -49
  29. data/spec/isodoc/cleanup_spec.rb +6 -6
  30. data/spec/isodoc/footnotes_spec.rb +10 -2
  31. data/spec/isodoc/i18n_spec.rb +86 -54
  32. data/spec/isodoc/inline_spec.rb +22 -18
  33. data/spec/isodoc/lists_spec.rb +25 -11
  34. data/spec/isodoc/metadata_spec.rb +4 -3
  35. data/spec/isodoc/postproc_spec.rb +108 -42
  36. data/spec/isodoc/ref_spec.rb +9 -7
  37. data/spec/isodoc/section_spec.rb +162 -141
  38. data/spec/isodoc/table_spec.rb +18 -16
  39. data/spec/isodoc/terms_spec.rb +9 -9
  40. data/spec/isodoc/xref_spec.rb +153 -122
  41. metadata +3 -2
@@ -4,7 +4,7 @@ RSpec.describe IsoDoc do
4
4
  it "processes unordered lists" do
5
5
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <foreword>
7
+ <preface><foreword>
8
8
  <ul id="_61961034-0fb1-436b-b281-828857a59ddb">
9
9
  <li>
10
10
  <p id="_cb370dd3-8463-4ec7-aa1a-96f644e2e9a2">updated normative references;</p>
@@ -13,7 +13,7 @@ RSpec.describe IsoDoc do
13
13
  <p id="_60eb765c-1f6c-418a-8016-29efa06bf4f9">deletion of 4.3.</p>
14
14
  </li>
15
15
  </ul>
16
- </foreword>
16
+ </foreword></preface>
17
17
  </iso-standard>
18
18
  INPUT
19
19
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -52,7 +52,7 @@ RSpec.describe IsoDoc do
52
52
  it "processes ordered lists" do
53
53
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
54
54
  <iso-standard xmlns="http://riboseinc.com/isoxml">
55
- <foreword>
55
+ <preface><foreword>
56
56
  <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
57
57
  <li>
58
58
  <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
@@ -68,7 +68,7 @@ RSpec.describe IsoDoc do
68
68
  </ol>
69
69
  </ol>
70
70
  </ol>
71
- </foreword>
71
+ </foreword></preface>
72
72
  </iso-standard>
73
73
  INPUT
74
74
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -114,7 +114,7 @@ RSpec.describe IsoDoc do
114
114
  it "processes Roman Upper ordered lists" do
115
115
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
116
116
  <iso-standard xmlns="http://riboseinc.com/isoxml">
117
- <foreword>
117
+ <preface><foreword>
118
118
  <ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
119
119
  <li>
120
120
  <p id="_0091a277-fb0e-424a-aea8-f0001303fe78">all information necessary for the complete identification of the sample;</p>
@@ -126,7 +126,7 @@ RSpec.describe IsoDoc do
126
126
  <p id="_ea248b7f-839f-460f-a173-a58a830b2abe">the sampling method used;</p>
127
127
  </li>
128
128
  </ol>
129
- </foreword>
129
+ </foreword></preface>
130
130
  </iso-standard>
131
131
  INPUT
132
132
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -168,7 +168,7 @@ RSpec.describe IsoDoc do
168
168
  it "processes definition lists" do
169
169
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
170
170
  <iso-standard xmlns="http://riboseinc.com/isoxml">
171
- <foreword>
171
+ <preface><foreword>
172
172
  <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
173
173
  <dt>
174
174
  W
@@ -178,8 +178,9 @@ RSpec.describe IsoDoc do
178
178
  </dd>
179
179
  <dt><stem type="AsciiMath">w</stem></dt>
180
180
  <dd><p>??</p></dd>
181
+ <note><p>This is a note</p></note>
181
182
  </dl>
182
- </foreword>
183
+ </foreword></preface>
183
184
  </iso-standard>
184
185
  INPUT
185
186
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -210,6 +211,9 @@ RSpec.describe IsoDoc do
210
211
  <p>??</p>
211
212
  </dd>
212
213
  </dl>
214
+ <div id="" class="Note">
215
+ <p class="Note"><span class="note_label">NOTE</span>&#160; This is a note</p>
216
+ </div>
213
217
  </div>
214
218
  <p>&#160;</p>
215
219
  </div>
@@ -226,7 +230,7 @@ RSpec.describe IsoDoc do
226
230
  it "processes definition lists (Word)" do
227
231
  expect(IsoDoc::WordConvert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
228
232
  <iso-standard xmlns="http://riboseinc.com/isoxml">
229
- <foreword>
233
+ <preface><foreword>
230
234
  <dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
231
235
  <dt>
232
236
  W
@@ -236,8 +240,9 @@ RSpec.describe IsoDoc do
236
240
  </dd>
237
241
  <dt><stem type="AsciiMath">w</stem></dt>
238
242
  <dd><p>??</p></dd>
243
+ <note><p>This is a note</p></note>
239
244
  </dl>
240
- </foreword>
245
+ </foreword></preface>
241
246
  </iso-standard>
242
247
  INPUT
243
248
  <html xmlns:epub="http://www.idpf.org/2007/ops">
@@ -255,7 +260,7 @@ RSpec.describe IsoDoc do
255
260
  <table class="dl">
256
261
  <tr>
257
262
  <td valign="top" align="left">
258
- <p style="text-align: left;">
263
+ <p align="left" style="margin-left:0pt;text-align:left;">
259
264
  W
260
265
  </p>
261
266
  </td>
@@ -265,12 +270,21 @@ RSpec.describe IsoDoc do
265
270
  </tr>
266
271
  <tr>
267
272
  <td valign="top" align="left">
273
+ <p align="left" style="margin-left:0pt;text-align:left;">
268
274
  <span class="stem">(#(w)#)</span>
275
+ </p>
269
276
  </td>
270
277
  <td valign="top">
271
278
  <p>??</p>
272
279
  </td>
273
280
  </tr>
281
+ <tr>
282
+ <td rowspan="2">
283
+ <div id="" class="Note">
284
+ <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>This is a note</p>
285
+ </div>
286
+ </td>
287
+ </tr>
274
288
  </table>
275
289
  </div>
276
290
  <p>&#160;</p>
@@ -42,6 +42,7 @@ RSpec.describe IsoDoc do
42
42
  <status>
43
43
  <stage>30</stage>
44
44
  <substage>92</substage>
45
+ <iteration>3</iteration>
45
46
  </status>
46
47
  <copyright>
47
48
  <from>2016</from>
@@ -60,11 +61,11 @@ RSpec.describe IsoDoc do
60
61
  </bibdata><version>
61
62
  <edition>2</edition>
62
63
  <revision-date>2016-05-01</revision-date>
63
-
64
+ <draft>0.4</draft>
64
65
  </version>
65
66
  </iso-standard>
66
67
  INPUT
67
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :createddate=>"2010&ndash;2011", :docnumber=>"CD 17301-1", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"CD", :tc=>"TC 34", :wg=>"WG 3"}
68
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :confirmeddate=>"XXX", :createddate=>"2010&ndash;2011", :docnumber=>"PreCD3 17301-1", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" ( 0.4, 2016-05-01)", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stageabbr=>"PreCD3", :tc=>"TC 34", :updateddate=>"XXX", :wg=>"WG 3"}
68
69
  OUTPUT
69
70
  end
70
71
 
@@ -134,7 +135,7 @@ OUTPUT
134
135
  </version>
135
136
  </iso-standard>
136
137
  INPUT
137
- {:accesseddate=>"XXX", :activateddate=>"XXX", :agency=>"ISO/IEC", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :docyear=>"2016", :draft=>"12", :draftinfo=>" ( 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stageabbr=>"CD", :tc=>"ABC 34", :wg=>"GHI 3"}
138
+ {:accesseddate=>"XXX", :agency=>"ISO/IEC", :confirmeddate=>"XXX", :createddate=>"XXX", :docnumber=>"CD 17301-1-3", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctype=>"International Standard", :docyear=>"2016", :draft=>"12", :draftinfo=>" ( 12, 2016-05-01)", :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :implementeddate=>"XXX", :issueddate=>"XXX", :obsoleteddate=>"XXX", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisheddate=>"XXX", :revdate=>"2016-05-01", :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"30", :stageabbr=>"CD", :tc=>"ABC 34", :updateddate=>"XXX", :wg=>"GHI 3"}
138
139
  OUTPUT
139
140
  end
140
141
 
@@ -6,11 +6,11 @@ RSpec.describe IsoDoc do
6
6
  system "rm -f test.html"
7
7
  IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert_file(<<~"INPUT", "test", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
- <foreword>
9
+ <preface><foreword>
10
10
  <note>
11
11
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
12
12
  </note>
13
- </foreword>
13
+ </foreword></preface>
14
14
  </iso-standard>
15
15
  INPUT
16
16
  expect(File.exist?("test.html")).to be true
@@ -26,11 +26,11 @@ RSpec.describe IsoDoc do
26
26
  system "rm -f test.html"
27
27
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert_file(<<~"INPUT", "test", false)
28
28
  <iso-standard xmlns="http://riboseinc.com/isoxml">
29
- <foreword>
29
+ <preface><foreword>
30
30
  <note>
31
31
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
32
32
  </note>
33
- </foreword>
33
+ </foreword></preface>
34
34
  </iso-standard>
35
35
  INPUT
36
36
  expect(File.exist?("test.doc")).to be true
@@ -58,19 +58,20 @@ RSpec.describe IsoDoc do
58
58
  it "generates HTML output docs with complete configuration" do
59
59
  system "rm -f test.doc"
60
60
  system "rm -f test.html"
61
- IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert_file(<<~"INPUT", "test", false)
61
+ IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert_file(<<~"INPUT", "test", false)
62
62
  <iso-standard xmlns="http://riboseinc.com/isoxml">
63
- <foreword>
63
+ <preface><foreword>
64
64
  <note>
65
65
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
66
66
  </note>
67
- </foreword>
67
+ </foreword></preface>
68
68
  </iso-standard>
69
69
  INPUT
70
70
  html = File.read("test.html")
71
71
  expect(html).to match(/a third empty stylesheet/)
72
72
  expect(html).to match(/an empty html cover page/)
73
73
  expect(html).to match(/an empty html intro page/)
74
+ expect(html).to match(/This is a script/)
74
75
  expect(html).to match(%r{Enkonduko</h1>})
75
76
  end
76
77
 
@@ -79,11 +80,11 @@ RSpec.describe IsoDoc do
79
80
  system "rm -f test.html"
80
81
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert_file(<<~"INPUT", "test", false)
81
82
  <iso-standard xmlns="http://riboseinc.com/isoxml">
82
- <foreword>
83
+ <preface><foreword>
83
84
  <note>
84
85
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
85
86
  </note>
86
- </foreword>
87
+ </foreword></preface>
87
88
  </iso-standard>
88
89
  INPUT
89
90
  word = File.read("test.doc")
@@ -100,14 +101,14 @@ RSpec.describe IsoDoc do
100
101
  system "rm -f test.html"
101
102
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert_file(<<~"INPUT", "test", false)
102
103
  <iso-standard xmlns="http://riboseinc.com/isoxml">
103
- <foreword>
104
+ <preface><foreword>
104
105
  <dl>
105
106
  <dt>Term</dt>
106
107
  <dd>Definition</dd>
107
108
  <dt>Term 2</dt>
108
109
  <dd>Definition 2</dd>
109
110
  </dl>
110
- </foreword>
111
+ </foreword></preface>
111
112
  </iso-standard>
112
113
  INPUT
113
114
  word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
@@ -120,13 +121,13 @@ RSpec.describe IsoDoc do
120
121
  <table class="dl">
121
122
  <tr>
122
123
  <td valign="top" align="left">
123
- <p style="text-align: left;" class="MsoNormal">Term</p>
124
+ <p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term</p>
124
125
  </td>
125
126
  <td valign="top">Definition</td>
126
127
  </tr>
127
128
  <tr>
128
129
  <td valign="top" align="left">
129
- <p style="text-align: left;" class="MsoNormal">Term 2</p>
130
+ <p align="left" style="margin-left:0pt;text-align:left;" class="MsoNormal">Term 2</p>
130
131
  </td>
131
132
  <td valign="top">Definition 2</td>
132
133
  </tr>
@@ -144,8 +145,12 @@ RSpec.describe IsoDoc do
144
145
  <iso-standard xmlns="http://riboseinc.com/isoxml">
145
146
  <annex id="P" inline-header="false" obligation="normative">
146
147
  <title>Annex</title>
147
- <subsection id="Q" inline-header="false" obligation="normative">
148
+ <clause id="Q" inline-header="false" obligation="normative">
148
149
  <title>Annex A.1</title>
150
+ </clause>
151
+ <appendix id="Q2" inline-header="false" obligation="normative">
152
+ <title>An Appendix</title>
153
+ </appendix>
149
154
  </annex>
150
155
  </iso-standard>
151
156
  INPUT
@@ -160,6 +165,9 @@ RSpec.describe IsoDoc do
160
165
  <div><a name="Q" id="Q"></a>
161
166
  <p class="h2Annex">A.1. Annex A.1</p>
162
167
  </div>
168
+ <div><a name="Q2" id="Q2"></a>
169
+ <p class="h2Annex">Appendix 1. An Appendix</p>
170
+ </div>
163
171
  </div>
164
172
  </div>
165
173
  OUTPUT
@@ -192,7 +200,7 @@ RSpec.describe IsoDoc do
192
200
  expect(word).to be_equivalent_to <<~"OUTPUT"
193
201
  <div class="WordSection3">
194
202
  <p class="zzSTDTitle1"></p>
195
- <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>3.<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1><p class="MsoNormal">For the purposes of this document,
203
+ <div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">&#xA0; </span>Terms and Definitions</h1><p class="MsoNormal">For the purposes of this document,
196
204
  the following terms and definitions apply.</p>
197
205
  <p class="MsoNormal">ISO and IEC maintain terminological databases for use in
198
206
  standardization at the following addresses:</p>
@@ -203,7 +211,7 @@ RSpec.describe IsoDoc do
203
211
  <li class="MsoNormal"> <p class="MsoNormal">IEC Electropedia: available at
204
212
  <a href="http://www.electropedia.org">http://www.electropedia.org</a>
205
213
  </p> </li> </ul>
206
- <p class="TermNum"><a name="paddy1" id="paddy1"></a>3.1</p><p class="Terms">paddy</p>
214
+ <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
207
215
  <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
208
216
  <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301: 2011, 3.1</a>, modified &mdash; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
209
217
  </div>
@@ -241,18 +249,18 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
241
249
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert_file(<<~"INPUT", "test", false)
242
250
  <iso-standard xmlns="http://riboseinc.com/isoxml">
243
251
  <sections>
244
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
252
+ <clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
245
253
 
246
254
  <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
247
255
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
248
256
  </fn></title>
249
- </subsection>
250
- <subsection id="O" inline-header="false" obligation="normative">
257
+ </clause>
258
+ <clause id="O" inline-header="false" obligation="normative">
251
259
  <title>Clause 4.2</title>
252
260
  <p>A<fn reference="1">
253
261
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
254
262
  </fn></p>
255
- </subsection></clause>
263
+ </clause></clause>
256
264
  </sections>
257
265
  </iso-standard>
258
266
 
@@ -266,7 +274,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
266
274
  <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
267
275
  \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
268
276
  <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
269
- <a href="#_Toc">4.<span style="mso-tab-count:1">&#xA0; </span>Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
277
+ <a href="#_Toc">1.<span style="mso-tab-count:1">&#xA0; </span>Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
270
278
  <span style="mso-tab-count:1 dotted">. </span>
271
279
  </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
272
280
  <span style="mso-element:field-begin"></span></span>
@@ -277,7 +285,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
277
285
  <p class="MsoToc2">
278
286
  <span class="MsoHyperlink">
279
287
  <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
280
- <a href="#_Toc">4.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
288
+ <a href="#_Toc">1.1. Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
281
289
  <span style="mso-tab-count:1 dotted">. </span>
282
290
  </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
283
291
  <span style="mso-element:field-begin"></span></span>
@@ -290,7 +298,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
290
298
  <p class="MsoToc2">
291
299
  <span class="MsoHyperlink">
292
300
  <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
293
- <a href="#_Toc">4.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
301
+ <a href="#_Toc">1.2. Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
294
302
  <span style="mso-tab-count:1 dotted">. </span>
295
303
  </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
296
304
  <span style="mso-element:field-begin"></span></span>
@@ -322,18 +330,18 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
322
330
  <sections>
323
331
  <clause inline-header="false" obligation="normative"><title>Clause 4</title><fn reference="3">
324
332
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">This is a footnote.</p>
325
- </fn><subsection id="N" inline-header="false" obligation="normative">
333
+ </fn><clause id="N" inline-header="false" obligation="normative">
326
334
 
327
335
  <title>Introduction to this<fn reference="2">
328
336
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
329
337
  </fn></title>
330
- </subsection>
331
- <subsection id="O" inline-header="false" obligation="normative">
338
+ </clause>
339
+ <clause id="O" inline-header="false" obligation="normative">
332
340
  <title>Clause 4.2</title>
333
341
  <p>A<fn reference="1">
334
342
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
335
343
  </fn></p>
336
- </subsection></clause>
344
+ </clause></clause>
337
345
  </sections>
338
346
  </iso-standard>
339
347
  INPUT
@@ -343,23 +351,23 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
343
351
  <div class="WordSection3">
344
352
  <p class="zzSTDTitle1"></p>
345
353
  <div>
346
- <h1>4.&#xA0; Clause 4</h1>
354
+ <h1>1.&#xA0; Clause 4</h1>
347
355
  <a href="#ftn3" epub:type="footnote" id="_footnote1">
348
356
  <sup>1</sup>
349
357
  </a>
350
358
  <div id="N">
351
359
 
352
- <h2>4.1. Introduction to this<a href="#ftn2" epub:type="footnote" id="_footnote2"><sup>2</sup></a></h2>
360
+ <h2>1.1. Introduction to this<a href="#ftn2" epub:type="footnote" id="_footnote2"><sup>2</sup></a></h2>
353
361
  </div>
354
362
  <div id="O">
355
- <h2>4.2. Clause 4.2</h2>
363
+ <h2>1.2. Clause 4.2</h2>
356
364
  <p>A<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
357
365
  </div>
358
366
  </div>
359
- <aside id="ftn3">
367
+ <aside id="ftn3" class="footnote">
360
368
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a href="#_footnote1">1) </a>This is a footnote.</p>
361
369
  </aside>
362
- <aside id="ftn2">
370
+ <aside id="ftn2" class="footnote">
363
371
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a href="#_footnote2">2) </a>Formerly denoted as 15 % (m/m).</p>
364
372
  </aside>
365
373
 
@@ -372,12 +380,12 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
372
380
  system "rm -rf _images"
373
381
  IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert_file(<<~"INPUT", "test", false)
374
382
  <iso-standard xmlns="http://riboseinc.com/isoxml">
375
- <foreword>
383
+ <preface><foreword>
376
384
  <figure id="_">
377
385
  <name>Split-it-right sample divider</name>
378
386
  <image src="spec/assets/rice_image1.png" id="_" imagetype="PNG"/>
379
387
  </figure>
380
- </foreword>
388
+ </foreword></preface>
381
389
  </iso-standard>
382
390
  INPUT
383
391
  html = File.read("test.html").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
@@ -391,7 +399,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
391
399
  <div id="_" class="figure">
392
400
 
393
401
  <img src="_images/_.png" width="800" height="673" />
394
- <p class="FigureTitle" align="center"><b>Figure 1&#xA0;&#x2014; Split-it-right sample divider</b></p></div>
402
+ <p class="FigureTitle" align="center">Figure 1&#xA0;&#x2014; Split-it-right sample divider</p></div>
395
403
  </div>
396
404
  <p>&#xA0;</p>
397
405
  </div>
@@ -405,18 +413,18 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
405
413
  IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", htmlintropage: "spec/assets/htmlintro.html"}).convert_file(<<~"INPUT", "test", false)
406
414
  <iso-standard xmlns="http://riboseinc.com/isoxml">
407
415
  <sections>
408
- <clause inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
416
+ <clause inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
409
417
 
410
418
  <title>Introduction<bookmark id="Q"/> to this<fn reference="1">
411
419
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
412
420
  </fn></title>
413
- </subsection>
414
- <subsection id="O" inline-header="false" obligation="normative">
421
+ </clause>
422
+ <clause id="O" inline-header="false" obligation="normative">
415
423
  <title>Clause 4.2</title>
416
424
  <p>A<fn reference="1">
417
425
  <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p>
418
426
  </fn></p>
419
- </subsection></clause>
427
+ </clause></clause>
420
428
  <clause inline-header="false" obligation="normative"><title>Clause 5</title></clause>
421
429
  </sections>
422
430
  </iso-standard>
@@ -427,10 +435,9 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
427
435
  expect(html.gsub(/"#[a-f0-9-]+"/, "#_")).to be_equivalent_to <<~"OUTPUT"
428
436
  <div class="WordSection2">
429
437
 
430
- <p>/* an empty html intro page */
438
+ /* an empty html intro page */
431
439
 
432
- </p>
433
- <ul><li><a href=#_>5.&#xA0; Clause 4</a></li><ul><li><a href=#_>4.1. Introduction to this</a></li><li><a href=#_>4.2. Clause 4.2</a></li></ul><li><a href=#_>5.&#xA0; Clause 5</a></li></ul>
440
+ <ul><li><a href=#_>2.&#xA0; Clause 4</a></li><ul><li><a href=#_>1.1. Introduction to this</a></li><li><a href=#_>1.2. Clause 4.2</a></li></ul><li><a href=#_>2.&#xA0; Clause 5</a></li></ul>
434
441
 
435
442
 
436
443
 
@@ -441,4 +448,63 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
441
448
  OUTPUT
442
449
  end
443
450
 
451
+ it "processes IsoXML terms for HTML" do
452
+ system "rm -f test.doc"
453
+ system "rm -f test.html"
454
+ IsoDoc::Convert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert_file(<<~"INPUT", "test", false)
455
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
456
+ <sections>
457
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
458
+
459
+ <term id="paddy1"><preferred>paddy</preferred>
460
+ <domain>rice</domain>
461
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
462
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
463
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
464
+ <ul>
465
+ <li>A</li>
466
+ </ul>
467
+ </termexample>
468
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
469
+ <ul>
470
+ <li>A</li>
471
+ </ul>
472
+ </termexample>
473
+
474
+ <termsource status="modified">
475
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301: 2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
476
+ <modification>
477
+ <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>
478
+ </modification>
479
+ </termsource></term>
480
+
481
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
482
+ <admitted>rough rice</admitted>
483
+ <deprecates>cargo rice</deprecates>
484
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
485
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
486
+ <ul>
487
+ <li>A</li>
488
+ </ul>
489
+ </termexample>
490
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
491
+ <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>
492
+ </termnote>
493
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
494
+ <ul><li>A</li></ul>
495
+ <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>
496
+ </termnote>
497
+ <termsource status="identical">
498
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301: 2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
499
+ </termsource></term>
500
+ </terms>
501
+ </sections>
502
+ </iso-standard>
503
+ INPUT
504
+ expect(File.exist?("test.html")).to be true
505
+ html = File.read("test.html")
506
+ expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1</h2>})
507
+ expect(html).to match(%r{<h2 class="TermNum" id="paddy">1\.2</h2>})
508
+ end
509
+
444
510
  end