isodoc 0.9.13 → 0.9.14

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: 945e78a0cc8b1efc187b862f368b0ce1290e613bb6fda7a66c66aac003c7431d
4
- data.tar.gz: 59f446c8cd4d8e2a82292c22d154de3dcd9f398086f9f33f8455a2dc62f027b9
3
+ metadata.gz: fdc97bb8b0273bcadd49568513afb7e6c51b3fd39ff3582970c53864796853ac
4
+ data.tar.gz: 0053af9a809510c386f457cd24fc3f335f0c0a5ce4133a5e1690a65f445b5408
5
5
  SHA512:
6
- metadata.gz: 8bddacabfb2f52f3200d338b7c7fae3f5497df524a87e49fe7623785dd9acd468ac78d77b62e968c090ef40b12f7faae92a67367326e06c7c66ef2aa4217b09f
7
- data.tar.gz: 6d70b11d7058cfa38d9d467853003e3ccf994591969c81f38092490aa2e1399e1a2e091e2b1738e1cf89e62163916fa9b8d3be94c0c2595d8c099987764dd16b
6
+ metadata.gz: 24be2aec8eee91daf0842e23174dab29cfa472f7ce590abd706da6dd21324379cab0aa0a4ac40cb399aae9cbc7f9e5c31ff226c9fd286d911b35ee89d21d202e
7
+ data.tar.gz: 5fd9757242a5b781f297f84434c5c6f4b6e8d789916e9f7d7c1338a80ea75750ff6fe643985b8f4f64bdbf4e2694846a38ec8d4edb367deb99df0cc151d18a6c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- isodoc (0.9.13)
4
+ isodoc (0.9.14)
5
5
  asciimath
6
6
  html2doc (~> 0.8.6)
7
7
  htmlentities (~> 4.3.4)
@@ -19,7 +19,7 @@ GEM
19
19
  remote: https://rubygems.org/
20
20
  specs:
21
21
  asciidoctor (1.5.8)
22
- asciimath (1.0.6)
22
+ asciimath (1.0.7)
23
23
  ast (2.4.0)
24
24
  byebug (9.1.0)
25
25
  coderay (1.1.2)
@@ -43,8 +43,8 @@ GEM
43
43
  guard (~> 2.1)
44
44
  guard-compat (~> 1.1)
45
45
  rspec (>= 2.99.0, < 4.0)
46
- html2doc (0.8.6)
47
- asciimath
46
+ html2doc (0.8.8)
47
+ asciimath (~> 1.0.7)
48
48
  htmlentities (~> 4.3.4)
49
49
  image_size
50
50
  mime-types
@@ -69,7 +69,7 @@ GEM
69
69
  mime-types-data (3.2018.0812)
70
70
  mini_portile2 (2.4.0)
71
71
  nenv (0.3.0)
72
- nokogiri (1.9.1)
72
+ nokogiri (1.10.0)
73
73
  mini_portile2 (~> 2.4.0)
74
74
  notiffany (0.1.1)
75
75
  nenv (~> 0.1)
@@ -110,7 +110,7 @@ GEM
110
110
  ruby-progressbar (1.10.0)
111
111
  ruby-xslt (0.9.10)
112
112
  ruby_dep (1.5.0)
113
- sass (3.7.2)
113
+ sass (3.7.3)
114
114
  sass-listen (~> 4.0.0)
115
115
  sass-listen (4.0.0)
116
116
  rb-fsevent (~> 0.9, >= 0.9.4)
@@ -127,14 +127,14 @@ GEM
127
127
  thor (0.20.3)
128
128
  thread_safe (0.3.6)
129
129
  timecop (0.9.1)
130
- unicode-display_width (1.4.0)
130
+ unicode-display_width (1.4.1)
131
131
  uuidtools (2.1.5)
132
132
 
133
133
  PLATFORMS
134
134
  ruby
135
135
 
136
136
  DEPENDENCIES
137
- bundler (~> 1.15)
137
+ bundler (~> 2.0.1)
138
138
  byebug (~> 9.1)
139
139
  equivalent-xml (~> 0.6)
140
140
  guard (~> 2.14)
@@ -146,4 +146,4 @@ DEPENDENCIES
146
146
  timecop (~> 0.9)
147
147
 
148
148
  BUNDLED WITH
149
- 1.17.2
149
+ 2.0.1
data/isodoc.gemspec CHANGED
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_dependency "metanorma", "~> 0.3.0"
42
42
  spec.add_dependency "rake", "~> 12.0"
43
43
 
44
- spec.add_development_dependency "bundler", "~> 1.15"
44
+ spec.add_development_dependency "bundler", "~> 2.0.1"
45
45
  spec.add_development_dependency "byebug", "~> 9.1"
46
46
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
47
47
  spec.add_development_dependency "guard", "~> 2.14"
@@ -83,7 +83,7 @@ module IsoDoc::Function
83
83
  # used if we are boxing examples
84
84
  def example_div_parse(node, out)
85
85
  out.div **attr_code(id: node["id"], class: "example") do |div|
86
- out.p { |p| p << example_label(node) }
86
+ div.p { |p| p << example_label(node) }
87
87
  node.children.each do |n|
88
88
  parse(n, div)
89
89
  end
@@ -76,9 +76,14 @@ module IsoDoc::Function
76
76
  end
77
77
 
78
78
  def reference_format(b, r)
79
- title = b.at(ns("./formattedref")) ||
80
- b.at(ns("./title[@language = '#{@language}']")) || b.at(ns("./title"))
81
- title&.children&.each { |n| parse(n, r) }
79
+ if ftitle = b.at(ns("./formattedref"))
80
+ ftitle&.children&.each { |n| parse(n, r) }
81
+ else
82
+ title = b.at(ns("./title[@language = '#{@language}']")) || b.at(ns("./title"))
83
+ r.i do |i|
84
+ title&.children&.each { |n| parse(n, i) }
85
+ end
86
+ end
82
87
  end
83
88
 
84
89
  # TODO generate formatted ref if not present
@@ -178,13 +183,13 @@ module IsoDoc::Function
178
183
  def format_ref(ref, prefix, isopub, date, allparts)
179
184
  if isopub
180
185
  #if date
181
- #on = date.at(ns("./on"))
182
- #ref += on&.text == "--" ? ":--" : "" # ":#{date_range(date)}"
183
- #ref += " (all parts)" if allparts
184
- # ref = docid_prefix(prefix, ref)
186
+ #on = date.at(ns("./on"))
187
+ #ref += on&.text == "--" ? ":--" : "" # ":#{date_range(date)}"
188
+ #ref += " (all parts)" if allparts
189
+ # ref = docid_prefix(prefix, ref)
185
190
  #end
186
191
  end
187
- ref = docid_prefix(prefix, ref)
192
+ ref = docid_prefix(prefix, ref)
188
193
  return "[#{ref}]" if /^\d+$/.match(ref) && !prefix && !/^\[.*\]$/.match(ref)
189
194
  ref
190
195
  end
@@ -182,12 +182,6 @@ module IsoDoc::Function
182
182
  text_parse(node, out)
183
183
  else
184
184
  case node.name
185
- #when "em" then out.i { |e| e << node.inner_html }
186
- #when "strong" then out.b { |e| e << node.inner_html }
187
- #when "sup" then out.sup { |e| e << node.inner_html }
188
- #when "sub" then out.sub { |e| e << node.inner_html }
189
- #when "tt" then out.tt { |e| e << node.inner_html }
190
- #when "strike" then out.s { |e| e << node.inner_html }
191
185
  when "em" then em_parse(node, out)
192
186
  when "strong" then strong_parse(node, out)
193
187
  when "sup" then sup_parse(node, out)
@@ -13,6 +13,7 @@ module IsoDoc::Function
13
13
  [1..n].each { out << "&nbsp; " }
14
14
  end
15
15
 
16
+ # add namespaces for Word fragments
16
17
  NOKOHEAD = <<~HERE.freeze
17
18
  <!DOCTYPE html SYSTEM
18
19
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -103,7 +104,7 @@ module IsoDoc::Function
103
104
  end
104
105
 
105
106
  def header_strip(h)
106
- h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[12][^>]*>/, "")
107
+ h = h.to_s.gsub(%r{<br/>}, " ").sub(/<\/?h[123456][^>]*>/, "")
107
108
  h1 = to_xhtml_fragment(h.dup)
108
109
  h1.traverse do |x|
109
110
  x.replace(" ") if x.name == "span" && /mso-tab-count/.match(x["style"])
@@ -180,6 +180,14 @@ module IsoDoc::Function
180
180
  end
181
181
  end
182
182
 
183
+ def hiersep
184
+ "."
185
+ end
186
+
187
+ def hierfigsep
188
+ "-"
189
+ end
190
+
183
191
  def hierarchical_figure_names(clause, num)
184
192
  i = j = 0
185
193
  clause.xpath(ns(".//figure")).each do |t|
@@ -188,21 +196,31 @@ module IsoDoc::Function
188
196
  j = 0
189
197
  i += 1
190
198
  end
191
- label = "#{num}.#{i}" + (j.zero? ? "" : "-#{j}")
199
+ label = "#{num}#{hiersep}#{i}" + (j.zero? ? "" : "#{hierfigsep}#{j}")
192
200
  next if t["id"].nil? || t["id"].empty?
193
201
  @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure")
194
202
  end
195
203
  end
196
204
 
197
- def hierarchical_asset_names(clause, num)
205
+ def hierarchical_table_names(clause, num)
198
206
  clause.xpath(ns(".//table")).each_with_index do |t, i|
199
207
  next if t["id"].nil? || t["id"].empty?
200
- @anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", nil, @table_lbl, "table")
208
+ @anchors[t["id"]] = anchor_struct("#{num}#{hiersep}#{i + 1}",
209
+ nil, @table_lbl, "table")
201
210
  end
211
+ end
212
+
213
+ def hierarchical_asset_names(clause, num)
214
+ hierarchical_table_names(clause, num)
202
215
  hierarchical_figure_names(clause, num)
216
+ hierarchical_formula_names(clause, num)
217
+ end
218
+
219
+ def hierarchical_formula_names(clause, num)
203
220
  clause.xpath(ns(".//formula")).each_with_index do |t, i|
204
221
  next if t["id"].nil? || t["id"].empty?
205
- @anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", t, @formula_lbl, "formula")
222
+ @anchors[t["id"]] = anchor_struct("#{num}#{hiersep}#{i + 1}",
223
+ t, @formula_lbl, "formula")
206
224
  end
207
225
  end
208
226
  end
@@ -4,6 +4,10 @@ module IsoDoc::Function
4
4
  docxml.xpath(ns("//annex")).each_with_index do |c, i|
5
5
  annex_names(c, (65 + i).chr.to_s)
6
6
  end
7
+ docxml.xpath(ns("//bibliography/clause[not(xmlns:title = 'Normative References' or xmlns:title = 'Normative references')] |"\
8
+ "//bibliography/references[not(xmlns:title = 'Normative References' or xmlns:title = 'Normative references')]")).each do |b|
9
+ preface_names(b)
10
+ end
7
11
  docxml.xpath(ns("//bibitem[not(ancestor::bibitem)]")).each do |ref|
8
12
  reference_names(ref)
9
13
  end
@@ -16,12 +20,13 @@ module IsoDoc::Function
16
20
  sequential_asset_names(d.xpath(ns("//preface/abstract | //foreword | //introduction")))
17
21
  n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
18
22
  n = section_names(d.at(ns(
19
- "//references[title = 'Normative References' or title = 'Normative references']")), n, 1)
23
+ "//bibliography/clause[title = 'Normative References' or title = 'Normative references'] |"\
24
+ "//bibliography/references[title = 'Normative References' or title = 'Normative references']")), n, 1)
20
25
  n = section_names(d.at(ns("//sections/terms | "\
21
26
  "//sections/clause[descendant::terms]")), n, 1)
22
27
  n = section_names(d.at(ns("//sections/definitions")), n, 1)
23
- middle_section_asset_names(d)
24
28
  clause_names(d, n)
29
+ middle_section_asset_names(d)
25
30
  termnote_anchor_names(d)
26
31
  termexample_anchor_names(d)
27
32
  end
@@ -36,7 +41,7 @@ module IsoDoc::Function
36
41
  return if clause.nil?
37
42
  @anchors[clause["id"]] =
38
43
  { label: nil, level: 1, xref: preface_clause_name(clause), type: "clause" }
39
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).each_with_index do |c, i|
44
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).each_with_index do |c, i|
40
45
  preface_names1(c, c.at(ns("./title"))&.text, "#{preface_clause_name(clause)}, #{i+1}", 2)
41
46
  end
42
47
  end
@@ -45,7 +50,7 @@ module IsoDoc::Function
45
50
  label = title || parent_title
46
51
  @anchors[clause["id"]] =
47
52
  { label: nil, level: level, xref: label, type: "clause" }
48
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).
53
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).
49
54
  each_with_index do |c, i|
50
55
  preface_names1(c, c.at(ns("./title"))&.text, "#{label} #{i+1}", level + 1)
51
56
  end
@@ -73,7 +78,7 @@ module IsoDoc::Function
73
78
  num = num + 1
74
79
  @anchors[clause["id"]] =
75
80
  { label: num.to_s, xref: l10n("#{@clause_lbl} #{num}"), level: lvl, type: "clause" }
76
- clause.xpath(ns("./clause | ./term | ./terms | ./definitions")).
81
+ clause.xpath(ns("./clause | ./term | ./terms | ./definitions | ./references")).
77
82
  each_with_index do |c, i|
78
83
  section_names1(c, "#{num}.#{i + 1}", lvl + 1)
79
84
  end
@@ -83,7 +88,7 @@ module IsoDoc::Function
83
88
  def section_names1(clause, num, level)
84
89
  @anchors[clause["id"]] =
85
90
  { label: num, level: level, xref: l10n("#{@clause_lbl} #{num}"), type: "clause" }
86
- clause.xpath(ns("./clause | ./terms | ./term | ./definitions")).
91
+ clause.xpath(ns("./clause | ./terms | ./term | ./definitions | ./references")).
87
92
  each_with_index do |c, i|
88
93
  section_names1(c, "#{num}.#{i + 1}", level + 1)
89
94
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "0.9.13".freeze
2
+ VERSION = "0.9.14".freeze
3
3
  end
@@ -80,12 +80,16 @@ module IsoDoc::WordFunction
80
80
  end
81
81
 
82
82
  def section_break(body)
83
- body.br **{ clear: "all", class: "section" }
83
+ body.p do |p|
84
+ p.br **{ clear: "all", class: "section" }
85
+ end
84
86
  end
85
87
 
86
88
  def page_break(out)
87
- out.br **{ clear: "all",
89
+ out.p do |p|
90
+ p.br **{ clear: "all",
88
91
  style: "mso-special-character:line-break;page-break-before:always" }
92
+ end
89
93
  end
90
94
 
91
95
  WORD_DT_ATTRS = {class: @note ? "Note" : nil, align: "left",
@@ -222,5 +226,39 @@ module IsoDoc::WordFunction
222
226
  "##{node["target"]}"
223
227
  out.a(**{ "href": target }) { |l| l << get_linkend(node) }
224
228
  end
229
+
230
+ def example_table_attr(node)
231
+ super.merge({
232
+ style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
233
+ "mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;"\
234
+ "mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;"\
235
+ "mso-table-overlap:never;border-collapse:collapse;"
236
+ })
237
+ end
238
+
239
+
240
+ def make_table_attr(node)
241
+ {
242
+ style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
243
+ "mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;"\
244
+ "mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;"\
245
+ "mso-table-overlap:never;"
246
+ }.merge(super)
247
+ end
248
+
249
+ def table_parse(node, out)
250
+ @in_table = true
251
+ table_title_parse(node, out)
252
+ out.div **{ align: "center" } do |div|
253
+ div.table **make_table_attr(node) do |t|
254
+ thead_parse(node, t)
255
+ tbody_parse(node, t)
256
+ tfoot_parse(node, t)
257
+ (dl = node.at(ns("./dl"))) && parse(dl, out)
258
+ node.xpath(ns("./note")).each { |n| parse(n, out) }
259
+ end
260
+ end
261
+ @in_table = false
262
+ end
225
263
  end
226
264
  end
@@ -2,6 +2,26 @@ require "fileutils"
2
2
 
3
3
  module IsoDoc::WordFunction
4
4
  module Postprocess
5
+ # add namespaces for Word fragments
6
+ WORD_NOKOHEAD = <<~HERE.freeze
7
+ <!DOCTYPE html SYSTEM
8
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
9
+ <html xmlns="http://www.w3.org/1999/xhtml"
10
+ xmlns:v="urn:schemas-microsoft-com:vml"
11
+ xmlns:o="urn:schemas-microsoft-com:office:office"
12
+ xmlns:w="urn:schemas-microsoft-com:office:word"
13
+ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
14
+ <head> <title></title> <meta charset="UTF-8" /> </head>
15
+ <body> </body> </html>
16
+ HERE
17
+
18
+ def to_word_xhtml_fragment(xml)
19
+ doc = ::Nokogiri::XML.parse(WORD_NOKOHEAD)
20
+ #fragment = doc.fragment(xml)
21
+ fragment = ::Nokogiri::XML::DocumentFragment.new(doc, xml, doc.root)
22
+ fragment
23
+ end
24
+
5
25
  def table_note_cleanup(docxml)
6
26
  super
7
27
  # preempt html2doc putting MsoNormal there
@@ -70,7 +90,7 @@ module IsoDoc::WordFunction
70
90
  def word_cover(docxml)
71
91
  cover = File.read(@wordcoverpage, encoding: "UTF-8")
72
92
  cover = populate_template(cover, :word)
73
- coverxml = to_xhtml_fragment(cover)
93
+ coverxml = to_word_xhtml_fragment(cover)
74
94
  docxml.at('//div[@class="WordSection1"]').children.first.previous =
75
95
  coverxml.to_xml(encoding: "US-ASCII")
76
96
  end
@@ -79,7 +99,7 @@ module IsoDoc::WordFunction
79
99
  intro = File.read(@wordintropage, encoding: "UTF-8").
80
100
  sub(/WORDTOC/, make_WordToC(docxml))
81
101
  intro = populate_template(intro, :word)
82
- introxml = to_xhtml_fragment(intro)
102
+ introxml = to_word_xhtml_fragment(intro)
83
103
  docxml.at('//div[@class="WordSection2"]').children.first.previous =
84
104
  introxml.to_xml(encoding: "US-ASCII")
85
105
  end
@@ -42,9 +42,9 @@ RSpec.describe IsoDoc do
42
42
  <div class="WordSection1">
43
43
  <p>&#160;</p>
44
44
  </div>
45
- <br clear="all" class="section"/>
45
+ <p><br clear="all" class="section"/></p>
46
46
  <div class="WordSection2">
47
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
47
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
48
48
  <div>
49
49
  <h1 class="ForewordTitle">Foreword</h1>
50
50
  <div id="" class="Note">
@@ -53,7 +53,7 @@ RSpec.describe IsoDoc do
53
53
  </div>
54
54
  <p>&#160;</p>
55
55
  </div>
56
- <br clear="all" class="section"/>
56
+ <p><br clear="all" class="section"/></p>
57
57
  <div class="WordSection3">
58
58
  <p class="zzSTDTitle1"/>
59
59
  </div>
@@ -200,9 +200,9 @@ INPUT
200
200
  <div class="WordSection1">
201
201
  <p>&#160;</p>
202
202
  </div>
203
- <br clear="all" class="section"/>
203
+ <p><br clear="all" class="section"/></p>
204
204
  <div class="WordSection2">
205
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
205
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
206
206
  <div>
207
207
  <h1 class="ForewordTitle">Foreword</h1>
208
208
  <div id="" class="Note"><p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span></p>
@@ -213,7 +213,7 @@ INPUT
213
213
  </div>
214
214
  <p>&#160;</p>
215
215
  </div>
216
- <br clear="all" class="section"/>
216
+ <p><br clear="all" class="section"/></p>
217
217
  <div class="WordSection3">
218
218
  <p class="zzSTDTitle1"/>
219
219
  </div>
@@ -302,9 +302,9 @@ B</pre>
302
302
  <div class="WordSection1">
303
303
  <p>&#160;</p>
304
304
  </div>
305
- <br clear="all" class="section"/>
305
+ <p><br clear="all" class="section"/></p>
306
306
  <div class="WordSection2">
307
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
307
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
308
308
  <div>
309
309
  <h1 class="ForewordTitle">Foreword</h1>
310
310
  <div id="figureA-1" class="figure">
@@ -324,7 +324,7 @@ B</pre>
324
324
  </div>
325
325
  <p>&#160;</p>
326
326
  </div>
327
- <br clear="all" class="section"/>
327
+ <p><br clear="all" class="section"/></p>
328
328
  <div class="WordSection3">
329
329
  <p class="zzSTDTitle1"/>
330
330
  </div>
@@ -597,9 +597,9 @@ World</p>
597
597
  <div class="WordSection1">
598
598
  <p>&#160;</p>
599
599
  </div>
600
- <br clear="all" class="section"/>
600
+ <p><br clear="all" class="section"/></p>
601
601
  <div class="WordSection2">
602
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
602
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
603
603
  <div>
604
604
  <h1 class="ForewordTitle">Foreword</h1>
605
605
  <p id="_08bfe952-d57f-4150-9c95-5d52098cc2a8" align="left" style="text-align:left">Vache Equipment<br/>
@@ -610,7 +610,7 @@ World</p>
610
610
  </div>
611
611
  <p>&#160;</p>
612
612
  </div>
613
- <br clear="all" class="section"/>
613
+ <p><br clear="all" class="section"/></p>
614
614
  <div class="WordSection3">
615
615
  <p class="zzSTDTitle1"/>
616
616
  </div>
@@ -65,9 +65,9 @@ RSpec.describe IsoDoc do
65
65
  <div class="WordSection1">
66
66
  <p>&#160;</p>
67
67
  </div>
68
- <br clear="all" class="section"/>
68
+ <p><br clear="all" class="section"/></p>
69
69
  <div class="WordSection2">
70
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
70
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
71
71
  <div>
72
72
  <h1 class="ForewordTitle">Foreword</h1>
73
73
  <p>A.<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
@@ -76,7 +76,7 @@ RSpec.describe IsoDoc do
76
76
  </div>
77
77
  <p>&#160;</p>
78
78
  </div>
79
- <br clear="all" class="section"/>
79
+ <p><br clear="all" class="section"/></p>
80
80
  <div class="WordSection3">
81
81
  <p class="zzSTDTitle1"/>
82
82
  <aside id="ftn2">
@@ -182,9 +182,9 @@ RSpec.describe IsoDoc do
182
182
  <div class="WordSection1">
183
183
  <p class="MsoNormal">&#xA0;</p>
184
184
  </div>
185
- <br clear="all" class="section"/>
185
+ <p class="MsoNormal"><br clear="all" class="section"/></p>
186
186
  <div class="WordSection2">
187
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
187
+ <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
188
188
  <div>
189
189
  <h1 class="ForewordTitle">Foreword</h1>
190
190
  <span style="MsoCommentReference" target="1" class="commentLink" from="A" to="B">
@@ -208,14 +208,14 @@ RSpec.describe IsoDoc do
208
208
  </span>
209
209
 
210
210
  </div>
211
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
211
+ <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
212
212
  <div class="Section3" id="">
213
213
  <h1 class="IntroTitle">Introduction</h1>
214
214
 
215
215
  </div>
216
216
  <p class="MsoNormal">&#xA0;</p>
217
217
  </div>
218
- <br clear="all" class="section"/>
218
+ <p class="MsoNormal"><br clear="all" class="section"/></p>
219
219
  <div class="WordSection3">
220
220
  <p class="zzSTDTitle1"></p>
221
221
  <div style="mso-element:comment-list"><div style="mso-element:comment"><a name="3" id="3"></a>
@@ -199,9 +199,9 @@ RSpec.describe IsoDoc do
199
199
  <div class="WordSection1">
200
200
  <p>&#160;</p>
201
201
  </div>
202
- <br clear="all" class="section"/>
202
+ <p><br clear="all" class="section"/></p>
203
203
  <div class="WordSection2">
204
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
204
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
205
205
  <div>
206
206
  <h1 class="ForewordTitle">Foreword</h1>
207
207
  <table class="dl">
@@ -236,7 +236,7 @@ RSpec.describe IsoDoc do
236
236
  </div>
237
237
  <p>&#160;</p>
238
238
  </div>
239
- <br clear="all" class="section"/>
239
+ <p><br clear="all" class="section"/></p>
240
240
  <div class="WordSection3">
241
241
  <p class="zzSTDTitle1"/>
242
242
  </div>
@@ -207,10 +207,10 @@ RSpec.describe IsoDoc do
207
207
  </iso-standard>
208
208
  INPUT
209
209
  word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
210
- sub(%r{<br clear="all" class="section"/>\s*<div class="WordSection3">.*$}m, "")
210
+ sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
211
211
  expect(word).to be_equivalent_to <<~"OUTPUT"
212
212
  <div class="WordSection2">
213
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
213
+ <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
214
214
  <div>
215
215
  <h1 class="ForewordTitle">Foreword</h1>
216
216
  <table class="dl">
@@ -251,7 +251,7 @@ RSpec.describe IsoDoc do
251
251
  expect(word).to be_equivalent_to <<~"OUTPUT"
252
252
  <div class="WordSection3">
253
253
  <p class="zzSTDTitle1"></p>
254
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
254
+ <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
255
255
  <div class="Section3"><a name="P" id="P"></a>
256
256
  <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
257
257
  <div><a name="Q" id="Q"></a>
@@ -282,9 +282,9 @@ RSpec.describe IsoDoc do
282
282
  expect(word).to be_equivalent_to <<~"OUTPUT"
283
283
  <div class="WordSection3">
284
284
  <p class="zzSTDTitle1"></p>
285
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
285
+ <p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
286
286
  <div class="Section3"><a name="P" id="P"></a>
287
- <table class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
287
+ <table class="example" cellspacing="0" cellpadding="0" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-collapse:collapse;"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851c" id="_63112cbc-cde0-435f-9553-e0b8c4f5851c"></a>
288
288
  <tr>
289
289
  <td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 1</td>
290
290
  <td valign="top" class="example">
@@ -292,7 +292,7 @@ RSpec.describe IsoDoc do
292
292
  </td>
293
293
  </tr>
294
294
  </table><p style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;margin-left:0.0pt;margin-bottom:.0001pt;line-height:1.0pt;mso-line-height-rule:exactly" class="MsoNormal"><span lang="EN-GB" style="display:none;mso-hide:all" xml:lang="EN-GB">&#xA0;</span></p>
295
- <table class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
295
+ <table class="example" cellspacing="0" cellpadding="0" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-collapse:collapse;"><a name="_63112cbc-cde0-435f-9553-e0b8c4f5851d" id="_63112cbc-cde0-435f-9553-e0b8c4f5851d"></a>
296
296
  <tr>
297
297
  <td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 2</td>
298
298
  <td valign="top" class="example">
@@ -398,7 +398,7 @@ ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
398
398
 
399
399
  INPUT
400
400
  word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
401
- sub(%r{<br clear="all" class="section"/>\s*<div class="WordSection3">.*$}m, "")
401
+ sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
402
402
  expect(word.gsub(/_Toc\d\d+/, "_Toc")).to be_equivalent_to <<~'OUTPUT'
403
403
  <div class="WordSection2">
404
404
  /* an empty word intro page */
@@ -69,7 +69,7 @@ RSpec.describe IsoDoc do
69
69
  <docidentifier>[10]</docidentifier>
70
70
  </bibitem>
71
71
  <bibitem id="ref11">
72
- <formattedref format="application/x-isodoc+xml"><smallcap>Standard No I.C.C 167</smallcap>. <em>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</em> (see <link target="http://www.icc.or.at"/>)</formattedref>
72
+ <title>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</title>
73
73
  <docidentifier type="IETF">RFC 10</docidentifier>
74
74
  </bibitem>
75
75
 
@@ -103,7 +103,7 @@ RSpec.describe IsoDoc do
103
103
  <h1 class="Section3">Bibliography</h1>
104
104
  <p id="ISO3696" class="Biblio">[1]&#160; ISO 3696, <i> Water for analytical laboratory use</i></p>
105
105
  <p id="ref10" class="Biblio">[10]&#160; <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
106
- <p id="ref11" class="Biblio">[3]&#160; IETF RFC 10, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
106
+ <p id="ref11" class="Biblio">[3]&#160; IETF RFC 10, <i>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</i></p>
107
107
  </div>
108
108
  <aside id="fn:1" class="footnote">
109
109
  <p>Under preparation. (Stage at the time of publication ISO/DIS 16634)</p>
@@ -260,18 +260,18 @@ OUTPUT
260
260
  <div class="WordSection1">
261
261
  <p>&#160;</p>
262
262
  </div>
263
- <br clear="all" class="section"/>
263
+ <p><br clear="all" class="section"/></p>
264
264
  <div class="WordSection2">
265
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
265
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
266
266
  <div>
267
267
  <h1 class="AbstractTitle">Abstract</h1>
268
268
  </div>
269
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
269
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
270
270
  <div>
271
271
  <h1 class="ForewordTitle">Foreword</h1>
272
272
  <p id="A">This is a preamble</p>
273
273
  </div>
274
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
274
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
275
275
  <div class="Section3" id="B">
276
276
  <h1 class="IntroTitle">Introduction</h1>
277
277
  <div id="C">
@@ -280,7 +280,7 @@ OUTPUT
280
280
  </div>
281
281
  <p>&#160;</p>
282
282
  </div>
283
- <br clear="all" class="section"/>
283
+ <p><br clear="all" class="section"/></p>
284
284
  <div class="WordSection3">
285
285
  <p class="zzSTDTitle1"/>
286
286
  <div id="D">
@@ -333,7 +333,7 @@ OUTPUT
333
333
  <h2>5.3. </h2>
334
334
  </div>
335
335
  </div>
336
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
336
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
337
337
  <div id="P" class="Section3">
338
338
  <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
339
339
  <div id="Q">
@@ -343,7 +343,7 @@ OUTPUT
343
343
  </div>
344
344
  </div>
345
345
  </div>
346
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
346
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
347
347
  <div>
348
348
  <h1 class="Section3">Bibliography</h1>
349
349
  <div>
@@ -186,13 +186,14 @@ RSpec.describe IsoDoc do
186
186
  <div class="WordSection1">
187
187
  <p>&#160;</p>
188
188
  </div>
189
- <br clear="all" class="section"/>
189
+ <p><br clear="all" class="section"/></p>
190
190
  <div class="WordSection2">
191
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
191
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
192
192
  <div>
193
193
  <h1 class="ForewordTitle">Foreword</h1>
194
194
  <p class="TableTitle" align="center">Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</p>
195
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
195
+ <div align="center">
196
+ <table style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;" id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
196
197
  <thead>
197
198
  <tr>
198
199
  <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Description</td>
@@ -244,10 +245,11 @@ RSpec.describe IsoDoc do
244
245
  <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
245
246
  </div>
246
247
  </table>
248
+ </div>
247
249
  </div>
248
250
  <p>&#160;</p>
249
251
  </div>
250
- <br clear="all" class="section"/>
252
+ <p><br clear="all" class="section"/></p>
251
253
  <div class="WordSection3">
252
254
  <p class="zzSTDTitle1"/>
253
255
  </div>
@@ -171,13 +171,13 @@ OUTPUT
171
171
  <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
172
172
 
173
173
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
174
- <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 1</td><td valign="top" class="example">
174
+ <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example" cellspacing="0" cellpadding="0" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-collapse:collapse;"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 1</td><td valign="top" class="example">
175
175
  <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
176
176
  <ul>
177
177
  <li>A</li>
178
178
  </ul>
179
179
  </td></tr></table>
180
- <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 2</td><td valign="top" class="example">
180
+ <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example" cellspacing="0" cellpadding="0" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-collapse:collapse;"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE 2</td><td valign="top" class="example">
181
181
  <ul>
182
182
  <li>A</li>
183
183
  </ul>
@@ -190,7 +190,7 @@ OUTPUT
190
190
  <p class="AltTerms" style="text-align:left;">rough rice</p>
191
191
  <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
192
192
  <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
193
- <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example" cellspacing="0" cellpadding="0" style="border-collapse:collapse"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE</td><td valign="top" class="example">
193
+ <table id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example" cellspacing="0" cellpadding="0" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-collapse:collapse;"><tr><td valign="top" class="example_label" style="width:82.8pt;padding:0 0 0 1em;margin-left:0pt">EXAMPLE</td><td valign="top" class="example">
194
194
  <ul>
195
195
  <li>A</li>
196
196
  </ul>
@@ -41,7 +41,7 @@ RSpec.describe IsoDoc do
41
41
  </iso-standard
42
42
  INPUT
43
43
  <div class="WordSection2">
44
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
44
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
45
45
  <div>
46
46
  <h1 class="ForewordTitle">Foreword</h1>
47
47
  <p>
@@ -1065,6 +1065,7 @@ RSpec.describe IsoDoc do
1065
1065
  <xref target="Q"/>
1066
1066
  <xref target="Q1"/>
1067
1067
  <xref target="R"/>
1068
+ <xref target="S"/>
1068
1069
  </p>
1069
1070
  </foreword>
1070
1071
  <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
@@ -1142,6 +1143,7 @@ RSpec.describe IsoDoc do
1142
1143
  <a href="#Q">Annex A.1</a>
1143
1144
  <a href="#Q1">Annex A.1.1</a>
1144
1145
  <a href="#R">Clause 2</a>
1146
+ <a href="#S">Bibliography</a>
1145
1147
  </p>
1146
1148
  </div>
1147
1149
  <br/>
data/spec/spec_helper.rb CHANGED
@@ -51,10 +51,10 @@ WORD_HDR = <<~END
51
51
  <div class="WordSection1">
52
52
  <p>&#160;</p>
53
53
  </div>
54
- <br clear="all" class="section"/>
54
+ <p><br clear="all" class="section"/></p>
55
55
  <div class="WordSection2">
56
56
  <p>&#160;</p>
57
57
  </div>
58
- <br clear="all" class="section"/>
58
+ <p><br clear="all" class="section"/></p>
59
59
  <div class="WordSection3">
60
60
  END
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.13
4
+ version: 0.9.14
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-12-19 00:00:00.000000000 Z
11
+ date: 2019-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciimath
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '1.15'
187
+ version: 2.0.1
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '1.15'
194
+ version: 2.0.1
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: byebug
197
197
  requirement: !ruby/object:Gem::Requirement