isodoc 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,9 @@
3
3
  require "spec_helper"
4
4
  require "fileutils"
5
5
 
6
+ OPTIONS = { wordstylesheet: "spec/assets/word.css",
7
+ htmlstylesheet: "spec/assets/html.scss" }
8
+
6
9
  RSpec.describe IsoDoc do
7
10
  it "generates file based on string input" do
8
11
  FileUtils.rm_f "test.doc"
@@ -10,7 +13,7 @@ RSpec.describe IsoDoc do
10
13
  IsoDoc::HtmlConvert.new(
11
14
  { wordstylesheet: "spec/assets/word.css",
12
15
  htmlstylesheet: "spec/assets/html.scss",
13
- filename: "test" }
16
+ filename: "test" },
14
17
  ).convert("test", <<~"INPUT", false)
15
18
  <iso-standard xmlns="http://riboseinc.com/isoxml">
16
19
  <bibdata>
@@ -37,7 +40,7 @@ RSpec.describe IsoDoc do
37
40
  IsoDoc::HtmlConvert.new(
38
41
  { wordstylesheet: "word.css",
39
42
  htmlstylesheet: "html.scss",
40
- filename: "test" }
43
+ filename: "test" },
41
44
  ).convert("spec/assets/test", <<~"INPUT", false)
42
45
  <iso-standard xmlns="http://riboseinc.com/isoxml">
43
46
  <bibdata>
@@ -111,7 +114,7 @@ RSpec.describe IsoDoc do
111
114
  FileUtils.rm_f "test.html"
112
115
  IsoDoc::WordConvert.new(
113
116
  { wordstylesheet: "spec/assets/word.css",
114
- htmlstylesheet: "spec/assets/html.scss" }
117
+ htmlstylesheet: "spec/assets/html.scss" },
115
118
  ).convert("test", <<~"INPUT", false)
116
119
  <iso-standard xmlns="http://riboseinc.com/isoxml">
117
120
  <preface><foreword>
@@ -133,7 +136,7 @@ RSpec.describe IsoDoc do
133
136
  FileUtils.rm_f "spec/assets/iso.html"
134
137
  IsoDoc::HtmlConvert.new(
135
138
  { wordstylesheet: "word.css",
136
- htmlstylesheet: "html.scss" }
139
+ htmlstylesheet: "html.scss" },
137
140
  ).convert("spec/assets/iso.xml", nil, false)
138
141
  expect(File.exist?("spec/assets/iso.html")).to be true
139
142
  html = File.read("spec/assets/iso.html")
@@ -148,7 +151,7 @@ RSpec.describe IsoDoc do
148
151
  FileUtils.rm_f "spec/assets/iso.html"
149
152
  IsoDoc::HeadlessHtmlConvert.new(
150
153
  { wordstylesheet: "word.css",
151
- htmlstylesheet: "html.scss" }
154
+ htmlstylesheet: "html.scss" },
152
155
  ).convert("spec/assets/iso.xml", nil, false)
153
156
  expect(File.exist?("spec/assets/iso.headless.html")).to be true
154
157
  html = File.read("spec/assets/iso.headless.html")
@@ -165,7 +168,7 @@ RSpec.describe IsoDoc do
165
168
  FileUtils.rm_f "spec/assets/iso.doc"
166
169
  IsoDoc::WordConvert.new(
167
170
  { wordstylesheet: "word.css",
168
- htmlstylesheet: "html.scss" }
171
+ htmlstylesheet: "html.scss" },
169
172
  ).convert("spec/assets/iso.xml", nil, false)
170
173
  expect(File.exist?("spec/assets/iso.doc")).to be true
171
174
  word = File.read("spec/assets/iso.doc")
@@ -190,7 +193,7 @@ RSpec.describe IsoDoc do
190
193
  scripts: "spec/assets/scripts.html",
191
194
  i18nyaml: "spec/assets/i18n.yaml",
192
195
  ulstyle: "l1",
193
- olstyle: "l2" }
196
+ olstyle: "l2" },
194
197
  ).convert("test", <<~"INPUT", false)
195
198
  <iso-standard xmlns="http://riboseinc.com/isoxml">
196
199
  <preface><foreword>
@@ -227,7 +230,7 @@ RSpec.describe IsoDoc do
227
230
  scripts: "spec/assets/scripts.html",
228
231
  i18nyaml: "spec/assets/i18n.yaml",
229
232
  ulstyle: "l1",
230
- olstyle: "l2" }
233
+ olstyle: "l2" },
231
234
  ).convert("test", <<~"INPUT", false)
232
235
  <iso-standard xmlns="http://riboseinc.com/isoxml">
233
236
  <preface><foreword>
@@ -272,7 +275,7 @@ RSpec.describe IsoDoc do
272
275
  wordintropage: "spec/assets/wordintro.html",
273
276
  i18nyaml: "spec/assets/i18n.yaml",
274
277
  ulstyle: "l1",
275
- olstyle: "l2" }
278
+ olstyle: "l2" },
276
279
  ).convert("test", <<~"INPUT", false)
277
280
  <iso-standard xmlns="http://riboseinc.com/isoxml">
278
281
  <preface><foreword>
@@ -311,7 +314,7 @@ RSpec.describe IsoDoc do
311
314
  wordintropage: "spec/assets/wordintro.html",
312
315
  i18nyaml: "spec/assets/i18n.yaml",
313
316
  ulstyle: "l1",
314
- olstyle: "l2" }
317
+ olstyle: "l2" },
315
318
  ).convert("test", <<~"INPUT", false)
316
319
  <iso-standard xmlns="http://riboseinc.com/isoxml">
317
320
  <preface><foreword>
@@ -344,7 +347,7 @@ RSpec.describe IsoDoc do
344
347
  FileUtils.rm_f "test.html"
345
348
  IsoDoc::WordConvert.new(
346
349
  { wordstylesheet: "spec/assets/word.css",
347
- htmlstylesheet: "spec/assets/html.scss" }
350
+ htmlstylesheet: "spec/assets/html.scss" },
348
351
  ).convert("test", <<~"INPUT", false)
349
352
  <iso-standard xmlns="http://riboseinc.com/isoxml">
350
353
  <preface><foreword>
@@ -390,7 +393,7 @@ RSpec.describe IsoDoc do
390
393
  FileUtils.rm_f "test.html"
391
394
  IsoDoc::WordConvert.new(
392
395
  { wordstylesheet: "spec/assets/word.css",
393
- htmlstylesheet: "spec/assets/html.scss" }
396
+ htmlstylesheet: "spec/assets/html.scss" },
394
397
  ).convert("test", <<~"INPUT", false)
395
398
  <iso-standard xmlns="http://riboseinc.com/isoxml">
396
399
  <sections>
@@ -426,7 +429,7 @@ RSpec.describe IsoDoc do
426
429
  IsoDoc::WordConvert.new(
427
430
  { wordstylesheet: "spec/assets/word.css",
428
431
  htmlstylesheet: "spec/assets/html.scss",
429
- header: "spec/assets/header.html" }
432
+ header: "spec/assets/header.html" },
430
433
  ).convert("test", <<~"INPUT", false)
431
434
  <iso-standard xmlns="http://riboseinc.com/isoxml">
432
435
  <bibdata type="article">
@@ -454,7 +457,7 @@ RSpec.describe IsoDoc do
454
457
  IsoDoc::WordConvert.new(
455
458
  { wordstylesheet: "spec/assets/word.css",
456
459
  htmlstylesheet: "spec/assets/html.scss",
457
- wordintropage: "spec/assets/wordintro.html" }
460
+ wordintropage: "spec/assets/wordintro.html" },
458
461
  ).convert("test", <<~"INPUT", false)
459
462
  <iso-standard xmlns="http://riboseinc.com/isoxml">
460
463
  <sections>
@@ -478,55 +481,56 @@ RSpec.describe IsoDoc do
478
481
  word = File.read("test.doc")
479
482
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
480
483
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
481
- expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
484
+ expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc")))
485
+ .to be_equivalent_to xmlpp(<<~'OUTPUT')
482
486
  <div class="WordSection2">
483
- /* an empty word intro page */
487
+ /* an empty word intro page */
484
488
 
485
- <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
486
- \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
487
- <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
488
- <a href="#_Toc">Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
489
- <span style="mso-tab-count:1 dotted">. </span>
490
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
491
- <span style="mso-element:field-begin"></span></span>
492
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
493
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
494
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
495
- <p class="MsoToc2">
496
- <span class="MsoHyperlink">
497
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
498
- <a href="#_Toc">Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
499
- <span style="mso-tab-count:1 dotted">. </span>
500
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
501
- <span style="mso-element:field-begin"></span></span>
502
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
503
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
504
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
505
- </span>
506
- </p>
507
- <p class="MsoToc2">
508
- <span class="MsoHyperlink">
509
- <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
510
- <a href="#_Toc">Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
511
- <span style="mso-tab-count:1 dotted">. </span>
512
- </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
513
- <span style="mso-element:field-begin"></span></span>
514
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
515
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
516
- <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
517
- </span>
518
- </p>
519
- <p class="MsoToc1">
520
- <span lang="EN-GB" xml:lang="EN-GB">
521
- <span style="mso-element:field-end"></span>
522
- </span>
523
- <span lang="EN-GB" xml:lang="EN-GB">
524
- <p class="MsoNormal">&#xA0;</p>
525
- </span>
526
- </p>
527
- <p class="MsoNormal">&#xA0;</p>
528
- </div>
529
- OUTPUT
489
+ <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
490
+ \o "1-2" \h \z \u <span style="mso-element:field-separator"></span></span>
491
+ <span class="MsoHyperlink"><span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
492
+ <a href="#_Toc">Clause 4<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
493
+ <span style="mso-tab-count:1 dotted">. </span>
494
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
495
+ <span style="mso-element:field-begin"></span></span>
496
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
497
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
498
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span></span></p>
499
+ <p class="MsoToc2">
500
+ <span class="MsoHyperlink">
501
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
502
+ <a href="#_Toc">Introduction to this<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
503
+ <span style="mso-tab-count:1 dotted">. </span>
504
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
505
+ <span style="mso-element:field-begin"></span></span>
506
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
507
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
508
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
509
+ </span>
510
+ </p>
511
+ <p class="MsoToc2">
512
+ <span class="MsoHyperlink">
513
+ <span lang="EN-GB" style="mso-no-proof:yes" xml:lang="EN-GB">
514
+ <a href="#_Toc">Clause 4.2<span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
515
+ <span style="mso-tab-count:1 dotted">. </span>
516
+ </span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">
517
+ <span style="mso-element:field-begin"></span></span>
518
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"> PAGEREF _Toc \h </span>
519
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-separator"></span></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB">1</span>
520
+ <span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"></span><span lang="EN-GB" class="MsoTocTextSpan" xml:lang="EN-GB"><span style="mso-element:field-end"></span></span></a></span>
521
+ </span>
522
+ </p>
523
+ <p class="MsoToc1">
524
+ <span lang="EN-GB" xml:lang="EN-GB">
525
+ <span style="mso-element:field-end"></span>
526
+ </span>
527
+ <span lang="EN-GB" xml:lang="EN-GB">
528
+ <p class="MsoNormal">&#xA0;</p>
529
+ </span>
530
+ </p>
531
+ <p class="MsoNormal">&#xA0;</p>
532
+ </div>
533
+ OUTPUT
530
534
  end
531
535
 
532
536
  it "populates Word ToC with custom levels" do
@@ -535,7 +539,7 @@ RSpec.describe IsoDoc do
535
539
  { wordstylesheet: "spec/assets/word.css",
536
540
  htmlstylesheet: "spec/assets/html.scss",
537
541
  wordintropage: "spec/assets/wordintro.html",
538
- doctoclevels: 3 }
542
+ doctoclevels: 3 },
539
543
  ).convert("test", <<~"INPUT", false)
540
544
  <iso-standard xmlns="http://riboseinc.com/isoxml">
541
545
  <sections>
@@ -648,7 +652,7 @@ RSpec.describe IsoDoc do
648
652
  IsoDoc::HtmlConvert.new(
649
653
  { wordstylesheet: "spec/assets/word.css",
650
654
  htmlstylesheet: "spec/assets/html.scss",
651
- wordintropage: "spec/assets/wordintro.html" }
655
+ wordintropage: "spec/assets/wordintro.html" },
652
656
  ).convert("test", <<~"INPUT", false)
653
657
  <iso-standard xmlns="http://riboseinc.com/isoxml">
654
658
  <sections>
@@ -669,7 +673,8 @@ RSpec.describe IsoDoc do
669
673
  </iso-standard>
670
674
  INPUT
671
675
  html = File.read("test.html")
672
- .sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">')
676
+ .sub(/^.*<main class="main-section">/m,
677
+ '<main xmlns:epub="epub" class="main-section">')
673
678
  .sub(%r{</main>.*$}m, "</main>")
674
679
  expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
675
680
  <main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
@@ -704,7 +709,7 @@ RSpec.describe IsoDoc do
704
709
  FileUtils.rm_rf "test_htmlimages"
705
710
  IsoDoc::HtmlConvert.new(
706
711
  { wordstylesheet: "spec/assets/word.css",
707
- htmlstylesheet: "spec/assets/html.scss" }
712
+ htmlstylesheet: "spec/assets/html.scss" },
708
713
  ).convert("test", <<~"INPUT", false)
709
714
  <iso-standard xmlns="http://riboseinc.com/isoxml">
710
715
  <preface><foreword>
@@ -913,7 +918,7 @@ RSpec.describe IsoDoc do
913
918
  FileUtils.rm_rf "test_htmlimages"
914
919
  IsoDoc::HtmlConvert.new(
915
920
  { wordstylesheet: "spec/assets/word.css",
916
- htmlstylesheet: "spec/assets/html.scss" }
921
+ htmlstylesheet: "spec/assets/html.scss" },
917
922
  ).convert("test", <<~"INPUT", false)
918
923
  <iso-standard xmlns="http://riboseinc.com/isoxml">
919
924
  <preface><foreword>
@@ -952,154 +957,161 @@ RSpec.describe IsoDoc do
952
957
  it "moves images in HTML, using relative file location" do
953
958
  FileUtils.rm_f "spec/test.html"
954
959
  FileUtils.rm_rf "spec/test_htmlimages"
955
- IsoDoc::HtmlConvert.new({ wordstylesheet: "assets/word.css", htmlstylesheet: "assets/html.scss" }).convert("spec/test", <<~"INPUT", false)
956
- <iso-standard xmlns="http://riboseinc.com/isoxml">
957
- <preface><foreword>
958
- <figure id="_">
959
- <name>Split-it-right sample divider</name>
960
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
961
- <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
962
- <image src="assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
963
- <image src="assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
964
- </figure>
965
- </foreword></preface>
966
- </iso-standard>
967
- INPUT
960
+ IsoDoc::HtmlConvert.new({ wordstylesheet: "assets/word.css", htmlstylesheet: "assets/html.scss" })
961
+ .convert("spec/test", <<~"INPUT", false)
962
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
963
+ <preface><foreword>
964
+ <figure id="_">
965
+ <name>Split-it-right sample divider</name>
966
+ <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
967
+ <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
968
+ <image src="assets/rice_image1.png" id="_" width="20000" height="300000" mimetype="image/png"/>
969
+ <image src="assets/rice_image1.png" id="_" width="99" height="auto" mimetype="image/png"/>
970
+ </figure>
971
+ </foreword></preface>
972
+ </iso-standard>
973
+ INPUT
968
974
  html = File.read("spec/test.html")
969
975
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
970
976
  .sub(%r{</main>.*$}m, "</main>")
971
977
  expect(`ls test_htmlimages`).to match(/\.png$/)
972
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
973
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
974
- <br />
975
- <div>
976
- <h1 class="ForewordTitle">Foreword</h1>
977
- <div id="_" class="figure">
978
- <img src="test_htmlimages/_.png" height="776" width="922" />
979
- <img src="test_htmlimages/_.png" height="776" width="922" />
980
- <img src="test_htmlimages/_.png" height="800" width="53" />
981
- <img src="test_htmlimages/_.png" height="83" width="99" />
982
- <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
983
- </div>
984
- <p class="zzSTDTitle1"></p>
985
- </main>
986
- OUTPUT
978
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
979
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
980
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
981
+ <br />
982
+ <div>
983
+ <h1 class="ForewordTitle">Foreword</h1>
984
+ <div id="_" class="figure">
985
+ <img src="test_htmlimages/_.png" height="776" width="922" />
986
+ <img src="test_htmlimages/_.png" height="776" width="922" />
987
+ <img src="test_htmlimages/_.png" height="800" width="53" />
988
+ <img src="test_htmlimages/_.png" height="83" width="99" />
989
+ <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
990
+ </div>
991
+ <p class="zzSTDTitle1"></p>
992
+ </main>
993
+ OUTPUT
987
994
  end
988
995
 
989
996
  it "encodes images in HTML as data URIs" do
990
997
  FileUtils.rm_f "test.html"
991
998
  FileUtils.rm_rf "test_htmlimages"
992
- IsoDoc::HtmlConvert.new({ htmlstylesheet: "spec/assets/html.scss", datauriimage: true }).convert("test", <<~"INPUT", false)
993
- <iso-standard xmlns="http://riboseinc.com/isoxml">
994
- <preface><foreword>
995
- <figure id="_">
996
- <name>Split-it-right sample divider</name>
997
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
998
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
999
- </figure>
1000
- </foreword></preface>
1001
- </iso-standard>
1002
- INPUT
999
+ IsoDoc::HtmlConvert.new({ htmlstylesheet: "spec/assets/html.scss", datauriimage: true })
1000
+ .convert("test", <<~"INPUT", false)
1001
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1002
+ <preface><foreword>
1003
+ <figure id="_">
1004
+ <name>Split-it-right sample divider</name>
1005
+ <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
1006
+ <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
1007
+ </figure>
1008
+ </foreword></preface>
1009
+ </iso-standard>
1010
+ INPUT
1003
1011
  html = File.read("test.html")
1004
1012
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
1005
1013
  .sub(%r{</main>.*$}m, "</main>")
1006
- expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1007
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1008
- <br />
1009
- <div>
1010
- <h1 class="ForewordTitle">Foreword</h1>
1011
- <div id="_" class="figure">
1012
- <img src="data:image/png;base64,_" height="776" width="922" />
1013
- <img src="data:image/png;base64,_" height="776" width="922" />
1014
- <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
1015
- </div>
1016
- <p class="zzSTDTitle1"></p>
1017
- </main>
1018
- OUTPUT
1014
+ expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})))
1015
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
1016
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1017
+ <br />
1018
+ <div>
1019
+ <h1 class="ForewordTitle">Foreword</h1>
1020
+ <div id="_" class="figure">
1021
+ <img src="data:image/png;base64,_" height="776" width="922" />
1022
+ <img src="data:image/png;base64,_" height="776" width="922" />
1023
+ <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
1024
+ </div>
1025
+ <p class="zzSTDTitle1"></p>
1026
+ </main>
1027
+ OUTPUT
1019
1028
  end
1020
1029
 
1021
1030
  it "encodes images in HTML as data URIs, using relative file location" do
1022
1031
  FileUtils.rm_f "spec/test.html"
1023
1032
  FileUtils.rm_rf "spec/test_htmlimages"
1024
- IsoDoc::HtmlConvert.new({ htmlstylesheet: "assets/html.scss", datauriimage: true }).convert("spec/test", <<~"INPUT", false)
1025
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1026
- <preface><foreword>
1027
- <figure id="_">
1028
- <name>Split-it-right sample divider</name>
1029
- <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
1030
- <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
1031
- </figure>
1032
- </foreword></preface>
1033
- </iso-standard>
1034
- INPUT
1033
+ IsoDoc::HtmlConvert.new({ htmlstylesheet: "assets/html.scss", datauriimage: true })
1034
+ .convert("spec/test", <<~"INPUT", false)
1035
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1036
+ <preface><foreword>
1037
+ <figure id="_">
1038
+ <name>Split-it-right sample divider</name>
1039
+ <image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
1040
+ <image src="assets/rice_image1.png" id="_" mimetype="image/png"/>
1041
+ </figure>
1042
+ </foreword></preface>
1043
+ </iso-standard>
1044
+ INPUT
1035
1045
  html = File.read("spec/test.html")
1036
1046
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
1037
1047
  .sub(%r{</main>.*$}m, "</main>")
1038
- expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1039
- <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1040
- <br />
1041
- <div>
1042
- <h1 class="ForewordTitle">Foreword</h1>
1043
- <div id="_" class="figure">
1044
- <img src="data:image/png;base64,_" height="776" width="922" />
1045
- <img src="data:image/png;base64,_" height="776" width="922" />
1046
- <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
1047
- </div>
1048
- <p class="zzSTDTitle1"></p>
1049
- </main>
1050
- OUTPUT
1048
+ expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})))
1049
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
1050
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1051
+ <br />
1052
+ <div>
1053
+ <h1 class="ForewordTitle">Foreword</h1>
1054
+ <div id="_" class="figure">
1055
+ <img src="data:image/png;base64,_" height="776" width="922" />
1056
+ <img src="data:image/png;base64,_" height="776" width="922" />
1057
+ <p class="FigureTitle" style="text-align:center;">Split-it-right sample divider</p></div>
1058
+ </div>
1059
+ <p class="zzSTDTitle1"></p>
1060
+ </main>
1061
+ OUTPUT
1051
1062
  end
1052
1063
 
1053
1064
  it "processes IsoXML terms for HTML" do
1054
1065
  FileUtils.rm_f "test.html"
1055
1066
  FileUtils.rm_f "test.doc"
1056
- IsoDoc::HtmlConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1057
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1058
- <sections>
1059
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
1060
- <term id="paddy1"><name>1.1.</name><preferred>paddy</preferred>
1061
- <domain>rice</domain>
1062
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1063
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
1064
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1065
- <ul>
1066
- <li>A</li>
1067
- </ul>
1068
- </termexample>
1069
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
1070
- <ul>
1071
- <li>A</li>
1072
- </ul>
1073
- </termexample>
1074
- <termsource status="modified">
1075
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
1076
- <modification>
1077
- <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>
1078
- </modification>
1079
- </termsource></term>
1080
- <term id="paddy"><name>1.2.</name><preferred>paddy</preferred><admitted>paddy rice</admitted>
1081
- <admitted>rough rice</admitted>
1082
- <deprecates>cargo rice</deprecates>
1083
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1084
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
1085
- <ul>
1086
- <li>A</li>
1087
- </ul>
1088
- </termexample>
1089
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
1090
- <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>
1091
- </termnote>
1092
- <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
1093
- <ul><li>A</li></ul>
1094
- <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>
1095
- </termnote>
1096
- <termsource status="identical">
1097
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
1098
- </termsource></term>
1099
- </terms>
1100
- </sections>
1101
- </iso-standard>
1102
- INPUT
1067
+ IsoDoc::HtmlConvert.new(OPTIONS)
1068
+ .convert("test", <<~"INPUT", false)
1069
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1070
+ <sections>
1071
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
1072
+ <term id="paddy1"><name>1.1.</name><preferred>paddy</preferred>
1073
+ <domain>rice</domain>
1074
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1075
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
1076
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1077
+ <ul>
1078
+ <li>A</li>
1079
+ </ul>
1080
+ </termexample>
1081
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
1082
+ <ul>
1083
+ <li>A</li>
1084
+ </ul>
1085
+ </termexample>
1086
+ <termsource status="modified">
1087
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
1088
+ <modification>
1089
+ <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>
1090
+ </modification>
1091
+ </termsource></term>
1092
+ <term id="paddy"><name>1.2.</name><preferred>paddy</preferred><admitted>paddy rice</admitted>
1093
+ <admitted>rough rice</admitted>
1094
+ <deprecates>cargo rice</deprecates>
1095
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1096
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
1097
+ <ul>
1098
+ <li>A</li>
1099
+ </ul>
1100
+ </termexample>
1101
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
1102
+ <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>
1103
+ </termnote>
1104
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
1105
+ <ul><li>A</li></ul>
1106
+ <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>
1107
+ </termnote>
1108
+ <termsource status="identical">
1109
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
1110
+ </termsource></term>
1111
+ </terms>
1112
+ </sections>
1113
+ </iso-standard>
1114
+ INPUT
1103
1115
  expect(File.exist?("test.html")).to be true
1104
1116
  html = File.read("test.html")
1105
1117
  expect(html).to match(%r{<h2 class="TermNum" id="paddy1">1\.1\.</h2>})
@@ -1109,34 +1121,35 @@ RSpec.describe IsoDoc do
1109
1121
  it "processes empty term modifications" do
1110
1122
  FileUtils.rm_f "test.html"
1111
1123
  FileUtils.rm_f "test.doc"
1112
- IsoDoc::HtmlConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1113
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1114
- <sections>
1115
- <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
1116
- <term id="paddy1"><preferred>paddy</preferred>
1117
- <domain>rice</domain>
1118
- <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1119
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
1120
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1121
- <ul>
1122
- <li>A</li>
1123
- </ul>
1124
- </termexample>
1125
- <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
1126
- <ul>
1127
- <li>A</li>
1128
- </ul>
1129
- </termexample>
1130
- <termsource status="modified">
1131
- <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">ISO 7301:2011, Clause 3.1</origin>
1132
- <modification>
1133
- <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
1134
- </modification>
1135
- </termsource></term>
1136
- </terms>
1137
- </sections>
1138
- </iso-standard>
1139
- INPUT
1124
+ IsoDoc::HtmlConvert.new(OPTIONS)
1125
+ .convert("test", <<~"INPUT", false)
1126
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1127
+ <sections>
1128
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
1129
+ <term id="paddy1"><preferred>paddy</preferred>
1130
+ <domain>rice</domain>
1131
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
1132
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
1133
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1134
+ <ul>
1135
+ <li>A</li>
1136
+ </ul>
1137
+ </termexample>
1138
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
1139
+ <ul>
1140
+ <li>A</li>
1141
+ </ul>
1142
+ </termexample>
1143
+ <termsource status="modified">
1144
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">ISO 7301:2011, Clause 3.1</origin>
1145
+ <modification>
1146
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489"/>
1147
+ </modification>
1148
+ </termsource></term>
1149
+ </terms>
1150
+ </sections>
1151
+ </iso-standard>
1152
+ INPUT
1140
1153
  expect(File.exist?("test.html")).to be true
1141
1154
  html = File.read("test.html")
1142
1155
  expect(html).to include '[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified]'
@@ -1145,37 +1158,38 @@ RSpec.describe IsoDoc do
1145
1158
  it "creates continuation styles for multiparagraph list items in Word" do
1146
1159
  FileUtils.rm_f "test.doc"
1147
1160
  FileUtils.rm_f "test.html"
1148
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1149
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1150
- <preface><foreword>
1151
- <ul>
1152
- <li><p>A</p>
1153
- <p>B</p></li>
1154
- <li><ol><li><p>C</p>
1155
- <p>D</p>
1156
- <sourcecode>E</sourcecode></li>
1157
- </ol></li>
1158
- </ul>
1159
- <ol>
1160
- <li><p>A1</p>
1161
- <p>B1</p></li>
1162
- <li><ul><li><p>C1</p>
1163
- <formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
1164
- <stem type="AsciiMath">D1</stem>
1165
- </formula>
1166
- <dl id="_f8fb7ed7-7874-44a8-933f-06e0e86fb264">
1167
- <dt>
1168
- <em>n</em>
1169
- </dt>
1170
- <dd>
1171
- <p id="_a27281a4-b20e-4d0b-a780-bab9e851b03e">is the number of coating layers</p>
1172
- </dd>
1173
- </dl>
1174
- </ul></li>
1175
- </ol>
1176
- </foreword></preface>
1177
- </iso-standard>
1178
- INPUT
1161
+ IsoDoc::WordConvert.new(OPTIONS)
1162
+ .convert("test", <<~"INPUT", false)
1163
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1164
+ <preface><foreword>
1165
+ <ul>
1166
+ <li><p>A</p>
1167
+ <p>B</p></li>
1168
+ <li><ol><li><p>C</p>
1169
+ <p>D</p>
1170
+ <sourcecode>E</sourcecode></li>
1171
+ </ol></li>
1172
+ </ul>
1173
+ <ol>
1174
+ <li><p>A1</p>
1175
+ <p>B1</p></li>
1176
+ <li><ul><li><p>C1</p>
1177
+ <formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
1178
+ <stem type="AsciiMath">D1</stem>
1179
+ </formula>
1180
+ <dl id="_f8fb7ed7-7874-44a8-933f-06e0e86fb264">
1181
+ <dt>
1182
+ <em>n</em>
1183
+ </dt>
1184
+ <dd>
1185
+ <p id="_a27281a4-b20e-4d0b-a780-bab9e851b03e">is the number of coating layers</p>
1186
+ </dd>
1187
+ </dl>
1188
+ </ul></li>
1189
+ </ol>
1190
+ </foreword></preface>
1191
+ </iso-standard>
1192
+ INPUT
1179
1193
  word = File.read("test.doc")
1180
1194
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
1181
1195
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
@@ -1255,16 +1269,17 @@ RSpec.describe IsoDoc do
1255
1269
  it "does not lose HTML escapes in postprocessing" do
1256
1270
  FileUtils.rm_f "test.doc"
1257
1271
  FileUtils.rm_f "test.html"
1258
- IsoDoc::HtmlConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1259
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1260
- <preface><foreword>
1261
- <sourcecode id="samplecode">
1262
- <name>XML code</name>
1263
- &lt;xml&gt; &amp;
1264
- </sourcecode>
1265
- </foreword></preface>
1266
- </iso-standard>
1267
- INPUT
1272
+ IsoDoc::HtmlConvert.new(OPTIONS)
1273
+ .convert("test", <<~"INPUT", false)
1274
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1275
+ <preface><foreword>
1276
+ <sourcecode id="samplecode">
1277
+ <name>XML code</name>
1278
+ &lt;xml&gt; &amp;
1279
+ </sourcecode>
1280
+ </foreword></preface>
1281
+ </iso-standard>
1282
+ INPUT
1268
1283
  html = File.read("test.html")
1269
1284
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
1270
1285
  .sub(%r{</main>.*$}m, "</main>")
@@ -1285,16 +1300,17 @@ RSpec.describe IsoDoc do
1285
1300
  it "does not lose HTML escapes in postprocessing (Word)" do
1286
1301
  FileUtils.rm_f "test.doc"
1287
1302
  FileUtils.rm_f "test.html"
1288
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1289
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1290
- <preface><foreword>
1291
- <sourcecode id="samplecode">
1292
- <name>XML code</name>
1293
- &lt;xml&gt; &amp;
1294
- </sourcecode>
1295
- </foreword></preface>
1296
- </iso-standard>
1297
- INPUT
1303
+ IsoDoc::WordConvert.new(OPTIONS)
1304
+ .convert("test", <<~"INPUT", false)
1305
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1306
+ <preface><foreword>
1307
+ <sourcecode id="samplecode">
1308
+ <name>XML code</name>
1309
+ &lt;xml&gt; &amp;
1310
+ </sourcecode>
1311
+ </foreword></preface>
1312
+ </iso-standard>
1313
+ INPUT
1298
1314
  word = File.read("test.doc")
1299
1315
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
1300
1316
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
@@ -1315,7 +1331,7 @@ RSpec.describe IsoDoc do
1315
1331
  it "propagates example style to paragraphs in postprocessing (Word)" do
1316
1332
  FileUtils.rm_f "test.doc"
1317
1333
  FileUtils.rm_f "test.html"
1318
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1334
+ IsoDoc::WordConvert.new(OPTIONS).convert("test", <<~"INPUT", false)
1319
1335
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1320
1336
  <preface><foreword>
1321
1337
  <example id="samplecode">
@@ -1346,16 +1362,17 @@ RSpec.describe IsoDoc do
1346
1362
  it "deals with image captions (Word)" do
1347
1363
  FileUtils.rm_f "test.doc"
1348
1364
  FileUtils.rm_f "test.html"
1349
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1350
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1351
- <preface><foreword>
1352
- <figure id="fig1">
1353
- <name>Typical arrangement of the far-field scan set-up</name>
1354
- <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
1355
- </figure>
1356
- </foreword></preface>
1357
- </iso-standard>
1358
- INPUT
1365
+ IsoDoc::WordConvert.new(OPTIONS)
1366
+ .convert("test", <<~"INPUT", false)
1367
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1368
+ <preface><foreword>
1369
+ <figure id="fig1">
1370
+ <name>Typical arrangement of the far-field scan set-up</name>
1371
+ <image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
1372
+ </figure>
1373
+ </foreword></preface>
1374
+ </iso-standard>
1375
+ INPUT
1359
1376
  word = File.read("test.doc")
1360
1377
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
1361
1378
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
@@ -1379,20 +1396,21 @@ RSpec.describe IsoDoc do
1379
1396
  it "deals with empty table titles (Word)" do
1380
1397
  FileUtils.rm_f "test.doc"
1381
1398
  FileUtils.rm_f "test.html"
1382
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1383
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1384
- <preface><foreword>
1385
- <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1386
- <td rowspan="2">
1387
- <p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mo>(</mo><mi>μ</mi><mi>m</mi><mo>)</mo></mrow></math></stem></p>
1388
- </td>
1389
- <th colspan="3" align="left">Predictive wavelengths</th>
1390
- </tr>
1391
- </thead>
1392
- </table>
1393
- </preface>
1394
- </iso-standard>
1395
- INPUT
1399
+ IsoDoc::WordConvert.new(OPTIONS)
1400
+ .convert("test", <<~"INPUT", false)
1401
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1402
+ <preface><foreword>
1403
+ <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1404
+ <td rowspan="2">
1405
+ <p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mo>(</mo><mi>μ</mi><mi>m</mi><mo>)</mo></mrow></math></stem></p>
1406
+ </td>
1407
+ <th colspan="3" align="left">Predictive wavelengths</th>
1408
+ </tr>
1409
+ </thead>
1410
+ </table>
1411
+ </preface>
1412
+ </iso-standard>
1413
+ INPUT
1396
1414
  word = File.read("test.doc")
1397
1415
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
1398
1416
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
@@ -1439,21 +1457,23 @@ RSpec.describe IsoDoc do
1439
1457
  it "propagates alignment of table cells (Word)" do
1440
1458
  FileUtils.rm_f "test.doc"
1441
1459
  FileUtils.rm_f "test.html"
1442
- IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }).convert("test", <<~"INPUT", false)
1443
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1444
- <preface><foreword>
1445
- <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1446
- <td rowspan="2" align="left">
1447
- <p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
1448
- <p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
1449
- </td>
1450
- <th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
1451
- </tr>
1452
- </thead>
1453
- </table>
1454
- </preface>
1455
- </iso-standard>
1456
- INPUT
1460
+ IsoDoc::WordConvert.new(OPTIONS)
1461
+ .convert("test", <<~"INPUT", false)
1462
+ #{' '}
1463
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1464
+ <preface><foreword>
1465
+ <table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
1466
+ <td rowspan="2" align="left">
1467
+ <p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
1468
+ <p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
1469
+ </td>
1470
+ <th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
1471
+ </tr>
1472
+ </thead>
1473
+ </table>
1474
+ </preface>
1475
+ </iso-standard>
1476
+ INPUT
1457
1477
  word = File.read("test.doc")
1458
1478
  .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
1459
1479
  .sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
@@ -1580,7 +1600,7 @@ RSpec.describe IsoDoc do
1580
1600
  FileUtils.rm_f "test.doc"
1581
1601
  IsoDoc::WordConvert.new(
1582
1602
  { wordstylesheet: "spec/assets/word.css",
1583
- htmlstylesheet: "spec/assets/html.scss", filename: "test" }
1603
+ htmlstylesheet: "spec/assets/html.scss", filename: "test" },
1584
1604
  ).convert("test", <<~"INPUT", false)
1585
1605
  <standard-document xmlns="http://riboseinc.com/isoxml">
1586
1606
  <bibdata type="standard">