isodoc 0.5.5 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CODE_OF_CONDUCT.md +46 -0
  3. data/LICENSE +25 -0
  4. data/README.adoc +1 -1
  5. data/Rakefile +6 -0
  6. data/isodoc.gemspec +1 -0
  7. data/lib/isodoc.rb +4 -95
  8. data/lib/isodoc/cleanup.rb +14 -10
  9. data/lib/isodoc/{notes.rb → comments.rb} +0 -73
  10. data/lib/isodoc/convert.rb +97 -0
  11. data/lib/isodoc/footnotes.rb +74 -0
  12. data/lib/isodoc/html.rb +41 -4
  13. data/lib/isodoc/i18n-en.yaml +1 -0
  14. data/lib/isodoc/i18n-fr.yaml +1 -0
  15. data/lib/isodoc/i18n-zh-Hans.yaml +1 -0
  16. data/lib/isodoc/i18n.rb +1 -0
  17. data/lib/isodoc/inline.rb +4 -12
  18. data/lib/isodoc/iso2wordhtml.rb +26 -13
  19. data/lib/isodoc/metadata.rb +23 -10
  20. data/lib/isodoc/references.rb +20 -22
  21. data/lib/isodoc/section.rb +4 -3
  22. data/lib/isodoc/table.rb +0 -2
  23. data/lib/isodoc/terms.rb +2 -13
  24. data/lib/isodoc/utils.rb +24 -3
  25. data/lib/isodoc/version.rb +1 -1
  26. data/lib/isodoc/wordconvert/comments.rb +155 -0
  27. data/lib/isodoc/wordconvert/convert.rb +31 -0
  28. data/lib/isodoc/wordconvert/footnotes.rb +80 -0
  29. data/lib/isodoc/wordconvert/wordconvertmodule.rb +212 -0
  30. data/lib/isodoc/xref_gen.rb +50 -79
  31. data/lib/isodoc/xref_sect_gen.rb +82 -0
  32. data/spec/assets/header.html +7 -0
  33. data/spec/assets/html.css +2 -0
  34. data/spec/assets/htmlcover.html +4 -0
  35. data/spec/assets/htmlintro.html +5 -0
  36. data/spec/assets/i18n.yaml +2 -0
  37. data/spec/assets/iso.xml +8 -0
  38. data/spec/assets/rice_image1.png +0 -0
  39. data/spec/assets/std.css +2 -0
  40. data/spec/assets/word.css +2 -0
  41. data/spec/assets/wordcover.html +3 -0
  42. data/spec/assets/wordintro.html +4 -0
  43. data/spec/isodoc/blocks_spec.rb +130 -47
  44. data/spec/isodoc/cleanup_spec.rb +693 -0
  45. data/spec/isodoc/footnotes_spec.rb +282 -0
  46. data/spec/isodoc/i18n_spec.rb +662 -0
  47. data/spec/isodoc/inline_spec.rb +344 -0
  48. data/spec/isodoc/lists_spec.rb +81 -18
  49. data/spec/isodoc/metadata_spec.rb +141 -0
  50. data/spec/isodoc/postproc_spec.rb +444 -0
  51. data/spec/isodoc/ref_spec.rb +158 -0
  52. data/spec/isodoc/section_spec.rb +275 -112
  53. data/spec/isodoc/table_spec.rb +146 -8
  54. data/spec/isodoc/terms_spec.rb +118 -0
  55. data/spec/isodoc/xref_spec.rb +490 -114
  56. metadata +46 -4
  57. data/lib/isodoc/postprocessing.rb +0 -176
@@ -1,3 +1,5 @@
1
+ require "roman-numerals"
2
+
1
3
  module IsoDoc
2
4
  class Convert
3
5
  @anchors = {}
@@ -6,39 +8,6 @@ module IsoDoc
6
8
  @anchors
7
9
  end
8
10
 
9
- def back_anchor_names(docxml)
10
- docxml.xpath(ns("//annex")).each_with_index do |c, i|
11
- annex_names(c, (65 + i).chr.to_s)
12
- end
13
- docxml.xpath(ns("//bibitem")).each do |ref|
14
- reference_names(ref)
15
- end
16
- end
17
-
18
- def initial_anchor_names(d)
19
- introduction_names(d.at(ns("//introduction")))
20
- section_names(d.at(ns("//clause[title = 'Scope']")), "1", 1)
21
- section_names(d.at(ns(
22
- "//references[title = 'Normative References']")), "2", 1)
23
- section_names(d.at(ns("//sections/terms")), "3", 1)
24
- middle_section_asset_names(d)
25
- end
26
-
27
- def middle_section_asset_names(d)
28
- middle_sections = "//clause[title = 'Scope'] | "\
29
- "//foreword | //introduction | "\
30
- "//references[title = 'Normative References'] | //sections/terms | "\
31
- "//sections/symbols-abbrevs | //clause[parent::sections]"
32
- sequential_asset_names(d.xpath(ns(middle_sections)))
33
- end
34
-
35
- def clause_names(docxml, sect_num)
36
- q = "//clause[parent::sections][not(xmlns:title = 'Scope')]"
37
- docxml.xpath(ns(q)).each_with_index do |c, i|
38
- section_names(c, (i + sect_num).to_s, 1)
39
- end
40
- end
41
-
42
11
  def termnote_label(n)
43
12
  @termnote_lbl.gsub(/%/, n.to_s)
44
13
  end
@@ -54,6 +23,17 @@ module IsoDoc
54
23
  end
55
24
  end
56
25
 
26
+ def termexample_anchor_names(docxml)
27
+ docxml.xpath(ns("//term[termexample]")).each do |t|
28
+ t.xpath(ns("./termexample")).each_with_index do |n, i|
29
+ @anchors[n["id"]] =
30
+ { label: (i + 1).to_s,
31
+ xref: l10n("#{@anchors[t['id']][:xref]}, "\
32
+ "#{@note_xref_lbl} #{i + 1}") }
33
+ end
34
+ end
35
+ end
36
+
57
37
  SECTIONS_XPATH =
58
38
  "//foreword | //introduction | //sections/terms | //annex | "\
59
39
  "//sections/clause | //references[not(ancestor::references)]".freeze
@@ -90,6 +70,41 @@ module IsoDoc
90
70
  end
91
71
  end
92
72
 
73
+ def list_anchor_names(sections)
74
+ sections.each do |s|
75
+ notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//subsection//ol")) -
76
+ s.xpath(ns(".//ol//ol"))
77
+ notes.each_with_index do |n, i|
78
+ idx = notes.size == 1 ? "" : " #{i + 1}"
79
+ @anchors[n["id"]] = anchor_struct(idx, s, @list_lbl)
80
+ list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
81
+ end
82
+ list_anchor_names(s.xpath(ns("./subsection")))
83
+ end
84
+ end
85
+
86
+ def listlabel(depth, i)
87
+ return i.to_s if [2, 7].include? depth
88
+ return (96 + i).chr.to_s if [1, 6].include? depth
89
+ return (64 + i).chr.to_s if [4, 9].include? depth
90
+ return RomanNumerals.to_roman(i).downcase if [3, 8].include? depth
91
+ return RomanNumerals.to_roman(i).upcase if [5, 10].include? depth
92
+ return i.to_s
93
+ end
94
+
95
+ def list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
96
+ list.xpath(ns("./li")).each_with_index do |li, i|
97
+ label = listlabel(depth, i + 1)
98
+ label = "#{prev_label}.#{label}" unless prev_label.empty?
99
+ label = "#{list_anchor[:xref]} #{label}" if refer_list
100
+ li["id"] && @anchors[li["id"]] = { xref: "#{label})",
101
+ container: list_anchor[:container] }
102
+ li.xpath(ns("./ol")).each do |ol|
103
+ list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
104
+ end
105
+ end
106
+ end
107
+
93
108
  def middle_anchor_names(docxml)
94
109
  symbols_abbrevs = docxml.at(ns("//sections/symbols-abbrevs"))
95
110
  sect_num = 4
@@ -99,6 +114,7 @@ module IsoDoc
99
114
  end
100
115
  clause_names(docxml, sect_num)
101
116
  termnote_anchor_names(docxml)
117
+ termexample_anchor_names(docxml)
102
118
  end
103
119
 
104
120
  # extract names for all anchors, xref and label
@@ -111,6 +127,7 @@ module IsoDoc
111
127
  "//figure")))
112
128
  note_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
113
129
  example_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
130
+ list_anchor_names(docxml.xpath(ns(SECTIONS_XPATH)))
114
131
  end
115
132
 
116
133
  def sequential_figure_names(clause)
@@ -167,51 +184,5 @@ module IsoDoc
167
184
  @anchors[t["id"]] = anchor_struct("#{num}.#{i + 1}", t, @formula_lbl)
168
185
  end
169
186
  end
170
-
171
- def introduction_names(clause)
172
- return if clause.nil?
173
- clause.xpath(ns("./subsection")).each_with_index do |c, i|
174
- section_names1(c, "0.#{i + 1}", 2)
175
- end
176
- end
177
-
178
- def section_names(clause, num, lvl)
179
- return if clause.nil?
180
- @anchors[clause["id"]] =
181
- { label: num, xref: l10n("#{@clause_lbl} #{num}"), level: lvl }
182
- clause.xpath(ns("./subsection | ./term | ./terms | ./symbols-abbrevs")).
183
- each_with_index do |c, i|
184
- section_names1(c, "#{num}.#{i + 1}", lvl + 1)
185
- end
186
- end
187
-
188
- def section_names1(clause, num, level)
189
- @anchors[clause["id"]] =
190
- { label: num, level: level, xref: num }
191
- # subclauses are not prefixed with "Clause"
192
- clause.xpath(ns("./subsection | ./terms | ./term | ./symbols-abbrevs")).
193
- each_with_index do |c, i|
194
- section_names1(c, "#{num}.#{i + 1}", level + 1)
195
- end
196
- end
197
-
198
- def annex_names(clause, num)
199
- obl = l10n("(#{@inform_annex_lbl})")
200
- obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
201
- label = l10n("<b>#{@annex_lbl} #{num}</b><br/>#{obl}")
202
- @anchors[clause["id"]] =
203
- { label: label, xref: "#{@annex_lbl} #{num}", level: 1 }
204
- clause.xpath(ns("./subsection")).each_with_index do |c, i|
205
- annex_names1(c, "#{num}.#{i + 1}", 2)
206
- end
207
- hierarchical_asset_names(clause, num)
208
- end
209
-
210
- def annex_names1(clause, num, level)
211
- @anchors[clause["id"]] = { label: num, xref: num, level: level }
212
- clause.xpath(ns(".//subsection")).each_with_index do |c, i|
213
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
214
- end
215
- end
216
187
  end
217
188
  end
@@ -0,0 +1,82 @@
1
+ module IsoDoc
2
+ class Convert
3
+ def back_anchor_names(docxml)
4
+ docxml.xpath(ns("//annex")).each_with_index do |c, i|
5
+ annex_names(c, (65 + i).chr.to_s)
6
+ end
7
+ docxml.xpath(ns("//bibitem")).each do |ref|
8
+ reference_names(ref)
9
+ end
10
+ end
11
+
12
+ def initial_anchor_names(d)
13
+ introduction_names(d.at(ns("//introduction")))
14
+ section_names(d.at(ns("//clause[title = 'Scope']")), "1", 1)
15
+ section_names(d.at(ns(
16
+ "//references[title = 'Normative References']")), "2", 1)
17
+ section_names(d.at(ns("//sections/terms")), "3", 1)
18
+ middle_section_asset_names(d)
19
+ end
20
+
21
+ def middle_section_asset_names(d)
22
+ middle_sections = "//clause[title = 'Scope'] | "\
23
+ "//foreword | //introduction | "\
24
+ "//references[title = 'Normative References'] | //sections/terms | "\
25
+ "//sections/symbols-abbrevs | //clause[parent::sections]"
26
+ sequential_asset_names(d.xpath(ns(middle_sections)))
27
+ end
28
+
29
+ def clause_names(docxml, sect_num)
30
+ q = "//clause[parent::sections][not(xmlns:title = 'Scope')]"
31
+ docxml.xpath(ns(q)).each_with_index do |c, i|
32
+ section_names(c, (i + sect_num).to_s, 1)
33
+ end
34
+ end
35
+
36
+ def introduction_names(clause)
37
+ return if clause.nil?
38
+ clause.xpath(ns("./subsection")).each_with_index do |c, i|
39
+ section_names1(c, "0.#{i + 1}", 2)
40
+ end
41
+ end
42
+
43
+ def section_names(clause, num, lvl)
44
+ return if clause.nil?
45
+ @anchors[clause["id"]] =
46
+ { label: num, xref: l10n("#{@clause_lbl} #{num}"), level: lvl }
47
+ clause.xpath(ns("./subsection | ./term | ./terms | ./symbols-abbrevs")).
48
+ each_with_index do |c, i|
49
+ section_names1(c, "#{num}.#{i + 1}", lvl + 1)
50
+ end
51
+ end
52
+
53
+ def section_names1(clause, num, level)
54
+ @anchors[clause["id"]] =
55
+ { label: num, level: level, xref: num }
56
+ # subclauses are not prefixed with "Clause"
57
+ clause.xpath(ns("./subsection | ./terms | ./term | ./symbols-abbrevs")).
58
+ each_with_index do |c, i|
59
+ section_names1(c, "#{num}.#{i + 1}", level + 1)
60
+ end
61
+ end
62
+
63
+ def annex_names(clause, num)
64
+ obl = l10n("(#{@inform_annex_lbl})")
65
+ obl = l10n("(#{@norm_annex_lbl})") if clause["obligation"] == "normative"
66
+ label = l10n("<b>#{@annex_lbl} #{num}</b><br/>#{obl}")
67
+ @anchors[clause["id"]] =
68
+ { label: label, xref: "#{@annex_lbl} #{num}", level: 1 }
69
+ clause.xpath(ns("./subsection")).each_with_index do |c, i|
70
+ annex_names1(c, "#{num}.#{i + 1}", 2)
71
+ end
72
+ hierarchical_asset_names(clause, num)
73
+ end
74
+
75
+ def annex_names1(clause, num, level)
76
+ @anchors[clause["id"]] = { label: num, xref: num, level: level }
77
+ clause.xpath(ns(".//subsection")).each_with_index do |c, i|
78
+ annex_names1(c, "#{num}.#{i + 1}", level + 1)
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,7 @@
1
+
2
+ /* an empty header */
3
+
4
+ START DOC ID: {{ docnumber }}: END DOC ID
5
+
6
+ FILENAME: {{ filename }}
7
+
@@ -0,0 +1,2 @@
1
+
2
+ /* another empty stylesheet */
@@ -0,0 +1,4 @@
1
+
2
+ /* an empty html cover page */
3
+
4
+
@@ -0,0 +1,5 @@
1
+
2
+ /* an empty html intro page */
3
+
4
+ <ul id="toc-list"></ul>
5
+
@@ -0,0 +1,2 @@
1
+ foreword: Enkonduko
2
+
@@ -0,0 +1,8 @@
1
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
2
+ <foreword>
3
+ <note>
4
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
5
+ </note>
6
+ </foreword>
7
+ </iso-standard>
8
+
@@ -0,0 +1,2 @@
1
+
2
+ /* a third empty stylesheet */
@@ -0,0 +1,2 @@
1
+
2
+ /* one empty stylesheet */
@@ -0,0 +1,3 @@
1
+
2
+ /* an empty word cover page */
3
+
@@ -0,0 +1,4 @@
1
+
2
+ /* an empty word intro page */
3
+
4
+ WORDTOC
@@ -18,18 +18,18 @@ RSpec.describe IsoDoc do
18
18
  <div class="WordSection1">
19
19
  <p>&#160;</p>
20
20
  </div>
21
- <br clear="all" class="section"/>
21
+ <br/>
22
22
  <div class="WordSection2">
23
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
23
+ <br/>
24
24
  <div>
25
25
  <h1 class="ForewordTitle">Foreword</h1>
26
26
  <div id="" class="Note">
27
- <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
27
+ <p class="Note">NOTE&#160; These results are based on a study carried out on three different types of kernel.</p>
28
28
  </div>
29
29
  </div>
30
30
  <p>&#160;</p>
31
31
  </div>
32
- <br clear="all" class="section"/>
32
+ <br/>
33
33
  <div class="WordSection3">
34
34
  <p class="zzSTDTitle1"/>
35
35
  </div>
@@ -45,6 +45,44 @@ RSpec.describe IsoDoc do
45
45
  <foreword>
46
46
  <note id="note1">
47
47
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
48
+ </note>
49
+ </foreword>
50
+ </iso-standard>
51
+ INPUT
52
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
53
+ <head>
54
+ <title>test</title>
55
+ <body lang="EN-US" link="blue" vlink="#954F72">
56
+ <div class="WordSection1">
57
+ <p>&#160;</p>
58
+ </div>
59
+ <br/>
60
+ <div class="WordSection2">
61
+ <br/>
62
+ <div>
63
+ <h1 class="ForewordTitle">Foreword</h1>
64
+ <div id="note1" class="Note">
65
+ <p class="Note">NOTE&#160; These results are based on a study carried out on three different types of kernel.</p>
66
+ </div>
67
+ </div>
68
+ <p>&#160;</p>
69
+ </div>
70
+ <br/>
71
+ <div class="WordSection3">
72
+ <p class="zzSTDTitle1"/>
73
+ </div>
74
+ </body>
75
+ </head>
76
+ </html>
77
+ OUTPUT
78
+ end
79
+
80
+ it "processes sequences of notes" do
81
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
82
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
83
+ <foreword>
84
+ <note id="note1">
85
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
48
86
  </note>
49
87
  <note id="note2">
50
88
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
@@ -59,21 +97,21 @@ INPUT
59
97
  <div class="WordSection1">
60
98
  <p>&#160;</p>
61
99
  </div>
62
- <br clear="all" class="section"/>
100
+ <br/>
63
101
  <div class="WordSection2">
64
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
102
+ <br/>
65
103
  <div>
66
104
  <h1 class="ForewordTitle">Foreword</h1>
67
105
  <div id="note1" class="Note">
68
- <p class="Note">NOTE 1<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
106
+ <p class="Note">NOTE 1&#160; These results are based on a study carried out on three different types of kernel.</p>
69
107
  </div>
70
108
  <div id="note2" class="Note">
71
- <p class="Note">NOTE 2<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
109
+ <p class="Note">NOTE 2&#160; These results are based on a study carried out on three different types of kernel.</p>
72
110
  </div>
73
111
  </div>
74
112
  <p>&#160;</p>
75
113
  </div>
76
- <br clear="all" class="section"/>
114
+ <br/>
77
115
  <div class="WordSection3">
78
116
  <p class="zzSTDTitle1"/>
79
117
  </div>
@@ -101,19 +139,19 @@ INPUT
101
139
  <div class="WordSection1">
102
140
  <p>&#160;</p>
103
141
  </div>
104
- <br clear="all" class="section"/>
142
+ <br/>
105
143
  <div class="WordSection2">
106
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
144
+ <br/>
107
145
  <div>
108
146
  <h1 class="ForewordTitle">Foreword</h1>
109
147
  <div id="" class="Note">
110
- <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
148
+ <p class="Note">NOTE&#160; These results are based on a study carried out on three different types of kernel.</p>
111
149
  <p class="Note" id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
112
150
  </div>
113
151
  </div>
114
152
  <p>&#160;</p>
115
153
  </div>
116
- <br clear="all" class="section"/>
154
+ <br/>
117
155
  <div class="WordSection3">
118
156
  <p class="zzSTDTitle1"/>
119
157
  </div>
@@ -145,12 +183,12 @@ INPUT
145
183
  <div class="WordSection1">
146
184
  <p>&#160;</p>
147
185
  </div>
148
- <br clear="all" class="section"/>
186
+ <br/>
149
187
  <div class="WordSection2">
150
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
188
+ <br/>
151
189
  <div>
152
190
  <h1 class="ForewordTitle">Foreword</h1>
153
- <div id="" class="Note"><p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span></p>
191
+ <div id="" class="Note"><p class="Note">NOTE&#160; </p>
154
192
  <dl><dt><p class="Note">A</p></dt><dd><p class="Note">B</p></dd></dl>
155
193
  <ul>
156
194
  <li>C</li></ul>
@@ -158,7 +196,7 @@ INPUT
158
196
  </div>
159
197
  <p>&#160;</p>
160
198
  </div>
161
- <br clear="all" class="section"/>
199
+ <br/>
162
200
  <div class="WordSection3">
163
201
  <p class="zzSTDTitle1"/>
164
202
  </div>
@@ -191,9 +229,9 @@ INPUT
191
229
  <div class="WordSection1">
192
230
  <p>&#160;</p>
193
231
  </div>
194
- <br clear="all" class="section"/>
232
+ <br/>
195
233
  <div class="WordSection2">
196
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
234
+ <br/>
197
235
  <div>
198
236
  <h1 class="ForewordTitle">Foreword</h1>
199
237
  <div id="figureA-1" class="figure">
@@ -204,7 +242,7 @@ INPUT
204
242
  </div>
205
243
  <p>&#160;</p>
206
244
  </div>
207
- <br clear="all" class="section"/>
245
+ <br/>
208
246
  <div class="WordSection3">
209
247
  <p class="zzSTDTitle1"/>
210
248
  </div>
@@ -231,9 +269,9 @@ INPUT
231
269
  <div class="WordSection1">
232
270
  <p>&#160;</p>
233
271
  </div>
234
- <br clear="all" class="section"/>
272
+ <br/>
235
273
  <div class="WordSection2">
236
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
274
+ <br/>
237
275
  <div>
238
276
  <h1 class="ForewordTitle">Foreword</h1>
239
277
  <table id="samplecode" class="example">
@@ -247,7 +285,7 @@ INPUT
247
285
  </div>
248
286
  <p>&#160;</p>
249
287
  </div>
250
- <br clear="all" class="section"/>
288
+ <br/>
251
289
  <div class="WordSection3">
252
290
  <p class="zzSTDTitle1"/>
253
291
  </div>
@@ -278,9 +316,9 @@ INPUT
278
316
  <div class="WordSection1">
279
317
  <p>&#160;</p>
280
318
  </div>
281
- <br clear="all" class="section"/>
319
+ <br/>
282
320
  <div class="WordSection2">
283
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
321
+ <br/>
284
322
  <div>
285
323
  <h1 class="ForewordTitle">Foreword</h1>
286
324
  <table id="samplecode" class="example">
@@ -301,7 +339,7 @@ INPUT
301
339
  </div>
302
340
  <p>&#160;</p>
303
341
  </div>
304
- <br clear="all" class="section"/>
342
+ <br/>
305
343
  <div class="WordSection3">
306
344
  <p class="zzSTDTitle1"/>
307
345
  </div>
@@ -329,16 +367,16 @@ INPUT
329
367
  <div class="WordSection1">
330
368
  <p>&#160;</p>
331
369
  </div>
332
- <br clear="all" class="section"/>
370
+ <br/>
333
371
  <div class="WordSection2">
334
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
372
+ <br/>
335
373
  <div>
336
374
  <h1 class="ForewordTitle">Foreword</h1>
337
375
  <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160;&#160;<br/>&#160;&#160;puts&#160;x<br/><p class="FigureTitle" align="center"><b>Ruby code</b></p></p>
338
376
  </div>
339
377
  <p>&#160;</p>
340
378
  </div>
341
- <br clear="all" class="section"/>
379
+ <br/>
342
380
  <div class="WordSection3">
343
381
  <p class="zzSTDTitle1"/>
344
382
  </div>
@@ -370,9 +408,9 @@ INPUT
370
408
  <div class="WordSection1">
371
409
  <p>&#160;</p>
372
410
  </div>
373
- <br clear="all" class="section"/>
411
+ <br/>
374
412
  <div class="WordSection2">
375
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
413
+ <br/>
376
414
  <div>
377
415
  <h1 class="ForewordTitle">Foreword</h1>
378
416
  <p id="_" class="Sourcecode">puts&#160;"Hello,&#160;world."&#160; &lt;1&gt;<br/>&#160;&#160;&#160;%w{a&#160;b&#160;c}.each&#160;do&#160;|x|<br/>&#160;&#160;&#160;&#160;&#160;puts&#160;x&#160; &lt;2&gt;<br/>&#160;&#160;&#160;end<span class="zzMoveToFollowing">&lt;1&gt; </span>
@@ -383,7 +421,7 @@ INPUT
383
421
  </div>
384
422
  <p>&#160;</p>
385
423
  </div>
386
- <br clear="all" class="section"/>
424
+ <br/>
387
425
  <div class="WordSection3">
388
426
  <p class="zzSTDTitle1"/>
389
427
  </div>
@@ -410,9 +448,9 @@ INPUT
410
448
  <div class="WordSection1">
411
449
  <p>&#160;</p>
412
450
  </div>
413
- <br clear="all" class="section"/>
451
+ <br/>
414
452
  <div class="WordSection2">
415
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
453
+ <br/>
416
454
  <div>
417
455
  <h1 class="ForewordTitle">Foreword</h1>
418
456
  <div class="Admonition"><title>CAUTION</title>
@@ -421,7 +459,7 @@ INPUT
421
459
  </div>
422
460
  <p>&#160;</p>
423
461
  </div>
424
- <br clear="all" class="section"/>
462
+ <br/>
425
463
  <div class="WordSection3">
426
464
  <p class="zzSTDTitle1"/>
427
465
  </div>
@@ -455,12 +493,12 @@ INPUT
455
493
  <div class="WordSection1">
456
494
  <p>&#160;</p>
457
495
  </div>
458
- <br clear="all" class="section"/>
496
+ <br/>
459
497
  <div class="WordSection2">
460
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
498
+ <br/>
461
499
  <div>
462
500
  <h1 class="ForewordTitle">Foreword</h1>
463
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(1)</div>
501
+ <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</div>
464
502
  <p>where</p>
465
503
  <dl>
466
504
  <dt>
@@ -473,7 +511,7 @@ INPUT
473
511
  </div>
474
512
  <p>&#160;</p>
475
513
  </div>
476
- <br clear="all" class="section"/>
514
+ <br/>
477
515
  <div class="WordSection3">
478
516
  <p class="zzSTDTitle1"/>
479
517
  </div>
@@ -489,7 +527,49 @@ INPUT
489
527
  <foreword>
490
528
  <p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
491
529
  Fictitious<br/>
492
- World
530
+ World</p>
531
+ <p align="justify">Justify</p>
532
+ </foreword>
533
+ </iso-standard>
534
+ INPUT
535
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
536
+ <head>
537
+ <title>test</title>
538
+ <body lang="EN-US" link="blue" vlink="#954F72">
539
+ <div class="WordSection1">
540
+ <p>&#160;</p>
541
+ </div>
542
+ <br/>
543
+ <div class="WordSection2">
544
+ <br/>
545
+ <div>
546
+ <h1 class="ForewordTitle">Foreword</h1>
547
+ <p id="_08bfe952-d57f-4150-9c95-5d52098cc2a8" align="left" style="text-align:left">Vache Equipment<br/>
548
+ Fictitious<br/>
549
+ World
550
+ </p>
551
+ <p style="text-align:justify">Justify</p>
552
+ </div>
553
+ <p>&#160;</p>
554
+ </div>
555
+ <br/>
556
+ <div class="WordSection3">
557
+ <p class="zzSTDTitle1"/>
558
+ </div>
559
+ </body>
560
+ </head>
561
+ </html>
562
+ OUTPUT
563
+ end
564
+
565
+ it "processes paragraph alignments (Word)" do
566
+ expect(IsoDoc::WordConvert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
567
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
568
+ <foreword>
569
+ <p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
570
+ Fictitious<br/>
571
+ World</p>
572
+ <p align="justify">Justify</p>
493
573
  </foreword>
494
574
  </iso-standard>
495
575
  INPUT
@@ -502,13 +582,14 @@ World
502
582
  </div>
503
583
  <br clear="all" class="section"/>
504
584
  <div class="WordSection2">
505
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
585
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
506
586
  <div>
507
587
  <h1 class="ForewordTitle">Foreword</h1>
508
588
  <p id="_08bfe952-d57f-4150-9c95-5d52098cc2a8" align="left" style="text-align:left">Vache Equipment<br/>
509
589
  Fictitious<br/>
510
590
  World
511
591
  </p>
592
+ <p style="text-align:justify">Justify</p>
512
593
  </div>
513
594
  <p>&#160;</p>
514
595
  </div>
@@ -522,6 +603,8 @@ World
522
603
  OUTPUT
523
604
  end
524
605
 
606
+
607
+
525
608
  it "processes blockquotes" do
526
609
  expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
527
610
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -542,9 +625,9 @@ World
542
625
  <div class="WordSection1">
543
626
  <p>&#160;</p>
544
627
  </div>
545
- <br clear="all" class="section"/>
628
+ <br/>
546
629
  <div class="WordSection2">
547
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
630
+ <br/>
548
631
  <div>
549
632
  <h1 class="ForewordTitle">Foreword</h1>
550
633
  <div class="Quote" id="_044bd364-c832-4b78-8fea-92242402a1d1">
@@ -555,7 +638,7 @@ World
555
638
  </div>
556
639
  <p>&#160;</p>
557
640
  </div>
558
- <br clear="all" class="section"/>
641
+ <br/>
559
642
  <div class="WordSection3">
560
643
  <p class="zzSTDTitle1"/>
561
644
  </div>
@@ -585,14 +668,14 @@ World
585
668
  <div class="WordSection1">
586
669
  <p>&#160;</p>
587
670
  </div>
588
- <br clear="all" class="section"/>
671
+ <br/>
589
672
  <div class="WordSection2">
590
673
  <p>&#160;</p>
591
674
  </div>
592
- <br clear="all" class="section"/>
675
+ <br/>
593
676
  <div class="WordSection3">
594
677
  <p class="zzSTDTitle1"/>
595
- <div><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
678
+ <div><h1>3.&#160; Terms and Definitions</h1><p>For the purposes of this document,
596
679
  the following terms and definitions apply.</p>
597
680
  <p>ISO and IEC maintain terminological databases for use in
598
681
  standardization at the following addresses:</p>