isodoc 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 271b0b210ccc7da3e9b0a09cf49fb248ff4708fd4f92adfb5529683db655fe63
4
- data.tar.gz: 4345484709eba0f0ac06dc772fd62455c0f601c2f36c57b0ae1d8fdade47dbdd
3
+ metadata.gz: d6ad84f6e1f4b2fecf5c4590753f75c868580b8472b91a0c31310a7b0b9d8026
4
+ data.tar.gz: dedfd107403cfb17fd117bc6e30c2604b2fe2dcfdec40e6d70a3265edb2cf43a
5
5
  SHA512:
6
- metadata.gz: 80a4d6a127130129671f6553283d7a09b2afb8f69756435cc5e20381309a92b5edd055eda730b10cf025fa6bb5169db65e38cff64cdfbf9d0dc20de415fe1f20
7
- data.tar.gz: b90a49e79bf3b1d03c15adfcaed42b2e64293ab161b6e585448487db29e40129f8994da57d8429130c54bc66dc73640f5ca929d285c7d3528e44b341150ca2b5
6
+ metadata.gz: f2198c67222766d9f78c23357dd836c005196ef18774f2e3886d32016466489b1370c12d210d0397cb2e61a0dd9d7fe38ab7421181eff43ee03eda40839c38fd
7
+ data.tar.gz: 9b24ca85c9da14e7dcf255df3f9e84cb63788c9b66beea94bd7a2c4d52631c8747547b0f347640dcdd6985b1bbc1474835a249dd9281d5f763892d85945f8a02
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (0.9.1)
4
+ isodoc (0.9.3)
5
5
  asciimath
6
6
  html2doc (~> 0.8.1)
7
7
  htmlentities (~> 4.3.4)
@@ -17,7 +17,7 @@ PATH
17
17
  GEM
18
18
  remote: https://rubygems.org/
19
19
  specs:
20
- asciimath (1.0.5)
20
+ asciimath (1.0.6)
21
21
  ast (2.4.0)
22
22
  byebug (9.1.0)
23
23
  coderay (1.1.2)
@@ -41,7 +41,7 @@ GEM
41
41
  guard (~> 2.1)
42
42
  guard-compat (~> 1.1)
43
43
  rspec (>= 2.99.0, < 4.0)
44
- html2doc (0.8.3)
44
+ html2doc (0.8.5)
45
45
  asciimath
46
46
  htmlentities (~> 4.3.4)
47
47
  image_size
@@ -67,7 +67,7 @@ GEM
67
67
  mime-types-data (3.2018.0812)
68
68
  mini_portile2 (2.3.0)
69
69
  nenv (0.3.0)
70
- nokogiri (1.8.4)
70
+ nokogiri (1.8.5)
71
71
  mini_portile2 (~> 2.3.0)
72
72
  notiffany (0.1.1)
73
73
  nenv (~> 0.1)
@@ -98,7 +98,7 @@ GEM
98
98
  diff-lcs (>= 1.2.0, < 2.0)
99
99
  rspec-support (~> 3.8.0)
100
100
  rspec-support (3.8.0)
101
- rubocop (0.59.1)
101
+ rubocop (0.59.2)
102
102
  jaro_winkler (~> 1.5.1)
103
103
  parallel (~> 1.10)
104
104
  parser (>= 2.5, != 2.5.1.1)
@@ -109,7 +109,7 @@ GEM
109
109
  ruby-progressbar (1.10.0)
110
110
  ruby-xslt (0.9.10)
111
111
  ruby_dep (1.5.0)
112
- sass (3.5.7)
112
+ sass (3.6.0)
113
113
  sass-listen (~> 4.0.0)
114
114
  sass-listen (4.0.0)
115
115
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -1,5 +1,6 @@
1
1
  require "isodoc/common"
2
2
  require "sassc"
3
+ require "fileutils"
3
4
 
4
5
  module IsoDoc
5
6
  class Convert < ::IsoDoc::Common
@@ -148,7 +149,7 @@ module IsoDoc
148
149
  result = convert1(docxml, filename, dir)
149
150
  return result if debug
150
151
  postprocess(result, filename, dir)
151
- system "rm -fr #{dir}"
152
+ FileUtils.rm_rf dir
152
153
  end
153
154
  end
154
155
  end
@@ -151,6 +151,10 @@ module IsoDoc::Function
151
151
  div << "(#{get_anchors[node['id']][:label]})"
152
152
  end
153
153
  formula_where(node.at(ns("./dl")), out)
154
+ node.children.each do |n|
155
+ next if %w(stem dl).include? n.name
156
+ parse(n, out)
157
+ end
154
158
  end
155
159
 
156
160
  def para_attrs(node)
@@ -1,3 +1,5 @@
1
+ require "fileutils"
2
+
1
3
  module IsoDoc::Function
2
4
  module ToWordHtml
3
5
 
@@ -18,7 +20,7 @@ module IsoDoc::Function
18
20
  dir = "#{filename}_files"
19
21
  unless debug
20
22
  Dir.mkdir(dir) unless File.exists?(dir)
21
- system "rm -r #{dir}/*"
23
+ FileUtils.rm_rf "#{dir}/*"
22
24
  end
23
25
  @filename = filename
24
26
  [filename, dir]
@@ -1,6 +1,7 @@
1
1
  require_relative "html_function/comments.rb"
2
2
  require_relative "html_function/footnotes.rb"
3
3
  require_relative "html_function/html.rb"
4
+ require "fileutils"
4
5
 
5
6
  module IsoDoc
6
7
  class HeadlessHtmlConvert < ::IsoDoc::Convert
@@ -21,9 +22,9 @@ module IsoDoc
21
22
  result = convert1(docxml, outname_html, dir)
22
23
  return result if debug
23
24
  postprocess(result, filename + ".tmp", dir)
24
- system "rm -fr #{dir}"
25
+ FileUtils.rm_rf dir
25
26
  strip_head(filename + ".tmp.html", outname_html + ".headless.html")
26
- system "rm -r #{filename + '.tmp.html'} #{tmpimagedir}"
27
+ FileUtils.rm_r ["#{filename}.tmp.html", tmpimagedir]
27
28
  end
28
29
 
29
30
  def strip_head(input, output)
@@ -31,7 +31,7 @@ module IsoDoc::HtmlFunction
31
31
  def postprocess(result, filename, dir)
32
32
  result = from_xhtml(cleanup(to_xhtml(result)))
33
33
  toHTML(result, filename)
34
- @files_to_delete.each { |f| system "rm -r #{f}" }
34
+ @files_to_delete.each { |f| FileUtils.rm_r f }
35
35
  end
36
36
 
37
37
  def script_cdata(result)
@@ -193,7 +193,8 @@ module IsoDoc::HtmlFunction
193
193
 
194
194
  # presupposes that the image source is local
195
195
  def move_images(docxml)
196
- system "rm -r #{tmpimagedir}; mkdir #{tmpimagedir}"
196
+ FileUtils.rm_rf tmpimagedir
197
+ FileUtils.mkdir tmpimagedir
197
198
  docxml.xpath("//*[local-name() = 'img']").each do |i|
198
199
  next if /^data:image/.match i["src"]
199
200
  @datauriimage ? datauri(i) : move_image1(i)
@@ -26,9 +26,9 @@ module IsoDoc
26
26
  result = convert1(docxml, filename, dir)
27
27
  return result if debug
28
28
  postprocess(result, filename, dir)
29
- system "rm -fr #{dir}"
29
+ FileUtils.rm_rf dir
30
30
  ::Metanorma::Output::Pdf.new.convert(filename + ".html", outname_html + ".pdf")
31
- system "rm -r #{filename + '.html'} #{tmpimagedir}"
31
+ FileUtils.rm_r ["#{filename}.html", tmpimagedir]
32
32
  end
33
33
  end
34
34
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.9.2".freeze
2
+ VERSION = "0.9.3".freeze
3
3
  end
@@ -117,7 +117,7 @@ module IsoDoc::WordFunction
117
117
  def dl_parse_notes(node, v)
118
118
  return if node.elements.reject { |n| dt_dd? n }.empty?
119
119
  v.tr do |tr|
120
- tr.td **{ rowspan: 2 } do |td|
120
+ tr.td **{ colspan: 2 } do |td|
121
121
  node.elements.reject { |n| dt_dd? n }.each { |n| parse(n, td) }
122
122
  end
123
123
  end
@@ -1,3 +1,5 @@
1
+ require "fileutils"
2
+
1
3
  module IsoDoc::WordFunction
2
4
  module Postprocess
3
5
  def table_note_cleanup(docxml)
@@ -13,7 +15,7 @@ module IsoDoc::WordFunction
13
15
  header = generate_header(filename, dir)
14
16
  result = from_xhtml(cleanup(to_xhtml(result)))
15
17
  toWord(result, filename, dir, header)
16
- @files_to_delete.each { |f| system "rm #{f}" }
18
+ @files_to_delete.each { |f| FileUtils.rm f }
17
19
  end
18
20
 
19
21
  def toWord(result, filename, dir, header)
@@ -28,9 +30,21 @@ module IsoDoc::WordFunction
28
30
  def word_cleanup(docxml)
29
31
  word_preface(docxml)
30
32
  word_annex_cleanup(docxml)
33
+ word_table_separator(docxml)
31
34
  docxml
32
35
  end
33
36
 
37
+ EMPTY_PARA = "<p style='margin-top:0cm;margin-right:0cm;"\
38
+ "margin-bottom:0cm;margin-left:0.0pt;margin-bottom:.0001pt'>"\
39
+ "<span lang=EN-GB style='display:none;mso-hide:all'>&nbsp;</span></p>"
40
+
41
+ def word_table_separator(docxml)
42
+ docxml.xpath("//table").each do |t|
43
+ next unless t&.next_element&.name == "table"
44
+ t.add_next_sibling(EMPTY_PARA)
45
+ end
46
+ end
47
+
34
48
  # force Annex h2 to be p.h2Annex, so it is not picked up by ToC
35
49
  def word_annex_cleanup(docxml)
36
50
  docxml.xpath("//h2[ancestor::*[@class = 'Section3']]").each do |h2|
@@ -503,7 +503,11 @@ INPUT
503
503
  <dd>
504
504
  <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
505
505
  </dd>
506
- </dl></formula>
506
+ </dl>
507
+ <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
508
+ <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>
509
+ </note>
510
+ </formula>
507
511
  </foreword></preface>
508
512
  </iso-standard>
509
513
  INPUT
@@ -511,17 +515,16 @@ INPUT
511
515
  <br/>
512
516
  <div>
513
517
  <h1 class="ForewordTitle">Foreword</h1>
514
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</div>
515
- <p>where</p>
516
- <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
517
- <dt>
518
+ <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</div><p>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d"><dt>
518
519
  <span class="stem">(#(r)#)</span>
519
- </dt>
520
- <dd>
520
+ </dt><dd>
521
521
  <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
522
- </dd>
523
- </dl>
524
- </div>
522
+ </dd></dl>
523
+
524
+
525
+ <div id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0" class="Note"><p><span class="note_label">NOTE</span>&#160; [durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p></div>
526
+ </div>
527
+
525
528
  <p class="zzSTDTitle1"/>
526
529
  </div>
527
530
  </body>
@@ -1,4 +1,5 @@
1
1
  require "spec_helper"
2
+ require "fileutils"
2
3
 
3
4
  RSpec.describe IsoDoc do
4
5
  it "processes IsoXML footnotes" do
@@ -91,7 +92,7 @@ RSpec.describe IsoDoc do
91
92
  end
92
93
 
93
94
  it "processes IsoXML reviewer notes" do
94
- system "rm -f test.html"
95
+ FileUtils.rm_f "test.html"
95
96
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
96
97
  <iso-standard xmlns="http://riboseinc.com/isoxml">
97
98
  <preface>
@@ -186,7 +187,7 @@ RSpec.describe IsoDoc do
186
187
  end
187
188
 
188
189
  it "processes IsoXML reviewer notes (Word)" do
189
- system "rm -f test.doc"
190
+ FileUtils.rm_f "test.doc"
190
191
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
191
192
  <iso-standard xmlns="http://riboseinc.com/isoxml">
192
193
  <preface>
@@ -226,7 +226,7 @@ RSpec.describe IsoDoc do
226
226
  </td>
227
227
  </tr>
228
228
  <tr>
229
- <td rowspan="2">
229
+ <td colspan="2">
230
230
  <div id="" class="Note">
231
231
  <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>This is a note</p>
232
232
  </div>
@@ -1,9 +1,10 @@
1
1
  require "spec_helper"
2
+ require "fileutils"
2
3
 
3
4
  RSpec.describe IsoDoc do
4
5
  it "generates file based on string input" do
5
- system "rm -f test.doc"
6
- system "rm -f test.html"
6
+ FileUtils.rm_f "test.doc"
7
+ FileUtils.rm_f "test.html"
7
8
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", filename: "test"}).convert("test", <<~"INPUT", false)
8
9
  <iso-standard xmlns="http://riboseinc.com/isoxml">
9
10
  <bibdata>
@@ -25,8 +26,8 @@ RSpec.describe IsoDoc do
25
26
  end
26
27
 
27
28
  it "generates HTML output docs with null configuration" do
28
- system "rm -f test.doc"
29
- system "rm -f test.html"
29
+ FileUtils.rm_f "test.doc"
30
+ FileUtils.rm_f "test.html"
30
31
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css"}).convert("test", <<~"INPUT", false)
31
32
  <iso-standard xmlns="http://riboseinc.com/isoxml">
32
33
  <preface><foreword>
@@ -45,8 +46,8 @@ RSpec.describe IsoDoc do
45
46
  end
46
47
 
47
48
  it "generates Word output docs with null configuration" do
48
- system "rm -f test.doc"
49
- system "rm -f test.html"
49
+ FileUtils.rm_f "test.doc"
50
+ FileUtils.rm_f "test.html"
50
51
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
51
52
  <iso-standard xmlns="http://riboseinc.com/isoxml">
52
53
  <preface><foreword>
@@ -62,8 +63,8 @@ RSpec.describe IsoDoc do
62
63
  end
63
64
 
64
65
  it "generates HTML output docs with null configuration from file" do
65
- system "rm -f spec/assets/iso.doc"
66
- system "rm -f spec/assets/iso.html"
66
+ FileUtils.rm_f "spec/assets/iso.doc"
67
+ FileUtils.rm_f "spec/assets/iso.html"
67
68
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
68
69
  expect(File.exist?("spec/assets/iso.html")).to be true
69
70
  html = File.read("spec/assets/iso.html")
@@ -72,8 +73,8 @@ RSpec.describe IsoDoc do
72
73
  expect(html).to match(%r{libs/jquery})
73
74
  end
74
75
 
75
- it "generates Headless HTML output docs with null configuration from file" do
76
- system "rm -f spec/assets/iso.html"
76
+ it "generates Headless HTML output docs with null configuration from file" do
77
+ FileUtils.rm_f "spec/assets/iso.html"
77
78
  IsoDoc::HeadlessHtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
78
79
  expect(File.exist?("spec/assets/iso.headless.html")).to be true
79
80
  html = File.read("spec/assets/iso.headless.html")
@@ -87,7 +88,7 @@ RSpec.describe IsoDoc do
87
88
  end
88
89
 
89
90
  it "generates Word output docs with null configuration from file" do
90
- system "rm -f spec/assets/iso.doc"
91
+ FileUtils.rm_f "spec/assets/iso.doc"
91
92
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
92
93
  expect(File.exist?("spec/assets/iso.doc")).to be true
93
94
  word = File.read("spec/assets/iso.doc")
@@ -95,15 +96,14 @@ RSpec.describe IsoDoc do
95
96
  end
96
97
 
97
98
  it "generates PDF output docs with null configuration from file" do
98
- system "rm -f spec/assets/iso.pdf"
99
- #require "byebug"; byebug
99
+ FileUtils.rm_f "spec/assets/iso.pdf"
100
100
  IsoDoc::PdfConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("spec/assets/iso.xml", nil, false)
101
101
  expect(File.exist?("spec/assets/iso.pdf")).to be true
102
102
  end
103
103
 
104
104
  it "generates HTML output docs with complete configuration" do
105
- system "rm -f test.doc"
106
- system "rm -f test.html"
105
+ FileUtils.rm_f "test.doc"
106
+ FileUtils.rm_f "test.html"
107
107
  IsoDoc::HtmlConvert.new({bodyfont: "Zapf", htmlstylesheet: "spec/assets/html.css", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
108
108
  <iso-standard xmlns="http://riboseinc.com/isoxml">
109
109
  <preface><foreword>
@@ -124,8 +124,8 @@ RSpec.describe IsoDoc do
124
124
  end
125
125
 
126
126
  it "generates HTML output docs with default fonts" do
127
- system "rm -f test.doc"
128
- system "rm -f test.html"
127
+ FileUtils.rm_f "test.doc"
128
+ FileUtils.rm_f "test.html"
129
129
  IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", htmlcoverpage: "spec/assets/htmlcover.html", htmlintropage: "spec/assets/htmlintro.html", scripts: "spec/assets/scripts.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
130
130
  <iso-standard xmlns="http://riboseinc.com/isoxml">
131
131
  <preface><foreword>
@@ -146,8 +146,8 @@ RSpec.describe IsoDoc do
146
146
  end
147
147
 
148
148
  it "generates Word output docs with complete configuration" do
149
- system "rm -f test.doc"
150
- system "rm -f test.html"
149
+ FileUtils.rm_f "test.doc"
150
+ FileUtils.rm_f "test.html"
151
151
  IsoDoc::WordConvert.new({bodyfont: "Zapf", wordstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
152
152
  <iso-standard xmlns="http://riboseinc.com/isoxml">
153
153
  <preface><foreword>
@@ -169,8 +169,8 @@ RSpec.describe IsoDoc do
169
169
  end
170
170
 
171
171
  it "generates Word output docs with default fonts" do
172
- system "rm -f test.doc"
173
- system "rm -f test.html"
172
+ FileUtils.rm_f "test.doc"
173
+ FileUtils.rm_f "test.html"
174
174
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/html.css", standardstylesheet: "spec/assets/std.css", header: "spec/assets/header.html", wordcoverpage: "spec/assets/wordcover.html", wordintropage: "spec/assets/wordintro.html", i18nyaml: "spec/assets/i18n.yaml", ulstyle: "l1", olstyle: "l2"}).convert("test", <<~"INPUT", false)
175
175
  <iso-standard xmlns="http://riboseinc.com/isoxml">
176
176
  <preface><foreword>
@@ -192,8 +192,8 @@ RSpec.describe IsoDoc do
192
192
  end
193
193
 
194
194
  it "converts definition lists to tables for Word" do
195
- system "rm -f test.doc"
196
- system "rm -f test.html"
195
+ FileUtils.rm_f "test.doc"
196
+ FileUtils.rm_f "test.html"
197
197
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
198
198
  <iso-standard xmlns="http://riboseinc.com/isoxml">
199
199
  <preface><foreword>
@@ -234,8 +234,8 @@ RSpec.describe IsoDoc do
234
234
  end
235
235
 
236
236
  it "converts annex subheadings to h2Annex class for Word" do
237
- system "rm -f test.doc"
238
- system "rm -f test.html"
237
+ FileUtils.rm_f "test.doc"
238
+ FileUtils.rm_f "test.html"
239
239
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
240
240
  <iso-standard xmlns="http://riboseinc.com/isoxml">
241
241
  <annex id="P" inline-header="false" obligation="normative">
@@ -262,9 +262,52 @@ RSpec.describe IsoDoc do
262
262
  OUTPUT
263
263
  end
264
264
 
265
+ it "inserts default paragraph between two tables for Word" do
266
+ FileUtils.rm_f "test.doc"
267
+ FileUtils.rm_f "test.html"
268
+ IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
269
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
270
+ <annex id="P" inline-header="false" obligation="normative">
271
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851c">
272
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c968">'1M', '01M', and '0001M' all describe the calendar month January.</p>
273
+ </example>
274
+ <example id="_63112cbc-cde0-435f-9553-e0b8c4f5851d">
275
+ <p id="_158d4efa-b1c9-4aec-b325-756de8e4c969">'2M', '02M', and '0002M' all describe the calendar month February.</p>
276
+ </example>
277
+ </annex>
278
+ </iso-standard>
279
+ INPUT
280
+ word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
281
+ sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
282
+ expect(word).to be_equivalent_to <<~"OUTPUT"
283
+ <div class="WordSection3">
284
+ <p class="zzSTDTitle1"></p>
285
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
286
+ <div class="Section3"><a name="P" id="P"></a>
287
+ <table class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
288
+ <tr>
289
+ <td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 1</td>
290
+ <td valign="top" class="example">
291
+ <p class="example"><a name="_158d4efa-b1c9-4aec-b325-756de8e4c968" id="_158d4efa-b1c9-4aec-b325-756de8e4c968"></a>'1M', '01M', and '0001M' all describe the calendar month January.</p>
292
+ </td>
293
+ </tr>
294
+ </table><p style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:0.0pt;margin-bottom:.0001pt" class="MsoNormal"><span lang="EN-GB" style="display:none;mso-hide:all" xml:lang="EN-GB">&#xA0;</span></p>
295
+ <table class="example"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
296
+ <tr>
297
+ <td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 2</td>
298
+ <td valign="top" class="example">
299
+ <p class="example"><a name="_158d4efa-b1c9-4aec-b325-756de8e4c969" id="_158d4efa-b1c9-4aec-b325-756de8e4c969"></a>'2M', '02M', and '0002M' all describe the calendar month February.</p>
300
+ </td>
301
+ </tr>
302
+ </table>
303
+ </div>
304
+ </div>
305
+ OUTPUT
306
+ end
307
+
265
308
  it "populates Word template with terms reference labels" do
266
- system "rm -f test.doc"
267
- system "rm -f test.html"
309
+ FileUtils.rm_f "test.doc"
310
+ FileUtils.rm_f "test.html"
268
311
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
269
312
  <iso-standard xmlns="http://riboseinc.com/isoxml">
270
313
  <sections>
@@ -294,12 +337,12 @@ RSpec.describe IsoDoc do
294
337
  <p class="MsoNormal">ISO and IEC maintain terminological databases for use in
295
338
  standardization at the following addresses:</p>
296
339
 
297
- <ul>
298
- <li class="MsoNormal"> <p class="MsoNormal">ISO Online browsing platform: available at
299
- <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
300
- <li class="MsoNormal"> <p class="MsoNormal">IEC Electropedia: available at
340
+ <p class="MsoListParagraphCxSpFirst"> ISO Online browsing platform: available at
341
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a> </p>
342
+ <p class="MsoListParagraphCxSpLast"> IEC Electropedia: available at
343
+
301
344
  <a href="http://www.electropedia.org">http://www.electropedia.org</a>
302
- </p> </li> </ul>
345
+ </p>
303
346
  <p class="TermNum"><a name="paddy1" id="paddy1"></a>1.1</p><p class="Terms" style="text-align:left;">paddy</p>
304
347
  <p class="MsoNormal"><a name="_eb29b35e-123e-4d1c-b50b-2714d41e747f" id="_eb29b35e-123e-4d1c-b50b-2714d41e747f"></a>rice retaining its husk after threshing</p>
305
348
  <p class="MsoNormal">[SOURCE: <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>, modified &mdash; The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here]</p></div>
@@ -308,7 +351,7 @@ RSpec.describe IsoDoc do
308
351
  end
309
352
 
310
353
  it "populates Word header" do
311
- system "rm -f test.doc"
354
+ FileUtils.rm_f "test.doc"
312
355
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", header: "spec/assets/header.html"}).convert("test", <<~"INPUT", false)
313
356
  <iso-standard xmlns="http://riboseinc.com/isoxml">
314
357
  <bibdata type="article">
@@ -334,7 +377,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
334
377
  end
335
378
 
336
379
  it "populates Word ToC" do
337
- system "rm -f test.doc"
380
+ FileUtils.rm_f "test.doc"
338
381
  IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
339
382
  <iso-standard xmlns="http://riboseinc.com/isoxml">
340
383
  <sections>
@@ -413,7 +456,7 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
413
456
  end
414
457
 
415
458
  it "reorders footnote numbers in HTML" do
416
- system "rm -f test.html"
459
+ FileUtils.rm_f "test.html"
417
460
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css", wordintropage: "spec/assets/wordintro.html"}).convert("test", <<~"INPUT", false)
418
461
  <iso-standard xmlns="http://riboseinc.com/isoxml">
419
462
  <sections>
@@ -467,8 +510,8 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
467
510
  end
468
511
 
469
512
  it "moves images in HTML" do
470
- system "rm -f test.html"
471
- system "rm -rf test_images"
513
+ FileUtils.rm_f "test.html"
514
+ FileUtils.rm_rf "test_images"
472
515
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
473
516
  <iso-standard xmlns="http://riboseinc.com/isoxml">
474
517
  <preface><foreword>
@@ -502,8 +545,8 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
502
545
  end
503
546
 
504
547
  it "encodes images in HTML as data URIs" do
505
- system "rm -f test.html"
506
- system "rm -rf test_images"
548
+ FileUtils.rm_f "test.html"
549
+ FileUtils.rm_rf "test_images"
507
550
  IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", datauriimage: true}).convert("test", <<~"INPUT", false)
508
551
  <iso-standard xmlns="http://riboseinc.com/isoxml">
509
552
  <preface><foreword>
@@ -532,8 +575,8 @@ CkZJTEVOQU1FOiB0ZXN0Cgo=
532
575
  end
533
576
 
534
577
  it "processes IsoXML terms for HTML" do
535
- system "rm -f test.doc"
536
- system "rm -f test.html"
578
+ FileUtils.rm_f "test.html"
579
+ FileUtils.rm_f "test.doc"
537
580
  IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
538
581
  <iso-standard xmlns="http://riboseinc.com/isoxml">
539
582
  <sections>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-22 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath