metanorma-iso 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +4 -4
- data/lib/asciidoctor/iso/basicdoc.rng +6 -8
- data/lib/asciidoctor/iso/validate.rb +14 -93
- data/lib/asciidoctor/iso/validate_title.rb +99 -0
- data/lib/isodoc/iso/html/isodoc.scss +21 -0
- data/lib/isodoc/iso/html/style-human.scss +2 -2
- data/lib/isodoc/iso/html/style-iso.scss +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +0 -1
- data/spec/asciidoctor-iso/base_spec.rb +11 -11
- data/spec/asciidoctor-iso/blocks_spec.rb +22 -22
- data/spec/asciidoctor-iso/cleanup_spec.rb +27 -26
- data/spec/asciidoctor-iso/inline_spec.rb +7 -7
- data/spec/asciidoctor-iso/lists_spec.rb +3 -3
- data/spec/asciidoctor-iso/macros_spec.rb +1 -1
- data/spec/asciidoctor-iso/refs_spec.rb +4 -4
- data/spec/asciidoctor-iso/section_spec.rb +58 -48
- data/spec/asciidoctor-iso/table_spec.rb +4 -4
- data/spec/asciidoctor-iso/validate_spec.rb +12 -0
- data/spec/isodoc/i18n_spec.rb +4 -4
- data/spec/isodoc/inline_spec.rb +8 -8
- data/spec/isodoc/iso_spec.rb +5 -7
- data/spec/isodoc/postproc_spec.rb +16 -23
- data/spec/isodoc/section_spec.rb +6 -9
- data/spec/isodoc/terms_spec.rb +2 -7
- data/spec/isodoc/xref_spec.rb +11 -11
- data/spec/metanorma/processor_spec.rb +2 -2
- data/spec/spec_helper.rb +9 -0
- metadata +3 -16
@@ -108,8 +108,8 @@ RSpec.describe IsoDoc do
|
|
108
108
|
</iso-standard>
|
109
109
|
INPUT
|
110
110
|
word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
111
|
-
sub(%r{<div
|
112
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
111
|
+
sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
112
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
113
113
|
<div class="WordSection3">
|
114
114
|
<p class="zzSTDTitle1"></p>
|
115
115
|
<p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
@@ -123,8 +123,6 @@ RSpec.describe IsoDoc do
|
|
123
123
|
</div>
|
124
124
|
</div>
|
125
125
|
</div>
|
126
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
127
|
-
<div class="colophon"></div>
|
128
126
|
OUTPUT
|
129
127
|
end
|
130
128
|
|
@@ -151,8 +149,8 @@ RSpec.describe IsoDoc do
|
|
151
149
|
|
152
150
|
INPUT
|
153
151
|
word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
154
|
-
sub(%r{<div
|
155
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
152
|
+
sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
153
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
156
154
|
<div class="WordSection3">
|
157
155
|
<p class="zzSTDTitle1"></p>
|
158
156
|
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1<span style="mso-tab-count:1">  </span>Terms and definitions</h1>
|
@@ -160,8 +158,6 @@ RSpec.describe IsoDoc do
|
|
160
158
|
<p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
|
161
159
|
<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>
|
162
160
|
</div>
|
163
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
164
|
-
<div class="colophon"></div>
|
165
161
|
OUTPUT
|
166
162
|
end
|
167
163
|
|
@@ -205,8 +201,10 @@ RSpec.describe IsoDoc do
|
|
205
201
|
|
206
202
|
INPUT
|
207
203
|
word = File.read("test.doc", encoding: "UTF-8").sub(/^.*An empty word intro page\./m, '').
|
208
|
-
sub(%r{
|
209
|
-
|
204
|
+
sub(%r{</div>.*$}m, "</div>")
|
205
|
+
|
206
|
+
expect(("<div>" + word.gsub(/_Toc\d\d+/, "_Toc") )).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
207
|
+
<div>
|
210
208
|
<p class="MsoToc1"><span lang="EN-GB" xml:lang="EN-GB"><span style="mso-element:field-begin"></span><span style="mso-spacerun:yes"> </span>TOC
|
211
209
|
\o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
|
212
210
|
<span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
|
@@ -281,10 +279,10 @@ RSpec.describe IsoDoc do
|
|
281
279
|
</sections>
|
282
280
|
</iso-standard>
|
283
281
|
INPUT
|
284
|
-
html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
282
|
+
html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">').
|
285
283
|
sub(%r{</main>.*$}m, "</main>")
|
286
|
-
expect(html).to be_equivalent_to <<~"OUTPUT"
|
287
|
-
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
284
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
285
|
+
<main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
288
286
|
<p class="zzSTDTitle1"></p>
|
289
287
|
<div>
|
290
288
|
<h1>1  Clause 4</h1>
|
@@ -332,7 +330,7 @@ RSpec.describe IsoDoc do
|
|
332
330
|
html = File.read("test.html", encoding: "UTF-8").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
333
331
|
sub(%r{</main>.*$}m, "</main>")
|
334
332
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
335
|
-
expect(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")).to be_equivalent_to <<~"OUTPUT"
|
333
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
336
334
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
337
335
|
<br />
|
338
336
|
<div>
|
@@ -424,8 +422,8 @@ RSpec.describe IsoDoc do
|
|
424
422
|
</iso-standard>
|
425
423
|
INPUT
|
426
424
|
word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
427
|
-
sub(%r{<div
|
428
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
425
|
+
sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
426
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
429
427
|
<div class="WordSection3">
|
430
428
|
<p class="zzSTDTitle1"></p>
|
431
429
|
<p class="MsoNormal">
|
@@ -440,9 +438,6 @@ RSpec.describe IsoDoc do
|
|
440
438
|
</div>
|
441
439
|
</div>
|
442
440
|
</div>
|
443
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
444
|
-
<div class="colophon"></div>
|
445
|
-
|
446
441
|
OUTPUT
|
447
442
|
end
|
448
443
|
|
@@ -464,8 +459,8 @@ RSpec.describe IsoDoc do
|
|
464
459
|
</iso-standard>
|
465
460
|
INPUT
|
466
461
|
word = File.read("test.doc", encoding: "UTF-8").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
467
|
-
sub(%r{<div
|
468
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
462
|
+
sub(%r{<br[^>]*>\s*<div class="colophon".*$}m, "")
|
463
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
469
464
|
<div class="WordSection3">
|
470
465
|
<p class="zzSTDTitle1"></p>
|
471
466
|
<p class="MsoNormal">
|
@@ -479,8 +474,6 @@ RSpec.describe IsoDoc do
|
|
479
474
|
<p class="FigureTitle" style="text-align:center;">Figure A.1</p></div>
|
480
475
|
</div>
|
481
476
|
</div>
|
482
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
483
|
-
<div class="colophon"></div>
|
484
477
|
|
485
478
|
OUTPUT
|
486
479
|
end
|
data/spec/isodoc/section_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes section names" do
|
5
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
5
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword obligation="informative">
|
@@ -150,7 +150,7 @@ OUTPUT
|
|
150
150
|
end
|
151
151
|
|
152
152
|
it "processes section names (Word)" do
|
153
|
-
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ")).to be_equivalent_to <<~"OUTPUT"
|
153
|
+
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
154
154
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
155
155
|
<preface>
|
156
156
|
<foreword obligation="informative">
|
@@ -301,12 +301,11 @@ OUTPUT
|
|
301
301
|
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
302
302
|
<div class="colophon"/>
|
303
303
|
</body>
|
304
|
-
</html>
|
305
304
|
OUTPUT
|
306
305
|
end
|
307
306
|
|
308
307
|
it "processes simple terms & definitions" do
|
309
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
308
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
310
309
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
311
310
|
<sections>
|
312
311
|
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
|
@@ -330,7 +329,7 @@ OUTPUT
|
|
330
329
|
end
|
331
330
|
|
332
331
|
it "processes inline section headers" do
|
333
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
332
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
334
333
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
335
334
|
<sections>
|
336
335
|
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
@@ -361,7 +360,7 @@ OUTPUT
|
|
361
360
|
end
|
362
361
|
|
363
362
|
it "adds colophon to published standard (Word)" do
|
364
|
-
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ")).to be_equivalent_to <<~"OUTPUT"
|
363
|
+
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
365
364
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
366
365
|
<bibdata>
|
367
366
|
<status>
|
@@ -387,12 +386,11 @@ OUTPUT
|
|
387
386
|
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
388
387
|
<div class="colophon"/>
|
389
388
|
</body>
|
390
|
-
</html>
|
391
389
|
OUTPUT
|
392
390
|
end
|
393
391
|
|
394
392
|
it "does not add colophon to draft standard (Word)" do
|
395
|
-
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ")).to be_equivalent_to <<~"OUTPUT"
|
393
|
+
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<body /m, "<body ").sub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
396
394
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
397
395
|
<bibdata>
|
398
396
|
<status>
|
@@ -416,7 +414,6 @@ OUTPUT
|
|
416
414
|
<p class="zzSTDTitle1"/>
|
417
415
|
</div>
|
418
416
|
</body>
|
419
|
-
</html>
|
420
417
|
OUTPUT
|
421
418
|
end
|
422
419
|
|
data/spec/isodoc/terms_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes IsoXML terms" do
|
5
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
5
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
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>
|
@@ -91,7 +91,7 @@ OUTPUT
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it "processes IsoXML terms (Word)" do
|
94
|
-
expect(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<p class="zzSTDTitle1"/>}m, "")).to be_equivalent_to <<~"OUTPUT"
|
94
|
+
expect(xmlpp(IsoDoc::Iso::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<p class="zzSTDTitle1"/>}m, "").sub(%r{</div>\s*<br.*$}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
95
95
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
96
96
|
<sections>
|
97
97
|
<terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
|
@@ -171,11 +171,6 @@ OUTPUT
|
|
171
171
|
<p>[TERMREF]
|
172
172
|
<a href="#ISO7301">ISO 7301:2011, 3.1</a>
|
173
173
|
[/TERMREF]</p></div>
|
174
|
-
</div>
|
175
|
-
<br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
|
176
|
-
<div class="colophon"/>
|
177
|
-
</body>
|
178
|
-
</html>
|
179
174
|
|
180
175
|
OUTPUT
|
181
176
|
end
|
data/spec/isodoc/xref_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "cross-references notes" do
|
5
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).
|
5
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface>
|
8
8
|
<foreword>
|
@@ -106,7 +106,7 @@ RSpec.describe IsoDoc do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "cross-references figures" do
|
109
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
109
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
110
110
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
111
111
|
<preface>
|
112
112
|
<foreword id="fwd">
|
@@ -229,7 +229,7 @@ RSpec.describe IsoDoc do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
it "cross-references subfigures" do
|
232
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
232
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
233
233
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
234
234
|
<preface>
|
235
235
|
<foreword id="fwd">
|
@@ -340,7 +340,7 @@ RSpec.describe IsoDoc do
|
|
340
340
|
end
|
341
341
|
|
342
342
|
it "cross-references examples" do
|
343
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
343
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
344
344
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
345
345
|
<preface>
|
346
346
|
<foreword>
|
@@ -442,7 +442,7 @@ RSpec.describe IsoDoc do
|
|
442
442
|
end
|
443
443
|
|
444
444
|
it "cross-references formulae" do
|
445
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
445
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
446
446
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
447
447
|
<preface>
|
448
448
|
<foreword>
|
@@ -555,7 +555,7 @@ RSpec.describe IsoDoc do
|
|
555
555
|
end
|
556
556
|
|
557
557
|
it "cross-references tables" do
|
558
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
558
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
559
559
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
560
560
|
<preface>
|
561
561
|
<foreword>
|
@@ -707,7 +707,7 @@ RSpec.describe IsoDoc do
|
|
707
707
|
end
|
708
708
|
|
709
709
|
it "cross-references term notes" do
|
710
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
710
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
711
711
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
712
712
|
<preface>
|
713
713
|
<foreword>
|
@@ -763,7 +763,7 @@ RSpec.describe IsoDoc do
|
|
763
763
|
end
|
764
764
|
|
765
765
|
it "cross-references sections" do
|
766
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
766
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
767
767
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
768
768
|
<preface>
|
769
769
|
<foreword obligation="informative">
|
@@ -938,7 +938,7 @@ RSpec.describe IsoDoc do
|
|
938
938
|
end
|
939
939
|
|
940
940
|
it "cross-references lists" do
|
941
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
941
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
942
942
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
943
943
|
<preface>
|
944
944
|
<foreword>
|
@@ -1044,7 +1044,7 @@ RSpec.describe IsoDoc do
|
|
1044
1044
|
end
|
1045
1045
|
|
1046
1046
|
it "cross-references list items" do
|
1047
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1047
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1048
1048
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1049
1049
|
<preface>
|
1050
1050
|
<foreword>
|
@@ -1149,7 +1149,7 @@ RSpec.describe IsoDoc do
|
|
1149
1149
|
end
|
1150
1150
|
|
1151
1151
|
it "cross-references nested list items" do
|
1152
|
-
expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
1152
|
+
expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1153
1153
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1154
1154
|
<preface>
|
1155
1155
|
<foreword>
|
@@ -24,7 +24,7 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
it "generates IsoDoc XML from a blank document" do
|
27
|
-
expect(processor.input_to_isodoc(<<~"INPUT", nil)).to be_equivalent_to <<~"OUTPUT"
|
27
|
+
expect(xmlpp(processor.input_to_isodoc(<<~"INPUT", nil))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
28
28
|
#{ASCIIDOC_BLANK_HDR}
|
29
29
|
INPUT
|
30
30
|
#{BLANK_HDR}
|
@@ -46,7 +46,7 @@ RSpec.describe Metanorma::Iso::Processor do
|
|
46
46
|
</sections>
|
47
47
|
</iso-standard>
|
48
48
|
INPUT
|
49
|
-
expect(File.read("test.html", encoding: "utf-8").gsub(%r{^.*<main}m, "<main").gsub(%r{</main>.*}m, "</main>")).to be_equivalent_to <<~"OUTPUT"
|
49
|
+
expect(xmlpp(File.read("test.html", encoding: "utf-8").gsub(%r{^.*<main}m, "<main").gsub(%r{</main>.*}m, "</main>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
50
50
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
51
51
|
<p class="zzSTDTitle1"></p>
|
52
52
|
<div id="H"><h1>1  Terms and definitions</h1>
|
data/spec/spec_helper.rb
CHANGED
@@ -11,6 +11,7 @@ require "equivalent-xml"
|
|
11
11
|
require "metanorma"
|
12
12
|
require "metanorma/iso"
|
13
13
|
require "iev"
|
14
|
+
require "rexml/document"
|
14
15
|
|
15
16
|
RSpec.configure do |config|
|
16
17
|
# Enable flags like --only-failures and --next-failure
|
@@ -28,6 +29,14 @@ def strip_guid(x)
|
|
28
29
|
x.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"')
|
29
30
|
end
|
30
31
|
|
32
|
+
def xmlpp(x)
|
33
|
+
s = ""
|
34
|
+
f = REXML::Formatters::Pretty.new(2)
|
35
|
+
f.compact = true
|
36
|
+
f.write(REXML::Document.new(x),s)
|
37
|
+
s
|
38
|
+
end
|
39
|
+
|
31
40
|
ASCIIDOC_BLANK_HDR = <<~"HDR"
|
32
41
|
= Document title
|
33
42
|
Author
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: asciidoctor
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 1.5.7
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 1.5.7
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: ruby-jing
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -286,6 +272,7 @@ files:
|
|
286
272
|
- lib/asciidoctor/iso/validate_requirements.rb
|
287
273
|
- lib/asciidoctor/iso/validate_section.rb
|
288
274
|
- lib/asciidoctor/iso/validate_style.rb
|
275
|
+
- lib/asciidoctor/iso/validate_title.rb
|
289
276
|
- lib/isodoc/iso/base_convert.rb
|
290
277
|
- lib/isodoc/iso/html/header.html
|
291
278
|
- lib/isodoc/iso/html/html_iso_intro.html
|