metanorma-iso 1.3.20 → 1.3.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +10 -10
- data/.github/workflows/ubuntu.yml +11 -11
- data/.github/workflows/windows.yml +11 -12
- data/Gemfile +2 -0
- data/README.adoc +3 -2
- data/lib/asciidoctor/iso/base.rb +17 -1
- data/lib/asciidoctor/iso/biblio.rng +131 -46
- data/lib/asciidoctor/iso/cleanup.rb +19 -2
- data/lib/asciidoctor/iso/front.rb +116 -17
- data/lib/asciidoctor/iso/isodoc.rng +32 -4
- data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
- data/lib/asciidoctor/iso/isostandard.rng +10 -0
- data/lib/asciidoctor/iso/macros.rb +21 -0
- data/lib/asciidoctor/iso/section.rb +18 -32
- data/lib/asciidoctor/iso/term_lookup_cleanup.rb +90 -0
- data/lib/asciidoctor/iso/validate.rb +41 -21
- data/lib/asciidoctor/iso/validate_section.rb +2 -2
- data/lib/asciidoctor/iso/validate_style.rb +1 -1
- data/lib/isodoc/iso/base_convert.rb +57 -41
- data/lib/isodoc/iso/html/header.html +5 -5
- data/lib/isodoc/iso/html/html_iso_titlepage.html +18 -18
- data/lib/isodoc/iso/html/isodoc.scss +28 -28
- data/lib/isodoc/iso/html/scripts.html +23 -21
- data/lib/isodoc/iso/html/style-human.scss +259 -423
- data/lib/isodoc/iso/html/style-iso.scss +151 -382
- data/lib/isodoc/iso/html/word_iso_titlepage.html +23 -2
- data/lib/isodoc/iso/html/wordstyle.scss +66 -39
- data/lib/isodoc/iso/html_convert.rb +7 -9
- data/lib/isodoc/iso/iso.international-standard.xsl +4386 -0
- data/lib/isodoc/iso/metadata.rb +48 -22
- data/lib/isodoc/iso/pdf_convert.rb +32 -0
- data/lib/metanorma-iso.rb +1 -0
- data/lib/metanorma/iso/processor.rb +13 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/spec/asciidoctor-iso/amd_spec.rb +318 -0
- data/spec/asciidoctor-iso/base_spec.rb +37 -17
- data/spec/asciidoctor-iso/blocks_spec.rb +21 -9
- data/spec/asciidoctor-iso/cleanup_spec.rb +203 -175
- data/spec/asciidoctor-iso/inline_spec.rb +2 -1
- data/spec/asciidoctor-iso/macros_spec.rb +273 -0
- data/spec/asciidoctor-iso/refs_spec.rb +7 -4
- data/spec/asciidoctor-iso/section_spec.rb +8 -8
- data/spec/asciidoctor-iso/validate_spec.rb +1 -1
- data/spec/assets/iso.xml +64 -1
- data/spec/isodoc/blocks_spec.rb +115 -0
- data/spec/isodoc/i18n_spec.rb +12 -20
- data/spec/isodoc/inline_spec.rb +2 -2
- data/spec/isodoc/iso_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +13 -4
- data/spec/isodoc/postproc_spec.rb +13 -112
- data/spec/isodoc/ref_spec.rb +4 -4
- data/spec/isodoc/section_spec.rb +8 -12
- data/spec/isodoc/table_spec.rb +24 -24
- data/spec/isodoc/terms_spec.rb +2 -2
- data/spec/isodoc/xref_spec.rb +19 -19
- data/spec/metanorma/processor_spec.rb +2 -2
- data/spec/spec_helper.rb +13 -1
- metadata +9 -3
- data/asciidoctor-iso.gemspec.old +0 -50
@@ -0,0 +1,115 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc do
|
4
|
+
it "processes formulae" do
|
5
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<preface><foreword>
|
8
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
|
9
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
10
|
+
<dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
|
11
|
+
<dt>
|
12
|
+
<stem type="AsciiMath">r</stem>
|
13
|
+
</dt>
|
14
|
+
<dd>
|
15
|
+
<p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
|
16
|
+
</dd>
|
17
|
+
</dl>
|
18
|
+
<note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
|
19
|
+
<p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
|
20
|
+
</note>
|
21
|
+
</formula>
|
22
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
|
23
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
24
|
+
</formula>
|
25
|
+
</foreword></preface>
|
26
|
+
</iso-standard>
|
27
|
+
INPUT
|
28
|
+
#{HTML_HDR}
|
29
|
+
<br/>
|
30
|
+
<div>
|
31
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
32
|
+
<div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div><p style='page-break-after:avoid;'>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d" class='formula_dl'><dt>
|
33
|
+
<span class="stem">(#(r)#)</span>
|
34
|
+
</dt><dd>
|
35
|
+
<p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
|
36
|
+
</dd></dl>
|
37
|
+
|
38
|
+
|
39
|
+
<div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p><span class="note_label">NOTE</span>  [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div>
|
40
|
+
|
41
|
+
<div id="_be9158af-7e93-4ee2-90c5-26d31c181935" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>  (1)</p></div>
|
42
|
+
</div>
|
43
|
+
<p class="zzSTDTitle1"/>
|
44
|
+
</div>
|
45
|
+
</body>
|
46
|
+
</html>
|
47
|
+
OUTPUT
|
48
|
+
end
|
49
|
+
|
50
|
+
it "processes formulae (Word)" do
|
51
|
+
expect((IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div>\s*<h1 class="ForewordTitle">}m, '<div><h1 class="ForewordTitle">').sub(%r{<p>\ </p>\s*</div>.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
52
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
53
|
+
<preface><foreword>
|
54
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
|
55
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
56
|
+
<dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
|
57
|
+
<dt>
|
58
|
+
<stem type="AsciiMath">r</stem>
|
59
|
+
</dt>
|
60
|
+
<dd>
|
61
|
+
<p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
|
62
|
+
</dd>
|
63
|
+
</dl>
|
64
|
+
<note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
|
65
|
+
<p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
|
66
|
+
</note>
|
67
|
+
</formula>
|
68
|
+
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
|
69
|
+
<stem type="AsciiMath">r = 1 %</stem>
|
70
|
+
</formula>
|
71
|
+
</foreword></preface>
|
72
|
+
</iso-standard>
|
73
|
+
INPUT
|
74
|
+
<div>
|
75
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
76
|
+
<div id='_be9158af-7e93-4ee2-90c5-26d31c181934' class='formula'>
|
77
|
+
<p>
|
78
|
+
<span class='stem'>(#(r = 1 %)#)</span>
|
79
|
+
</p>
|
80
|
+
</div>
|
81
|
+
<p>where</p>
|
82
|
+
<table class='formula_dl'>
|
83
|
+
<tr>
|
84
|
+
<td valign='top' align='left'>
|
85
|
+
<p align='left' style='margin-left:0pt;text-align:left;'>
|
86
|
+
<span class='stem'>(#(r)#)</span>
|
87
|
+
</p>
|
88
|
+
</td>
|
89
|
+
<td valign='top'>
|
90
|
+
<p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
|
91
|
+
</td>
|
92
|
+
</tr>
|
93
|
+
</table>
|
94
|
+
<div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
|
95
|
+
<p class='Note'>
|
96
|
+
<span class='note_label'>NOTE</span>
|
97
|
+
<span style='mso-tab-count:1'>  </span>
|
98
|
+
[durationUnits] is essentially a duration statement without the "P"
|
99
|
+
prefix. "P" is unnecessary because between "G" and "U" duration is
|
100
|
+
always expressed.
|
101
|
+
</p>
|
102
|
+
</div>
|
103
|
+
<div id='_be9158af-7e93-4ee2-90c5-26d31c181935' class='formula'>
|
104
|
+
<p>
|
105
|
+
<span class='stem'>(#(r = 1 %)#)</span>
|
106
|
+
<span style='mso-tab-count:1'>  </span>
|
107
|
+
(1)
|
108
|
+
</p>
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
OUTPUT
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
end
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -15,16 +15,14 @@ RSpec.describe IsoDoc do
|
|
15
15
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
16
16
|
<title>Introduction Subsection</title>
|
17
17
|
</clause>
|
18
|
-
<patent-notice>
|
19
18
|
<p>This is patent boilerplate</p>
|
20
|
-
</patent-notice>
|
21
19
|
</introduction></preface><sections>
|
22
20
|
<clause id="D" obligation="normative">
|
23
21
|
<title>Scope</title>
|
24
22
|
<p id="E">Text</p>
|
25
23
|
</clause>
|
26
24
|
|
27
|
-
<clause id="H" obligation="normative"><title>Terms,
|
25
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
28
26
|
<title>Normal Terms</title>
|
29
27
|
<term id="J">
|
30
28
|
<preferred>Term2</preferred>
|
@@ -61,11 +59,11 @@ RSpec.describe IsoDoc do
|
|
61
59
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
62
60
|
<title>An Appendix</title>
|
63
61
|
</appendix>
|
64
|
-
</annex><bibliography><references id="R" obligation="informative">
|
62
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
65
63
|
<title>Normative References</title>
|
66
64
|
</references><clause id="S" obligation="informative">
|
67
65
|
<title>Bibliography</title>
|
68
|
-
<references id="T" obligation="informative">
|
66
|
+
<references id="T" obligation="informative" normative="false">
|
69
67
|
<title>Bibliography Subsection</title>
|
70
68
|
</references>
|
71
69
|
</clause>
|
@@ -161,16 +159,14 @@ RSpec.describe IsoDoc do
|
|
161
159
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
162
160
|
<title>Introduction Subsection</title>
|
163
161
|
</clause>
|
164
|
-
<patent-notice>
|
165
162
|
<p>This is patent boilerplate</p>
|
166
|
-
</patent-notice>
|
167
163
|
</introduction></preface><sections>
|
168
164
|
<clause id="D" obligation="normative">
|
169
165
|
<title>Scope</title>
|
170
166
|
<p id="E">Text</p>
|
171
167
|
</clause>
|
172
168
|
|
173
|
-
<clause id="H" obligation="normative"><title>Terms,
|
169
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
174
170
|
<title>Normal Terms</title>
|
175
171
|
<term id="J">
|
176
172
|
<preferred>Term2</preferred>
|
@@ -207,11 +203,11 @@ RSpec.describe IsoDoc do
|
|
207
203
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
208
204
|
<title>An Appendix</title>
|
209
205
|
</appendix>
|
210
|
-
</annex><bibliography><references id="R" obligation="informative">
|
206
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
211
207
|
<title>Normative References</title>
|
212
208
|
</references><clause id="S" obligation="informative">
|
213
209
|
<title>Bibliography</title>
|
214
|
-
<references id="T" obligation="informative">
|
210
|
+
<references id="T" obligation="informative" normative="false">
|
215
211
|
<title>Bibliography Subsection</title>
|
216
212
|
</references>
|
217
213
|
</clause>
|
@@ -307,16 +303,14 @@ RSpec.describe IsoDoc do
|
|
307
303
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
308
304
|
<title>Introduction Subsection</title>
|
309
305
|
</clause>
|
310
|
-
<patent-notice>
|
311
306
|
<p>This is patent boilerplate</p>
|
312
|
-
</patent-notice>
|
313
307
|
</introduction></preface><sections>
|
314
308
|
<clause id="D" obligation="normative">
|
315
309
|
<title>Scope</title>
|
316
310
|
<p id="E">Text</p>
|
317
311
|
</clause>
|
318
312
|
|
319
|
-
<clause id="H" obligation="normative"><title>Terms,
|
313
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
320
314
|
<title>Normal Terms</title>
|
321
315
|
<term id="J">
|
322
316
|
<preferred>Term2</preferred>
|
@@ -353,11 +347,11 @@ RSpec.describe IsoDoc do
|
|
353
347
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
354
348
|
<title>An Appendix</title>
|
355
349
|
</appendix>
|
356
|
-
</annex><bibliography><references id="R" obligation="informative">
|
350
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
357
351
|
<title>Normative References</title>
|
358
352
|
</references><clause id="S" obligation="informative">
|
359
353
|
<title>Bibliography</title>
|
360
|
-
<references id="T" obligation="informative">
|
354
|
+
<references id="T" obligation="informative" normative="false">
|
361
355
|
<title>Bibliography Subsection</title>
|
362
356
|
</references>
|
363
357
|
</clause>
|
@@ -454,16 +448,14 @@ RSpec.describe IsoDoc do
|
|
454
448
|
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
455
449
|
<title>Introduction Subsection</title>
|
456
450
|
</clause>
|
457
|
-
<patent-notice>
|
458
451
|
<p>This is patent boilerplate</p>
|
459
|
-
</patent-notice>
|
460
452
|
</introduction></preface><sections>
|
461
453
|
<clause id="D" obligation="normative">
|
462
454
|
<title>Scope</title>
|
463
455
|
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
464
456
|
</clause>
|
465
457
|
|
466
|
-
<clause id="H" obligation="normative"><title>Terms,
|
458
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
467
459
|
<title>Normal Terms</title>
|
468
460
|
<term id="J">
|
469
461
|
<preferred>Term2</preferred>
|
@@ -500,7 +492,7 @@ RSpec.describe IsoDoc do
|
|
500
492
|
<appendix id="Q2" inline-header="false" obligation="normative">
|
501
493
|
<title>An Appendix</title>
|
502
494
|
</appendix>
|
503
|
-
</annex><bibliography><references id="R" obligation="informative">
|
495
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
504
496
|
<title>Normative References</title>
|
505
497
|
<bibitem id="ISO712" type="standard">
|
506
498
|
<title format="text/plain">Cereals and cereal products</title>
|
@@ -514,7 +506,7 @@ RSpec.describe IsoDoc do
|
|
514
506
|
</bibitem>
|
515
507
|
</references><clause id="S" obligation="informative">
|
516
508
|
<title>Bibliography</title>
|
517
|
-
<references id="T" obligation="informative">
|
509
|
+
<references id="T" obligation="informative" normative="false">
|
518
510
|
<title>Bibliography Subsection</title>
|
519
511
|
</references>
|
520
512
|
</clause>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -158,7 +158,7 @@ RSpec.describe IsoDoc do
|
|
158
158
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
159
159
|
</p>
|
160
160
|
</foreword></preface>
|
161
|
-
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
161
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
162
162
|
<bibitem id="ISO712" type="standard">
|
163
163
|
<title format="text/plain">Cereals and cereal products</title>
|
164
164
|
<docidentifier>ISO 712</docidentifier>
|
@@ -213,7 +213,7 @@ RSpec.describe IsoDoc do
|
|
213
213
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
214
214
|
</p>
|
215
215
|
</foreword></preface>
|
216
|
-
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
216
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
217
217
|
<bibitem id="ISO712" type="standard">
|
218
218
|
<title format="text/plain">Cereals and cereal products</title>
|
219
219
|
<docidentifier>ISO 712</docidentifier>
|
data/spec/isodoc/iso_spec.rb
CHANGED
@@ -96,7 +96,7 @@ RSpec.describe IsoDoc::Iso do
|
|
96
96
|
<eref bibitemid="ISO20483"/>
|
97
97
|
</p>
|
98
98
|
</foreword></preface>
|
99
|
-
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
99
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
100
100
|
<bibitem type="international-standard" id="IEV">
|
101
101
|
<title format="text/plain" language="en" script="Latn">Electropedia:
|
102
102
|
The World's Online Electrotechnical Vocabulary</title>
|
@@ -17,6 +17,8 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
17
17
|
<title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
|
18
18
|
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
19
19
|
<docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
|
20
|
+
<docidentifier type="iso-with-lang">ISO/PreCD3 17301-1 (E)</docidentifier>
|
21
|
+
<docidentifier type="iso-reference">ISO/PreCD3 17301-1:2000 (E)</docidentifier>
|
20
22
|
<docidentifier type="iso-tc">17301</docidentifier>
|
21
23
|
<docidentifier type="iso-tc">17302</docidentifier>
|
22
24
|
<docnumber>1730</docnumber>
|
@@ -39,13 +41,14 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
39
41
|
<contributor>
|
40
42
|
<role type="publisher"/>
|
41
43
|
<organization>
|
44
|
+
<name>International Organization for Standardization</name>
|
42
45
|
<abbreviation>ISO</abbreviation>
|
43
46
|
</organization>
|
44
47
|
</contributor>
|
45
48
|
<language>en</language>
|
46
49
|
<script>Latn</script>
|
47
50
|
<status>
|
48
|
-
<stage>30</stage>
|
51
|
+
<stage abbreviation="CD">30</stage>
|
49
52
|
<substage>92</substage>
|
50
53
|
<iteration>3</iteration>
|
51
54
|
</status>
|
@@ -68,11 +71,12 @@ RSpec.describe IsoDoc::Iso::Metadata do
|
|
68
71
|
<structuredidentifier>
|
69
72
|
<project-number part="1">ISO/PreCD3 17301</project-number>
|
70
73
|
</structuredidentifier>
|
74
|
+
<stagename>Committee draft</stagename>
|
71
75
|
</ext>
|
72
76
|
</bibdata>
|
73
77
|
</iso-standard>
|
74
78
|
INPUT
|
75
|
-
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010–2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumeric=>"1730", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :revdate=>"2016-05-01", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
|
79
|
+
{:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010–2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>"ISO/PreCD3 17301-1 (E)", :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)", :docnumeric=>"1730", :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
|
76
80
|
OUTPUT
|
77
81
|
end
|
78
82
|
|
@@ -95,6 +99,8 @@ OUTPUT
|
|
95
99
|
<title type="title-part" language="fr" format="text/plain">Riz</title>
|
96
100
|
</title>
|
97
101
|
<docidentifier type="iso">ISO/IEC/CD 17301-1-3</docidentifier>
|
102
|
+
<docidentifier type="iso-with-lang">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
|
103
|
+
<docidentifier type="iso-reference">ISO/IEC/CD 17301-1-3 (E)</docidentifier>
|
98
104
|
<docidentifier type="iso-tc">17301</docidentifier>
|
99
105
|
<contributor>
|
100
106
|
<role type="author"/>
|
@@ -105,19 +111,21 @@ OUTPUT
|
|
105
111
|
<contributor>
|
106
112
|
<role type="publisher"/>
|
107
113
|
<organization>
|
114
|
+
<name>International Organization for Standardization</name>
|
108
115
|
<abbreviation>ISO</abbreviation>
|
109
116
|
</organization>
|
110
117
|
</contributor>
|
111
118
|
<contributor>
|
112
119
|
<role type="publisher"/>
|
113
120
|
<organization>
|
121
|
+
<name>International Electrotechnical Commission</name>
|
114
122
|
<abbreviation>IEC</abbreviation>
|
115
123
|
</organization>
|
116
124
|
</contributor>
|
117
125
|
<language>en</language>
|
118
126
|
<script>Latn</script>
|
119
127
|
<status>
|
120
|
-
<stage>60</stage>
|
128
|
+
<stage abbreviation="IS">60</stage>
|
121
129
|
<substage>92</substage>
|
122
130
|
</status>
|
123
131
|
<copyright>
|
@@ -144,11 +152,12 @@ OUTPUT
|
|
144
152
|
<structuredidentifier>
|
145
153
|
<project-number part="1" subpart="3">ISO/IEC/CD 17301</project-number>
|
146
154
|
</strucuredidentifier>
|
155
|
+
<stagename>International standard</stagename>
|
147
156
|
</ext>
|
148
157
|
</bibdata>
|
149
158
|
</iso-standard>
|
150
159
|
INPUT
|
151
|
-
{:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumeric=>nil, :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1–3", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1–3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :revdate=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
|
160
|
+
{:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)", :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)", :docnumeric=>nil, :docsubtitle=>"Céréales et légumineuses — Spécification et méthodes d'essai — Partie 1–3: Riz", :docsubtitleintro=>"Céréales et légumineuses", :docsubtitlemain=>"Spécification et méthodes d'essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie 1–3", :doctitle=>"Cereals and pulses — Specifications and test methods — Part 1–3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part 1–3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
|
152
161
|
OUTPUT
|
153
162
|
end
|
154
163
|
|
@@ -91,6 +91,12 @@ RSpec.describe IsoDoc do
|
|
91
91
|
expect(word).to match(/<style>/)
|
92
92
|
end
|
93
93
|
|
94
|
+
it "generates Pdf output docs with null configuration from file" do
|
95
|
+
FileUtils.rm_f "spec/assets/iso.pdf"
|
96
|
+
IsoDoc::Iso::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
|
97
|
+
expect(File.exist?("spec/assets/iso.pdf")).to be true
|
98
|
+
end
|
99
|
+
|
94
100
|
it "converts annex subheadings to h2Annex class for Word" do
|
95
101
|
FileUtils.rm_f "test.doc"
|
96
102
|
FileUtils.rm_f "test.html"
|
@@ -153,7 +159,7 @@ RSpec.describe IsoDoc do
|
|
153
159
|
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
154
160
|
<div class="WordSection3">
|
155
161
|
<p class="zzSTDTitle1"></p>
|
156
|
-
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1<span style="mso-tab-count:1">  </span>Terms and
|
162
|
+
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1<span style="mso-tab-count:1">  </span>Terms and Definitions</h1>
|
157
163
|
<p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
|
158
164
|
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
159
165
|
<p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, 3.1</a>, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
|
@@ -285,16 +291,16 @@ RSpec.describe IsoDoc do
|
|
285
291
|
<main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
286
292
|
<p class="zzSTDTitle1"></p>
|
287
293
|
<div id="A">
|
288
|
-
<h1>1  Clause 4</h1>
|
294
|
+
<h1 id="toc0">1  Clause 4</h1>
|
289
295
|
<a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
|
290
296
|
<sup>1)</sup>
|
291
297
|
</a>
|
292
298
|
<div id="N">
|
293
299
|
|
294
|
-
<h2>1.1  Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2)</sup></a></h2>
|
300
|
+
<h2 id="toc1">1.1  Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2)</sup></a></h2>
|
295
301
|
</div>
|
296
302
|
<div id="O">
|
297
|
-
<h2>1.2  Clause 4.2</h2>
|
303
|
+
<h2 id="toc2">1.2  Clause 4.2</h2>
|
298
304
|
<p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a></p>
|
299
305
|
</div>
|
300
306
|
</div>
|
@@ -459,7 +465,7 @@ RSpec.describe IsoDoc do
|
|
459
465
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
460
466
|
<br />
|
461
467
|
<div>
|
462
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
468
|
+
<h1 class="ForewordTitle" id="toc0">Foreword</h1>
|
463
469
|
<div id="_" class="figure">
|
464
470
|
<img src="test_htmlimages/_.png" height="776" width="922" />
|
465
471
|
<img src="test_htmlimages/_.png" height="800" width="53" />
|
@@ -672,8 +678,8 @@ documentation.
|
|
672
678
|
</iso-standard>
|
673
679
|
INPUT
|
674
680
|
word = File.read("test.html", encoding: "UTF-8")
|
675
|
-
expect(
|
676
|
-
expect(
|
681
|
+
expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
|
682
|
+
expect((word)).to include "I am the Walrus."
|
677
683
|
end
|
678
684
|
|
679
685
|
it "processes boilerplate (Word)" do
|
@@ -734,109 +740,4 @@ end
|
|
734
740
|
expect(word).to include '<p class="zzWarning">I am the Walrus</p>'
|
735
741
|
end
|
736
742
|
|
737
|
-
it "skips internal hyperlinks" do
|
738
|
-
FileUtils.rm_f "test.html"
|
739
|
-
FileUtils.rm_f "test.doc"
|
740
|
-
IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
741
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
742
|
-
<preface>
|
743
|
-
<foreword>
|
744
|
-
<p>
|
745
|
-
<xref target="scope"/>
|
746
|
-
<xref target="terms"/>
|
747
|
-
<xref target="_waxy_rice"/>
|
748
|
-
<xref target="N"/>
|
749
|
-
<xref target="N1"/>
|
750
|
-
<xref target="N2"/>
|
751
|
-
<xref target="N3"/>
|
752
|
-
<xref target="N4"/>
|
753
|
-
<xref target="N5"/>
|
754
|
-
<xref target="N6"/>
|
755
|
-
<xref target="N7"/>
|
756
|
-
<xref target="N8"/>
|
757
|
-
<xref target="N9"/>
|
758
|
-
<xref target="N10"/>
|
759
|
-
<eref bibitemid="ISO712"/>
|
760
|
-
</p>
|
761
|
-
</foreword>
|
762
|
-
</preface>
|
763
|
-
<sections>
|
764
|
-
<clause id="scope"><title>Scope</title>
|
765
|
-
<note id="N">
|
766
|
-
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
767
|
-
</note>
|
768
|
-
<figure id="N1">
|
769
|
-
<name>Split-it-right sample divider</name>
|
770
|
-
</figure>
|
771
|
-
<example id="N2">
|
772
|
-
<p>Hello</p>
|
773
|
-
</example>
|
774
|
-
<formula id="N3">
|
775
|
-
<stem type="AsciiMath">r = 1 %</stem>
|
776
|
-
</formula>
|
777
|
-
<table id="N4">
|
778
|
-
<name>Repeatability and reproducibility of husked rice yield</name>
|
779
|
-
<tbody>
|
780
|
-
<tr>
|
781
|
-
<td align="left">Number of laboratories retained after eliminating outliers</td>
|
782
|
-
<td align="center">13</td>
|
783
|
-
<td align="center">11</td>
|
784
|
-
</tr>
|
785
|
-
</tbody>
|
786
|
-
</table>
|
787
|
-
<ol id="N6">
|
788
|
-
<li id="N7"><p>A</p></li>
|
789
|
-
</ol>
|
790
|
-
<requirement id="N8">
|
791
|
-
<stem type="AsciiMath">r = 1 %</stem>
|
792
|
-
</requirement>
|
793
|
-
<recommendation id="N9">
|
794
|
-
<stem type="AsciiMath">r = 1 %</stem>
|
795
|
-
</requirement>
|
796
|
-
<permission id="N10">
|
797
|
-
<stem type="AsciiMath">r = 1 %</stem>
|
798
|
-
</requirement>
|
799
|
-
</clause>
|
800
|
-
<terms id="terms">
|
801
|
-
<term id="_waxy_rice"><preferred>waxy rice</preferred>
|
802
|
-
<termnote id="N5">
|
803
|
-
<p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
|
804
|
-
</termnote></term>
|
805
|
-
</terms>
|
806
|
-
</sections>
|
807
|
-
<bibliography><references id="_normative_references" obligation="informative"><title>Normative References</title>
|
808
|
-
<p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
|
809
|
-
<bibitem id="ISO712" type="standard">
|
810
|
-
<title format="text/plain">Cereals or cereal products</title>
|
811
|
-
<title type="main" format="text/plain">Cereals and cereal products</title>
|
812
|
-
<docidentifier type="ISO">ISO 712</docidentifier>
|
813
|
-
<contributor>
|
814
|
-
<role type="publisher"/>
|
815
|
-
<organization>
|
816
|
-
<name>International Organization for Standardization</name>
|
817
|
-
</organization>
|
818
|
-
</contributor>
|
819
|
-
</bibitem>
|
820
|
-
</references>
|
821
|
-
</bibliography>
|
822
|
-
</iso-standard>
|
823
|
-
INPUT
|
824
|
-
expect(File.exist?("test.html")).to be true
|
825
|
-
html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
826
|
-
sub(%r{</main>.*$}m, "</main>").sub(%r{^.*?<div>}m, "<div>").sub(%r{</div>.*$}m, "</div>")
|
827
|
-
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
828
|
-
<div>
|
829
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
830
|
-
<p>
|
831
|
-
<a href='#scope'>Clause 1</a>
|
832
|
-
<a href='#terms'>Clause 3</a>
|
833
|
-
<a href='#_waxy_rice'>3.1</a>
|
834
|
-
Clause 1, Note Figure 1 Clause 1, Example Clause 1, Formula (1) Table 1
|
835
|
-
3.1, Note 1 Clause 1, List Clause 1 a) Clause 1, Requirement 1 Clause 1,
|
836
|
-
Recommendation 1 Clause 1, Permission 1
|
837
|
-
<a href='#ISO712'>ISO 712</a>
|
838
|
-
</p>
|
839
|
-
</div>
|
840
|
-
OUTPUT
|
841
|
-
end
|
842
743
|
end
|