metanorma-iso 1.10.1 → 1.10.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ubuntu.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/lib/asciidoctor/iso/base.rb +1 -1
  5. data/lib/asciidoctor/iso/basicdoc.rng +1 -11
  6. data/lib/asciidoctor/iso/biblio.rng +0 -2
  7. data/lib/asciidoctor/iso/front.rb +17 -4
  8. data/lib/asciidoctor/iso/front_id.rb +20 -17
  9. data/lib/asciidoctor/iso/isodoc.rng +61 -19
  10. data/lib/asciidoctor/iso/isostandard-amd.rng +1 -1
  11. data/lib/asciidoctor/iso/isostandard.rng +15 -3
  12. data/lib/asciidoctor/iso/reqt.rng +1 -1
  13. data/lib/asciidoctor/iso/section.rb +1 -1
  14. data/lib/asciidoctor/iso/validate.rb +1 -1
  15. data/lib/asciidoctor/iso/validate_image.rb +1 -1
  16. data/lib/asciidoctor/iso/validate_section.rb +1 -1
  17. data/lib/isodoc/iso/base_convert.rb +14 -31
  18. data/lib/isodoc/iso/html/isodoc.css +0 -1
  19. data/lib/isodoc/iso/html/isodoc.scss +0 -1
  20. data/lib/isodoc/iso/html/style-human.css +40 -9
  21. data/lib/isodoc/iso/html/style-human.scss +36 -9
  22. data/lib/isodoc/iso/html/style-iso.css +35 -6
  23. data/lib/isodoc/iso/html/style-iso.scss +31 -6
  24. data/lib/isodoc/iso/html/wordstyle.css +10 -8
  25. data/lib/isodoc/iso/html/wordstyle.scss +10 -8
  26. data/lib/isodoc/iso/html_convert.rb +81 -22
  27. data/lib/isodoc/iso/index.rb +53 -45
  28. data/lib/isodoc/iso/iso.amendment.xsl +333 -113
  29. data/lib/isodoc/iso/iso.international-standard.xsl +333 -113
  30. data/lib/isodoc/iso/isosts_convert.rb +6 -2
  31. data/lib/isodoc/iso/metadata.rb +27 -22
  32. data/lib/isodoc/iso/presentation_xml_convert.rb +60 -25
  33. data/lib/isodoc/iso/sts_convert.rb +3 -2
  34. data/lib/isodoc/iso/word_convert.rb +0 -2
  35. data/lib/metanorma/iso/processor.rb +2 -2
  36. data/lib/metanorma/iso/version.rb +1 -1
  37. data/metanorma-iso.gemspec +3 -3
  38. data/spec/asciidoctor/base_spec.rb +397 -545
  39. data/spec/asciidoctor/blocks_spec.rb +4 -4
  40. data/spec/asciidoctor/cleanup_spec.rb +15 -12
  41. data/spec/asciidoctor/refs_spec.rb +87 -84
  42. data/spec/isodoc/amd_spec.rb +261 -250
  43. data/spec/isodoc/i18n_spec.rb +7 -7
  44. data/spec/isodoc/inline_spec.rb +242 -216
  45. data/spec/isodoc/iso_spec.rb +3 -1
  46. data/spec/isodoc/postproc_spec.rb +111 -28
  47. data/spec/isodoc/section_spec.rb +3 -3
  48. data/spec/isodoc/terms_spec.rb +34 -41
  49. data/spec/isodoc/xref_spec.rb +3 -3
  50. data/spec/metanorma/processor_spec.rb +110 -14
  51. data/spec/vcr_cassettes/docrels.yml +37 -427
  52. metadata +8 -8
@@ -48,7 +48,7 @@ RSpec.describe IsoDoc do
48
48
  expect(File.exist?("test.html")).to be true
49
49
  html = File.read("test.html", encoding: "UTF-8")
50
50
  expect(html).to include "<title>Cereals and pulses&#xA0;&#x2014; "\
51
- "Specifications and test methods&#xA0;&#x2014; Rice</title>"
51
+ "Specifications and test methods&#xA0;&#x2014; Rice</title>"
52
52
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
53
53
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
54
54
  end
@@ -77,7 +77,7 @@ RSpec.describe IsoDoc do
77
77
  expect(File.exist?("test.html")).to be true
78
78
  html = File.read("test.html", encoding: "UTF-8")
79
79
  expect(html).to include "title>Cereals and pulses&#xA0;&#x2014; "\
80
- "Specifications and test methods&#xA0;&#x2014; Rice</title>"
80
+ "Specifications and test methods&#xA0;&#x2014; Rice</title>"
81
81
  expect(html).to match(%r{cdnjs\.cloudflare\.com/ajax/libs/mathjax/})
82
82
  expect(html).to match(/delimiters: \[\['\(#\(', '\)#\)'\]\]/)
83
83
  end
@@ -206,14 +206,10 @@ RSpec.describe IsoDoc do
206
206
  <definition>
207
207
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
208
208
  </definition>
209
- <termsource status="modified">
210
- <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline">
211
- <locality type="clause">
212
- <referenceFrom>3.1</referenceFrom>
213
- </locality>ISO 7301:2011, 3.1</origin>
214
- <modification>
215
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here</p>
216
- </modification>
209
+ <termsource status="modified">[SOURCE:
210
+ <origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline"><locality type="clause">
211
+ <referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified &#x2013;
212
+ The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here]
217
213
  </termsource>
218
214
  </term>
219
215
  </terms>
@@ -226,23 +222,32 @@ RSpec.describe IsoDoc do
226
222
  .sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
227
223
 
228
224
  expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
229
- <div class="WordSection3">
230
- <p class="zzSTDTitle1"/>
231
- <div>
232
- <a id="_terms_and_definitions" name="_terms_and_definitions"/>
233
- <h1>1
234
- <span style="mso-tab-count:1">  </span>
235
- Terms and Definitions</h1>
236
- <p class="TermNum">
237
- <a id="paddy1" name="paddy1"/>1.1</p>
238
- <p class="Terms" style="text-align:left;">paddy</p>
239
- <p class="Definition">
240
- <a id="_eb29b35e-123e-4d1c-b50b-2714d41e747f" name="_eb29b35e-123e-4d1c-b50b-2714d41e747f"/>rice retaining its husk after threshing</p>
241
- <p class="Source">[SOURCE:
242
- <a href="#ISO7301">ISO 7301:2011, 3.1</a>
243
- , modified — The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here]</p>
244
- </div>
245
- </div>
225
+ <div class='WordSection3'>
226
+ <p class='zzSTDTitle1'/>
227
+ <div>
228
+ <a name='_terms_and_definitions' id='_terms_and_definitions'/>
229
+ <h1>
230
+ 1
231
+ <span style='mso-tab-count:1'>&#xA0; </span>
232
+ Terms and Definitions
233
+ </h1>
234
+ <p class='TermNum'>
235
+ <a name='paddy1' id='paddy1'/>
236
+ 1.1
237
+ </p>
238
+ <p class='Terms' style='text-align:left;'>paddy</p>
239
+ <p class='Definition'>
240
+ <a name='_eb29b35e-123e-4d1c-b50b-2714d41e747f' id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'/>
241
+ rice retaining its husk after threshing
242
+ </p>
243
+ <p class='Source'>
244
+ [SOURCE:
245
+ <a href='#ISO7301'>ISO 7301:2011, 3.1</a>
246
+ , modified &#x2013; The term "cargo rice" is shown as deprecated, and Note
247
+ 1 to entry is not included here]
248
+ </p>
249
+ </div>
250
+ </div>
246
251
  OUTPUT
247
252
  end
248
253
 
@@ -262,6 +267,84 @@ RSpec.describe IsoDoc do
262
267
  expect(word).to include('Content-Disposition: inline; filename="header.html"')
263
268
  end
264
269
 
270
+ it "populates HTML ToC" do
271
+ IsoDoc::Iso::HtmlConvert
272
+ .new(WORD_HTML_CSS.dup)
273
+ .convert("test", <<~"INPUT", false)
274
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
275
+ <sections>
276
+ <clause id="A" inline-header="false" obligation="normative">
277
+ <title>1
278
+ <tab/>
279
+ Clause 4</title>
280
+ <clause id="N" inline-header="false" obligation="normative">
281
+ <title>1.1
282
+ <tab/>
283
+ Introduction
284
+ <bookmark id="Q"/>
285
+ to this
286
+ <fn reference="1">
287
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
288
+ </title>
289
+ </clause>
290
+ <clause id="O" inline-header="false" obligation="normative">
291
+ <title>1.2
292
+ <tab/>
293
+ Clause 4.2</title>
294
+ <p>A
295
+ <fn reference="1">
296
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6">Formerly denoted as 15 % (m/m).</p></fn>
297
+ </p>
298
+ </clause>
299
+ </clause>
300
+ <clause id="P"><title>2<tab/>Clause 5</title>
301
+ <clause id="P1"><title>2.1<tab/>Clause 5.1</title></clause>
302
+ </clause>
303
+ <clause id="Q"><title>3<tab/>Clause 6</title></clause>
304
+ </sections>
305
+ </iso-standard>
306
+ INPUT
307
+
308
+ html = Nokogiri::XML(File.read("test.html", encoding: "UTF-8"))
309
+ .at("//div[@id = 'toc']").to_xml
310
+
311
+ expect(xmlpp(html))
312
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
313
+ <div id='toc'>
314
+ <ul>
315
+ <li class='h1'>
316
+ <div class='collapse-group'>
317
+ <a href='#toc0'>1 &#xA0; Clause 4</a>
318
+ <div class='collapse-button'/>
319
+ </div>
320
+ <ul class='content collapse'>
321
+ <li class='h2'>
322
+ <a href='#toc1'> 1.1 &#xA0; Introduction to this </a>
323
+ </li>
324
+ <li class='h2'>
325
+ <a href='#toc2'> 1.2 &#xA0; Clause 4.2</a>
326
+ </li>
327
+ </ul>
328
+ </li>
329
+ <li class='h1'>
330
+ <div class='collapse-group'>
331
+ <a href='#toc3'>2&#xA0; Clause 5</a>
332
+ <div class='collapse-button'/>
333
+ </div>
334
+ <ul class='content collapse'>
335
+ <li class='h2'>
336
+ <a href='#toc4'> 2.1&#xA0; Clause 5.1</a>
337
+ </li>
338
+ </ul>
339
+ </li>
340
+ <li class='h1'>
341
+ <a href='#toc5'> 3&#xA0; Clause 6</a>
342
+ </li>
343
+ </ul>
344
+ </div>
345
+ OUTPUT
346
+ end
347
+
265
348
  it "populates Word ToC" do
266
349
  IsoDoc::Iso::WordConvert
267
350
  .new(WORD_HTML_CSS_WORDINTRO.dup)
@@ -886,7 +969,7 @@ RSpec.describe IsoDoc do
886
969
  </div>
887
970
  OUTPUT
888
971
  expect(word).to include '<p class="zzWarning">This document is not '\
889
- "an ISO International Standard"
972
+ "an ISO International Standard"
890
973
  end
891
974
 
892
975
  it "populates Word ToC" do
@@ -110,7 +110,7 @@ RSpec.describe IsoDoc do
110
110
  <terms id="I" obligation="normative">
111
111
  <title depth="2">3.1<tab/>Normal Terms</title>
112
112
  <term id="J"><name>3.1.1</name>
113
- <preferred>Term2</preferred>
113
+ <preferred><strong>Term2</strong></preferred>
114
114
  </term>
115
115
  </terms>
116
116
  <definitions id="K" inline-header="true"><title>3.2</title>
@@ -196,7 +196,7 @@ RSpec.describe IsoDoc do
196
196
  <div id="I">
197
197
  <h2>3.1&#160; Normal Terms</h2>
198
198
  <p class="TermNum" id="J">3.1.1</p>
199
- <p class="Terms" style="text-align:left;">Term2</p>
199
+ <p class="Terms" style="text-align:left;"><b>Term2</b></p>
200
200
  </div>
201
201
  <div id="K">
202
202
  <span class="zzMoveToFollowing">
@@ -321,7 +321,7 @@ RSpec.describe IsoDoc do
321
321
  <span style="mso-tab-count:1">&#160; </span>
322
322
  Normal Terms</h2>
323
323
  <p class="TermNum" id="J">3.1.1</p>
324
- <p class="Terms" style="text-align:left;">Term2</p>
324
+ <p class="Terms" style="text-align:left;"><b>Term2</b></p>
325
325
  </div>
326
326
  <div id="K">
327
327
  <span class="zzMoveToFollowing">
@@ -9,7 +9,7 @@ RSpec.describe IsoDoc do
9
9
  <term id="paddy1">
10
10
  <preferred><expression><name>paddy</name></expression></preferred>
11
11
  <domain>rice</domain>
12
- <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
12
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
13
13
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
14
14
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
15
15
  <ul>
@@ -35,29 +35,29 @@ RSpec.describe IsoDoc do
35
35
  <admitted><expression><name>paddy rice</name></expression></admitted>
36
36
  <admitted><expression><name>rough rice</name></expression></admitted>
37
37
  <deprecates><expression><name>cargo rice</name></expression></deprecates>
38
- <definition><verbaldefinition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbaldefinition></definition>
38
+ <definition><verbal-definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></verbal-definition></definition>
39
39
  <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
40
40
  <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>
41
41
  </termnote>
42
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
43
- <ul><li>A</li></ul>
44
- <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>
45
- </termnote>
46
42
  <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
47
43
  <ul>
48
44
  <li>A</li>
49
45
  </ul>
50
46
  </termexample>
47
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
48
+ <ul><li>A</li></ul>
49
+ <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>
50
+ </termnote>
51
51
  <termsource status="identical">
52
52
  <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
53
53
  </termsource>
54
54
  </term>
55
55
  <term id="A">
56
56
  <preferred><expression><name>term1</name></expression></preferred>
57
- <definition><verbaldefinition>term1 definition</verbaldefinition></definition>
57
+ <definition><verbal-definition>term1 definition</verbal-definition></definition>
58
58
  <term id="B">
59
59
  <preferred><expression><name>term2</name></expression></preferred>
60
- <definition><verbaldefinition>term2 definition</verbaldefinition></definition>
60
+ <definition><verbal-definition>term2 definition</verbal-definition></definition>
61
61
  </term>
62
62
  </term>
63
63
  </terms>
@@ -65,16 +65,16 @@ RSpec.describe IsoDoc do
65
65
  </iso-standard>
66
66
  INPUT
67
67
  presxml = <<~OUTPUT
68
+ <?xml version='1.0'?>
68
69
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
69
70
  <sections>
70
71
  <terms id='_terms_and_definitions' obligation='normative' displayorder='1'>
71
72
  <title depth='1'>1<tab/>Terms and Definitions</title>
72
73
 
73
74
  <term id='paddy1'><name>1.1</name>
74
- <preferred>paddy</preferred>
75
- <domain>rice</domain>
75
+ <preferred><strong>paddy</strong></preferred>
76
76
  <definition>
77
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
77
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&#x3c;rice&#x3e; rice retaining its husk after threshing</p>
78
78
  </definition>
79
79
  <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892'>
80
80
  <name>EXAMPLE 1</name>
@@ -89,15 +89,12 @@ RSpec.describe IsoDoc do
89
89
  <li>A</li>
90
90
  </ul>
91
91
  </termexample>
92
- <termsource status='modified'>
93
- <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
94
- <modification>
95
- <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>
96
- </modification>
92
+ <termsource status='modified'>[SOURCE:
93
+ <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified &#x2013; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]
97
94
  </termsource>
98
95
  </term>
99
96
  <term id='paddy'><name>1.2</name>
100
- <preferred>paddy</preferred>
97
+ <preferred><strong>paddy</strong></preferred>
101
98
  <admitted>paddy rice</admitted>
102
99
  <admitted>rough rice</admitted>
103
100
  <deprecates>cargo rice</deprecates>
@@ -123,17 +120,17 @@ RSpec.describe IsoDoc do
123
120
  <li>A</li>
124
121
  </ul>
125
122
  </termexample>
126
- <termsource status='identical'>
127
- <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
123
+ <termsource status='identical'>[SOURCE:
124
+ <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'><locality type='clause'><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>]
128
125
  </termsource>
129
126
  </term>
130
127
  <term id='A'>
131
128
  <name>1.3</name>
132
- <preferred>term1</preferred>
129
+ <preferred><strong>term1</strong></preferred>
133
130
  <definition>term1 definition</definition>
134
131
  <term id='B'>
135
132
  <name>1.3.1</name>
136
- <preferred>term2</preferred>
133
+ <preferred><strong>term2</strong></preferred>
137
134
  <definition>term2 definition</definition>
138
135
  </term>
139
136
  </term>
@@ -147,7 +144,7 @@ RSpec.describe IsoDoc do
147
144
  <p class="zzSTDTitle1"/>
148
145
  <div id="_terms_and_definitions">
149
146
  <h1>1&#160; Terms and Definitions</h1>
150
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
147
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;"><b>paddy</b></p>
151
148
 
152
149
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
153
150
  <div class="example" id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
@@ -163,12 +160,11 @@ RSpec.describe IsoDoc do
163
160
  <li>A</li>
164
161
  </ul>
165
162
  </div>
166
- <p>[TERMREF]
167
- <a href="#ISO7301">ISO 7301:2011, 3.1</a>
168
- [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
169
- [/TERMREF]</p>
163
+ <p>[SOURCE:
164
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &#8211;
165
+ The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p>
170
166
  <p class="TermNum" id="paddy">1.2</p>
171
- <p class="Terms" style="text-align:left;">paddy</p>
167
+ <p class="Terms" style="text-align:left;"><b>paddy</b></p>
172
168
  <p class="AltTerms" style="text-align:left;">paddy rice</p>
173
169
  <p class="AltTerms" style="text-align:left;">rough rice</p>
174
170
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
@@ -191,13 +187,12 @@ RSpec.describe IsoDoc do
191
187
  <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>
192
188
  </p>
193
189
  </div>
194
- <p>[TERMREF]<a href="#ISO7301">ISO 7301:2011, 3.1</a>
195
- [/TERMREF]</p>
190
+ <p>[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>]</p>
196
191
  <p class='TermNum' id='A'>1.3</p>
197
- <p class='Terms' style='text-align:left;'>term1</p>
192
+ <p class='Terms' style='text-align:left;'><b>term1</b></p>
198
193
  term1 definition
199
194
  <p class='TermNum' id='B'>1.3.1</p>
200
- <p class='Terms' style='text-align:left;'>term2</p>
195
+ <p class='Terms' style='text-align:left;'><b>term2</b></p>
201
196
  term2 definition
202
197
  </div>
203
198
  </div>
@@ -207,7 +202,7 @@ RSpec.describe IsoDoc do
207
202
 
208
203
  word = <<~OUTPUT
209
204
  <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1>
210
- <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
205
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;"><b>paddy</b></p>
211
206
 
212
207
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f" class="Definition">&lt;rice&gt; rice retaining its husk after threshing</p>
213
208
  <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span>Foreign seeds, husks, bran, sand, dust.</p><ul>
@@ -217,12 +212,11 @@ RSpec.describe IsoDoc do
217
212
  <li>A</li>
218
213
  </ul></div>
219
214
 
220
- <p class="Source">[TERMREF]
221
- <a href="#ISO7301">ISO 7301:2011, 3.1</a>
222
- [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
223
- [/TERMREF]</p>
215
+ <p class="Source">[SOURCE:
216
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified &#8211;
217
+ The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p>
224
218
  <p class="TermNum" id="paddy">1.2</p>
225
- <p class="Terms" style="text-align:left;">paddy</p>
219
+ <p class="Terms" style="text-align:left;"><b>paddy</b></p>
226
220
  <p class="AltTerms" style="text-align:left;">paddy rice</p>
227
221
  <p class="AltTerms" style="text-align:left;">rough rice</p>
228
222
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
@@ -234,13 +228,12 @@ RSpec.describe IsoDoc do
234
228
  </div>
235
229
  <div id='_671a1994-4783-40d0-bc81-987d06ffb74e' class="Note"><p class="Note">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>
236
230
  <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class="Note"><p class="Note">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>
237
- <p class="Source">[TERMREF]<a href="#ISO7301">ISO 7301:2011, 3.1</a>
238
- [/TERMREF]</p>
231
+ <p class="Source">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>]</p>
239
232
  <p class='TermNum' id='A'>1.3</p>
240
- <p class='Terms' style='text-align:left;'>term1</p>
233
+ <p class='Terms' style='text-align:left;'><b>term1</b></p>
241
234
  term1 definition
242
235
  <p class='TermNum' id='B'>1.3.1</p>
243
- <p class='Terms' style='text-align:left;'>term2</p>
236
+ <p class='Terms' style='text-align:left;'><b>term2</b></p>
244
237
  term2 definition
245
238
  </div>
246
239
  OUTPUT
@@ -1002,7 +1002,7 @@ RSpec.describe IsoDoc do
1002
1002
  <title>2</title>
1003
1003
  <term id="_waxy_rice">
1004
1004
  <name>2.1</name>
1005
- <preferred>waxy rice</preferred>
1005
+ <preferred><strong>waxy rice</strong></preferred>
1006
1006
  <termnote id="note1">
1007
1007
  <name>Note 1 to entry</name>
1008
1008
  <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
@@ -1012,7 +1012,7 @@ RSpec.describe IsoDoc do
1012
1012
  </term>
1013
1013
  <term id="_nonwaxy_rice">
1014
1014
  <name>2.2</name>
1015
- <preferred>nonwaxy rice</preferred>
1015
+ <preferred><strong>nonwaxy rice</strong></preferred>
1016
1016
  <termnote id="note2">
1017
1017
  <name>Note 1 to entry</name>
1018
1018
  <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
@@ -1199,7 +1199,7 @@ RSpec.describe IsoDoc do
1199
1199
  </title>
1200
1200
  <term id='J'>
1201
1201
  <name>3.1.1</name>
1202
- <preferred>Term2</preferred>
1202
+ <preferred><strong>Term2</strong></preferred>
1203
1203
  </term>
1204
1204
  </terms>
1205
1205
  <definitions id='K' inline-header='true'>
@@ -8,6 +8,100 @@ RSpec.describe Metanorma::Iso::Processor do
8
8
  registry.register(Metanorma::Iso::Processor)
9
9
  processor = registry.find_processor(:iso)
10
10
 
11
+ inputxml = <<~INPUT
12
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
13
+ <bibdata type="standard">
14
+ <title language="en" format="text/plain" type="main">English</title>
15
+ <title language="en" format="text/plain" type="title-main">English</title>
16
+ <title language="fr" format="text/plain" type="main">French</title>
17
+ <title language="fr" format="text/plain" type="title-main">French</title>
18
+ <docidentifier type="ISO">ISO DIR 1</docidentifier><docidentifier type="iso-with-lang">ISO DIR 1(F)</docidentifier><docidentifier type="iso-reference">ISO DIR 1(F)</docidentifier>
19
+ <docnumber>1</docnumber>
20
+ <contributor>
21
+ <role type="author"/>
22
+ <organization>
23
+ <name>International Organization for Standardization</name>
24
+ <abbreviation>ISO</abbreviation>
25
+ </organization>
26
+ </contributor>
27
+ <contributor>
28
+ <role type="publisher"/>
29
+ <organization>
30
+ <name>International Organization for Standardization</name>
31
+ <abbreviation>ISO</abbreviation>
32
+ </organization>
33
+ </contributor>
34
+ <language>fr</language>
35
+ <script>Latn</script>
36
+ <status>
37
+ <stage abbreviation="IS">60</stage>
38
+ <substage>60</substage>
39
+ </status>
40
+ <copyright>
41
+ <from>2021</from>
42
+ <owner>
43
+ <organization>
44
+ <name>International Organization for Standardization</name>
45
+ <abbreviation>ISO</abbreviation>
46
+ </organization>
47
+ </owner>
48
+ </copyright>
49
+ <ext>
50
+ <doctype>directive</doctype>
51
+ <subdoctype>vocabulary</subdoctype>
52
+ <editorialgroup>
53
+ <technical-committee/>
54
+ <subcommittee/>
55
+ <workgroup/>
56
+ </editorialgroup>
57
+ <structuredidentifier>
58
+ <project-number>ISO 1</project-number>
59
+ </structuredidentifier>
60
+ <stagename>International standard</stagename>
61
+ </ext>
62
+ </bibdata>
63
+ <boilerplate>
64
+ <copyright-statement>
65
+ <clause>
66
+ <title>DOCUMENT PROT&#201;G&#201; PAR COPYRIGHT</title>
67
+ <p id="boilerplate-year">&#169; ISO 2021</p>
68
+
69
+ <p id="boilerplate-message">
70
+ Droits de reproduction r&#233;serv&#233;s. Sauf indication contraire, aucune partie de cette publication ne
71
+ peut &#234;tre reproduite ni utilis&#233;e sous quelque forme que ce soit et par aucun proc&#233;d&#233;, &#233;lectronique
72
+ ou m&#233;canique, y compris la photocopie, l&#8217;affichage sur l&#8217;internet ou sur un Intranet, sans
73
+ autorisation &#233;crite pr&#233;alable. Les demandes d&#8217;autorisation peuvent &#234;tre adress&#233;es &#224; l&#8217;ISO &#224;
74
+ l&#8217;adresse ci-apr&#232;s ou au comit&#233; membre de l&#8217;ISO dans le pays du demandeur.
75
+ </p>
76
+
77
+ <p id="boilerplate-address" align="left">
78
+ ISO copyright office<br/>
79
+ Ch. de Blandonnet 8 &#8226; CP 401<br/>
80
+ CH-1214 Vernier, Geneva, Switzerland<br/>
81
+ Tel.&#160;&#160;+ 41 22 749 01 11<br/>
82
+ Fax&#160;&#160;+ 41 22 749 09 47<br/>
83
+ Email: copyright@iso.org<br/>
84
+ Website: www.iso.org
85
+ </p>
86
+ <p id="boilerplate-place">
87
+ Publi&#233; en Suisse
88
+ </p>
89
+ </clause>
90
+ </copyright-statement>
91
+
92
+
93
+ </boilerplate>
94
+ <sections>
95
+ <terms id="H" obligation="normative"><title>1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</title>
96
+ <term id="J">
97
+ <name>1.1</name>
98
+ <preferred>Term2</preferred>
99
+ </term>
100
+ </terms>
101
+ </sections>
102
+ </iso-standard>
103
+ INPUT
104
+
11
105
  it "registers against metanorma" do
12
106
  expect(processor).not_to be nil
13
107
  end
@@ -35,27 +129,18 @@ RSpec.describe Metanorma::Iso::Processor do
35
129
  .to be_equivalent_to xmlpp(output)
36
130
  end
37
131
 
38
- it "generates HTML from IsoDoc XML" do
132
+ it "generates HTML from Metanorma XML" do
39
133
  FileUtils.rm_f "test.xml"
40
- processor.output(<<~"INPUT", "test.xml", "test.html", :html)
41
- <iso-standard xmlns="http://riboseinc.com/isoxml">
42
- <sections>
43
- <terms id="H" obligation="normative"><title>1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</title>
44
- <term id="J">
45
- <name>1.1</name>
46
- <preferred>Term2</preferred>
47
- </term>
48
- </terms>
49
- </sections>
50
- </iso-standard>
51
- INPUT
134
+ FileUtils.rm_f "test.html"
135
+ processor.output(inputxml, "test.xml", "test.html", :html)
52
136
  expect(xmlpp(File.read("test.html", encoding: "utf-8")
53
137
  .gsub(%r{^.*<main}m, "<main")
54
138
  .gsub(%r{</main>.*}m, "</main>")))
55
139
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
56
140
  <main class="main-section">
57
141
  <button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
58
- <p class="zzSTDTitle1"></p>
142
+ <div class='authority'> </div>
143
+ <p class='zzSTDTitle1'>French</p>
59
144
  <div id="H"><h1 id="toc0">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
60
145
  <h2 class="TermNum" id="J">1.1</h2>
61
146
  <p class="Terms" style="text-align:left;">Term2</p>
@@ -63,4 +148,15 @@ RSpec.describe Metanorma::Iso::Processor do
63
148
  </main>
64
149
  OUTPUT
65
150
  end
151
+
152
+ it "generates STS from Metanorma XML" do
153
+ FileUtils.rm_f "test.xml"
154
+ FileUtils.rm_f "test.sts.xml"
155
+ FileUtils.rm_f "test.iso.sts.xml"
156
+ File.open("test.xml", "w") { |f| f.write inputxml }
157
+ processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
158
+ processor.output(inputxml, "test.xml", "test.iso.sts.xml", :isosts)
159
+ expect(File.exist?("test.sts.xml")).to be true
160
+ expect(File.exist?("test.iso.sts.xml")).to be true
161
+ end
66
162
  end