isodoc 1.8.3.1 → 2.0.0

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.
@@ -6,35 +6,40 @@ module IsoDoc
6
6
 
7
7
  def concept1(node)
8
8
  xref = node&.at(ns("./xref/@target"))&.text or
9
- return concept_render(node, ital: node["ital"] || "true",
10
- ref: node["ref"] || "true",
11
- linkref: node["linkref"] || "true",
12
- linkmention: node["linkmention"] || "false")
9
+ return concept_render(node, ital: "true", ref: "true",
10
+ linkref: "true", linkmention: "false")
13
11
  if node.at(ns("//definitions//dt[@id = '#{xref}']"))
14
- concept_render(node, ital: node["ital"] || "false",
15
- ref: node["ref"] || "false",
16
- linkref: node["linkref"] || "true",
17
- linkmention: node["linkmention"] || "false")
18
- else concept_render(node, ital: node["ital"] || "true",
19
- ref: node["ref"] || "true",
20
- linkref: node["linkref"] || "true",
21
- linkmention: node["linkmention"] || "false")
12
+ concept_render(node, ital: "false", ref: "false",
13
+ linkref: "true", linkmention: "false")
14
+ else concept_render(node, ital: "true", ref: "true",
15
+ linkref: "true", linkmention: "false")
22
16
  end
23
17
  end
24
18
 
25
- def concept_render(node, opts)
19
+ def concept_render(node, defaults)
20
+ opts, render, ref = concept_render_init(node, defaults)
26
21
  node&.at(ns("./refterm"))&.remove
27
- r = node.at(ns("./renderterm"))
28
- ref = node.at(ns("./xref | ./eref | ./termref"))
29
- ref && opts[:ref] != "false" and r&.next = " "
30
- opts[:ital] == "true" and r&.name = "em"
31
- concept1_linkmention(ref, r, opts)
22
+ ref && opts[:ref] != "false" and render&.next = " "
23
+ opts[:ital] == "true" and render&.name = "em"
24
+ concept1_linkmention(ref, render, opts)
32
25
  concept1_ref(node, ref, opts)
26
+ concept1_nonital(node, opts)
27
+ node.replace(node.children)
28
+ end
29
+
30
+ def concept1_nonital(node, opts)
33
31
  if opts[:ital] == "false"
34
32
  r = node.at(ns(".//renderterm"))
35
33
  r&.replace(r&.children)
36
34
  end
37
- node.replace(node.children)
35
+ end
36
+
37
+ def concept_render_init(node, defaults)
38
+ opts = %i(ital ref linkref linkmention).each_with_object({}) do |x, m|
39
+ m[x] = node[x.to_s] || defaults[x]
40
+ end
41
+ [opts, node.at(ns("./renderterm")),
42
+ node.at(ns("./xref | ./eref | ./termref"))]
38
43
  end
39
44
 
40
45
  def concept1_linkmention(ref, renderterm, opts)
@@ -237,7 +242,7 @@ module IsoDoc
237
242
  end
238
243
 
239
244
  def termsource_modification(mod)
240
- mod.previous_element.next = ", #{@i18n.modified}"
245
+ mod.previous_element.next = l10n(", #{@i18n.modified}")
241
246
  mod.text.strip.empty? or mod.previous = " – "
242
247
  mod.elements.size == 1 and
243
248
  mod.elements[0].replace(mod.elements[0].children)
@@ -37,6 +37,7 @@ module IsoDoc
37
37
  references docxml
38
38
  index docxml
39
39
  clausetitle docxml
40
+ floattitle docxml
40
41
  toc docxml
41
42
  display_order docxml
42
43
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.8.3.1".freeze
2
+ VERSION = "2.0.0".freeze
3
3
  end
@@ -9,6 +9,10 @@ module IsoDoc
9
9
  docxml.xpath(ns(@klass.bibliography_xpath)).each do |b|
10
10
  preface_names(b)
11
11
  end
12
+ references(docxml)
13
+ end
14
+
15
+ def references(docxml)
12
16
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
13
17
  reference_names(ref)
14
18
  end
@@ -148,11 +152,11 @@ module IsoDoc
148
152
  "xmlns:name = 'International Electrotechnical Commission']".freeze
149
153
 
150
154
  def reference_names(ref)
151
- # isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
152
155
  ids = @klass.bibitem_ref_code(ref)
153
156
  identifiers = @klass.render_identifier(ids)
154
- # date = ref.at(ns("./date[@type = 'published']"))
155
- reference = @klass.docid_l10n(identifiers[0] || identifiers[1])
157
+ reference = @klass
158
+ .docid_l10n(identifiers[:metanorma] || identifiers[:sdo] ||
159
+ identifiers[:ordinal] || identifiers[:doi])
156
160
  @anchors[ref["id"]] = { xref: reference }
157
161
  end
158
162
  end
@@ -33,7 +33,7 @@ module IsoDoc
33
33
  end
34
34
 
35
35
  def tmpimagedir_suffix
36
- "_pdfimages"
36
+ "_#{SecureRandom.hex(8)}_pdfimages"
37
37
  end
38
38
 
39
39
  def pdf_stylesheet(_docxml)
@@ -58,7 +58,6 @@ module IsoDoc
58
58
  file = File.read(input_filename, encoding: "utf-8") if file.nil?
59
59
  input_filename, docxml, filename = input_xml_path(input_filename,
60
60
  file, debug)
61
- warn pdf_options(docxml).merge(@options)
62
61
  ::Metanorma::Output::XslfoPdf.new.convert(
63
62
  input_filename,
64
63
  output_filename || "#{filename}.#{@suffix}",
@@ -1752,7 +1752,7 @@ RSpec.describe IsoDoc do
1752
1752
  </foreword></preface>
1753
1753
  <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1754
1754
  <title depth='1'>Bibliography</title>
1755
- <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">DOI 10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1755
+ <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type='metanorma-ordinal'>[1]</docidentifier> <docidentifier type="IETF">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">DOI 10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem>
1756
1756
  </references></bibliography>
1757
1757
  </iso-standard>
1758
1758
  OUTPUT
@@ -2518,6 +2518,7 @@ RSpec.describe IsoDoc do
2518
2518
  <bibliography>
2519
2519
  <references hidden='true' normative='false' displayorder="1">
2520
2520
  <bibitem id='express_action_schema' type='internal'>
2521
+ <docidentifier type='metanorma-ordinal'>[1]</docidentifier>
2521
2522
  <docidentifier type='repository'>express/action_schema</docidentifier>
2522
2523
  </bibitem>
2523
2524
  </references>
@@ -474,6 +474,33 @@ RSpec.describe IsoDoc do
474
474
  OUTPUT
475
475
  end
476
476
 
477
+ =begin
478
+ it "populates HTML ToC" do
479
+ FileUtils.rm_f "test.doc"
480
+ FileUtils.rm_f "test.html"
481
+ IsoDoc::HtmlConvert.new({ htmltoclevels: 3 })
482
+ .convert("test", <<~"INPUT", false)
483
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
484
+ <preface><foreword><title>Foreword</title>
485
+ <variant-title type="toc">FORVORT</variant-title>
486
+ </foreword></preface>
487
+ <sections>
488
+ <clause><title>First Clause</title>
489
+ <clause><title>First Subclause</title>
490
+ <variant-title type="toc">SUBCLOZ</variant-title>
491
+ </clause>
492
+ </clause>
493
+ </sections>
494
+ </iso-standard>
495
+ INPUT
496
+ html = Nokogiri::XML(File.read("test.html")).
497
+ at("//div[@id = 'toc']")
498
+ expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~OUTPUT)
499
+ HAJSHJAS
500
+ OUTPUT
501
+ end
502
+ =end
503
+
477
504
  it "populates Word ToC" do
478
505
  FileUtils.rm_f "test.doc"
479
506
  IsoDoc::WordConvert.new(
@@ -495,6 +522,7 @@ RSpec.describe IsoDoc do
495
522
  </fn></p>
496
523
  <clause id="P" inline-header="false" obligation="normative">
497
524
  <title>Clause 4.2.1</title>
525
+ <variant-title type="toc">SUBCLOZ</variant-title>
498
526
  </clause>
499
527
  </clause></clause>
500
528
  </sections>
@@ -726,9 +754,9 @@ RSpec.describe IsoDoc do
726
754
  OUTPUT
727
755
  end
728
756
 
729
- it "moves images in HTML" do
757
+ it "moves images in HTML #1" do
730
758
  FileUtils.rm_f "test.html"
731
- FileUtils.rm_rf "test_htmlimages"
759
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
732
760
  IsoDoc::HtmlConvert.new(
733
761
  { wordstylesheet: "spec/assets/word.css",
734
762
  htmlstylesheet: "spec/assets/html.scss" },
@@ -750,8 +778,9 @@ RSpec.describe IsoDoc do
750
778
  html = File.read("test.html")
751
779
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
752
780
  .sub(%r{</main>.*$}m, "</main>")
753
- expect(`ls test_htmlimages`).to match(/\.png$/)
754
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
781
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
782
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
783
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
755
784
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
756
785
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
757
786
  <br />
@@ -771,7 +800,7 @@ RSpec.describe IsoDoc do
771
800
  OUTPUT
772
801
  end
773
802
 
774
- it "moves images in HTML" do
803
+ it "moves images in HTML #2" do
775
804
  FileUtils.rm_f "test.html"
776
805
  FileUtils.rm_rf "test_htmlimages"
777
806
  IsoDoc::HtmlConvert.new(
@@ -791,8 +820,9 @@ RSpec.describe IsoDoc do
791
820
  html = File.read("test.html")
792
821
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
793
822
  .sub(%r{</main>.*$}m, "</main>")
794
- expect(`ls test_htmlimages`).to match(/\.png$/)
795
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
823
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
824
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
825
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
796
826
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
797
827
  <main class='main-section'>
798
828
  <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
@@ -813,7 +843,6 @@ RSpec.describe IsoDoc do
813
843
  context "when `mathvariant` attr equal to `script`" do
814
844
  it "converts mathvariant text chars into associated plain chars" do
815
845
  FileUtils.rm_f "test.html"
816
- FileUtils.rm_rf "test_htmlimages"
817
846
  input = <<~INPUT
818
847
  <?xml version="1.0" encoding="UTF-8"?>
819
848
  <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14">
@@ -865,7 +894,6 @@ RSpec.describe IsoDoc do
865
894
  context "when complex `mathvariant` combinations" do
866
895
  it "converts mathvariant text chars into associated plain chars" do
867
896
  FileUtils.rm_f "test.html"
868
- FileUtils.rm_rf "test_htmlimages"
869
897
  input = <<~INPUT
870
898
  <?xml version="1.0" encoding="UTF-8"?>
871
899
  <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14">
@@ -975,7 +1003,7 @@ RSpec.describe IsoDoc do
975
1003
 
976
1004
  it "moves images in HTML with no file suffix" do
977
1005
  FileUtils.rm_f "test.html"
978
- FileUtils.rm_rf "test_htmlimages"
1006
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
979
1007
  IsoDoc::HtmlConvert.new(
980
1008
  { wordstylesheet: "spec/assets/word.css",
981
1009
  htmlstylesheet: "spec/assets/html.scss" },
@@ -994,8 +1022,9 @@ RSpec.describe IsoDoc do
994
1022
  html = File.read("test.html")
995
1023
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
996
1024
  .sub(%r{</main>.*$}m, "</main>")
997
- expect(`ls test_htmlimages`).to match(/\.png$/)
998
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
1025
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
1026
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
1027
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
999
1028
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
1000
1029
  <main class='main-section'>
1001
1030
  <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
@@ -1036,8 +1065,9 @@ RSpec.describe IsoDoc do
1036
1065
  html = File.read("spec/test.html")
1037
1066
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
1038
1067
  .sub(%r{</main>.*$}m, "</main>")
1039
- expect(`ls test_htmlimages`).to match(/\.png$/)
1040
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
1068
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
1069
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
1070
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
1041
1071
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
1042
1072
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1043
1073
  <br />
@@ -1057,7 +1087,7 @@ RSpec.describe IsoDoc do
1057
1087
 
1058
1088
  it "encodes images in HTML as data URIs" do
1059
1089
  FileUtils.rm_f "test.html"
1060
- FileUtils.rm_rf "test_htmlimages"
1090
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
1061
1091
  IsoDoc::HtmlConvert
1062
1092
  .new(htmlstylesheet: "spec/assets/html.scss", datauriimage: true)
1063
1093
  .convert("test", <<~"INPUT", false)
@@ -1093,7 +1123,7 @@ RSpec.describe IsoDoc do
1093
1123
 
1094
1124
  it "encodes images in HTML as data URIs, using relative file location" do
1095
1125
  FileUtils.rm_f "spec/test.html"
1096
- FileUtils.rm_rf "spec/test_htmlimages"
1126
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
1097
1127
  IsoDoc::HtmlConvert
1098
1128
  .new({ htmlstylesheet: "assets/html.scss", datauriimage: true })
1099
1129
  .convert("spec/test", <<~"INPUT", false)
@@ -717,49 +717,220 @@ RSpec.describe IsoDoc do
717
717
  </annex>
718
718
  </iso-standard>
719
719
  INPUT
720
- output = <<~OUTPUT
721
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
722
- <bibdata/>
723
- <sections>
724
- <clause id='_' inline-header='false' obligation='normative' displayorder='1'>
725
- <title depth='1'>
726
- <strong>Annex A</strong>
727
- <br/>
728
- (normative).
729
- <tab/>
730
- Clause
731
- </title>
732
- <p id='_'>Text</p>
733
- <clause id='_' inline-header='false' obligation='normative'>
734
- <title depth='1'>
735
- <strong>Annex A</strong>
736
- <br/>
737
- (normative).
738
- <tab/>
739
- Subclause
740
- </title>
741
- <variant-title variant_title='true' type='sub' id='_'>&#x201C;A&#x201D; &#x2018;B&#x2019;</variant-title>
742
- <p id='_'>Text</p>
743
- </clause>
744
- </clause>
745
- </sections>
746
- <annex id='_' inline-header='false' obligation='normative' displayorder='2'>
747
- <title>
748
- <strong>Annex A</strong>
749
- <br/>
750
- (normative)
720
+ presxml = <<~OUTPUT
721
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
722
+ <bibdata/>
723
+ <sections>
724
+ <clause id='_' inline-header='false' obligation='normative' displayorder='1'>
725
+ <title depth='1'>
726
+ <strong>Annex A</strong>
727
+ <br/>
728
+ (normative).
729
+ <tab/>
730
+ Clause
731
+ </title>
732
+ <p id='_'>Text</p>
733
+ <clause id='_' inline-header='false' obligation='normative'>
734
+ <title depth='1'>
735
+ <strong>Annex A</strong>
736
+ <br/>
737
+ (normative).
738
+ <tab/>
739
+ Subclause
740
+ </title>
741
+ <variant-title variant_title='true' type='sub' id='_'>&#x201C;A&#x201D; &#x2018;B&#x2019;</variant-title>
742
+ <variant-title variant_title='true' type='toc' id='_'>
743
+ Clause
744
+ <em>A</em>
745
+ <stem type='MathML'>
746
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
747
+ <mi>x</mi>
748
+ </math>
749
+ <!-- x -->
750
+ </stem>
751
+ </variant-title>
752
+ <p id='_'>Text</p>
753
+ </clause>
754
+ </clause>
755
+ </sections>
756
+ <annex id='_' inline-header='false' obligation='normative' displayorder='2'>
757
+ <title>
758
+ <strong>Annex A</strong>
759
+ <br/>
760
+ (normative)
761
+ <br/>
762
+ <br/>
763
+ <strong>Clause</strong>
764
+ </title>
765
+ <variant-title variant_title='true' type='toc' id='_'>
766
+ Clause
767
+ <em>A</em>
768
+ <stem type='MathML'>
769
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
770
+ <mi>x</mi>
771
+ </math>
772
+ <!-- x -->
773
+ </stem>
774
+ </variant-title>
775
+ <p id='_'>Text</p>
776
+ </annex>
777
+ </iso-standard>
778
+ OUTPUT
779
+ html = <<~OUTPUT
780
+ <html lang='en'>
781
+ <head/>
782
+ <body lang='en'>
783
+ <div class='title-section'>
784
+ <p>&#160;</p>
785
+ </div>
751
786
  <br/>
787
+ <div class='prefatory-section'>
788
+ <p>&#160;</p>
789
+ </div>
752
790
  <br/>
753
- <strong>Clause</strong>
754
- </title>
755
- <p id='_'>Text</p>
756
- </annex>
757
- </iso-standard>
791
+ <div class='main-section'>
792
+ <p class='zzSTDTitle1'/>
793
+ <div id='_'>
794
+ <h1>
795
+ <b>Annex A</b>
796
+ <br/>
797
+ (normative). &#160; Clause
798
+ </h1>
799
+ <p id='_'>Text</p>
800
+ <div id='_'>
801
+ <h1>
802
+ <b>Annex A</b>
803
+ <br/>
804
+ (normative). &#160; Subclause
805
+ <br/>
806
+ <br/>
807
+ &#8220;A&#8221; &#8216;B&#8217;
808
+ </h1>
809
+ <p style='display:none;' class='variant-title-toc'>
810
+ Clause
811
+ <i>A</i>
812
+ <span class='stem'>
813
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
814
+ <mi>x</mi>
815
+ </math>
816
+ </span>
817
+ </p>
818
+ <p id='_'>Text</p>
819
+ </div>
820
+ </div>
821
+ <br/>
822
+ <div id='_' class='Section3'>
823
+ <h1 class='Annex'>
824
+ <b>Annex A</b>
825
+ <br/>
826
+ (normative)
827
+ <br/>
828
+ <br/>
829
+ <b>Clause</b>
830
+ </h1>
831
+ <p style='display:none;' class='variant-title-toc'>
832
+ Clause
833
+ <i>A</i>
834
+ <span class='stem'>
835
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
836
+ <mi>x</mi>
837
+ </math>
838
+ </span>
839
+ </p>
840
+ <p id='_'>Text</p>
841
+ </div>
842
+ </div>
843
+ </body>
844
+ </html>
845
+ OUTPUT
846
+ doc = <<~OUTPUT
847
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
848
+ <head>
849
+ <style>
850
+ </style>
851
+ </head>
852
+ <body lang='EN-US' link='blue' vlink='#954F72'>
853
+ <div class='WordSection1'>
854
+ <p>&#160;</p>
855
+ </div>
856
+ <p>
857
+ <br clear='all' class='section'/>
858
+ </p>
859
+ <div class='WordSection2'>
860
+ <p>&#160;</p>
861
+ </div>
862
+ <p>
863
+ <br clear='all' class='section'/>
864
+ </p>
865
+ <div class='WordSection3'>
866
+ <p class='zzSTDTitle1'/>
867
+ <div id='_'>
868
+ <h1>
869
+ <b>Annex A</b>
870
+ <br/>
871
+ (normative).
872
+ <span style='mso-tab-count:1'>&#160; </span>
873
+ Clause
874
+ </h1>
875
+ <p id='_'>Text</p>
876
+ <div id='_'>
877
+ <h1>
878
+ <b>Annex A</b>
879
+ <br/>
880
+ (normative).
881
+ <span style='mso-tab-count:1'>&#160; </span>
882
+ Subclause
883
+ <br/>
884
+ <br/>
885
+ &#8220;A&#8221; &#8216;B&#8217;
886
+ </h1>
887
+ <p style='display:none;' class='variant-title-toc'>
888
+ Clause
889
+ <i>A</i>
890
+ <span class='stem'>
891
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
892
+ <mi>x</mi>
893
+ </math>
894
+ </span>
895
+ </p>
896
+ <p id='_'>Text</p>
897
+ </div>
898
+ </div>
899
+ <p>
900
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
901
+ </p>
902
+ <div id='_' class='Section3'>
903
+ <h1 class='Annex'>
904
+ <b>Annex A</b>
905
+ <br/>
906
+ (normative)
907
+ <br/>
908
+ <br/>
909
+ <b>Clause</b>
910
+ </h1>
911
+ <p style='display:none;' class='variant-title-toc'>
912
+ Clause
913
+ <i>A</i>
914
+ <span class='stem'>
915
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
916
+ <mi>x</mi>
917
+ </math>
918
+ </span>
919
+ </p>
920
+ <p id='_'>Text</p>
921
+ </div>
922
+ </div>
923
+ </body>
924
+ </html>
758
925
  OUTPUT
759
926
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
760
927
  .convert("test", input, true))
761
928
  .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
762
- .to be_equivalent_to xmlpp(output)
929
+ .to be_equivalent_to xmlpp(presxml)
930
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
931
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
932
+ expect(xmlpp(IsoDoc::WordConvert.new({})
933
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
763
934
  end
764
935
 
765
936
  it "duplicates EMF and SVG files" do