isodoc 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.tb.yml +20 -10
- data/lib/isodoc/blocks.rb +13 -13
- data/lib/isodoc/cleanup.rb +19 -3
- data/lib/isodoc/comments.rb +1 -1
- data/lib/isodoc/convert.rb +2 -0
- data/lib/isodoc/footnotes.rb +4 -2
- data/lib/isodoc/html.rb +28 -10
- data/lib/isodoc/i18n-en.yaml +9 -0
- data/lib/isodoc/i18n-fr.yaml +12 -3
- data/lib/isodoc/i18n-zh-Hans.yaml +10 -1
- data/lib/isodoc/i18n.rb +9 -2
- data/lib/isodoc/inline.rb +5 -6
- data/lib/isodoc/iso2wordhtml.rb +9 -6
- data/lib/isodoc/lists.rb +7 -5
- data/lib/isodoc/metadata.rb +27 -10
- data/lib/isodoc/references.rb +12 -6
- data/lib/isodoc/section.rb +17 -11
- data/lib/isodoc/table.rb +2 -4
- data/lib/isodoc/terms.rb +3 -3
- data/lib/isodoc/utils.rb +15 -14
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/wordconvert/comments.rb +1 -1
- data/lib/isodoc/wordconvert/wordconvertmodule.rb +51 -12
- data/lib/isodoc/xref_gen.rb +30 -26
- data/lib/isodoc/xref_sect_gen.rb +31 -13
- data/spec/assets/scripts.html +1 -0
- data/spec/isodoc/blocks_spec.rb +50 -49
- data/spec/isodoc/cleanup_spec.rb +6 -6
- data/spec/isodoc/footnotes_spec.rb +10 -2
- data/spec/isodoc/i18n_spec.rb +86 -54
- data/spec/isodoc/inline_spec.rb +22 -18
- data/spec/isodoc/lists_spec.rb +25 -11
- data/spec/isodoc/metadata_spec.rb +4 -3
- data/spec/isodoc/postproc_spec.rb +108 -42
- data/spec/isodoc/ref_spec.rb +9 -7
- data/spec/isodoc/section_spec.rb +162 -141
- data/spec/isodoc/table_spec.rb +18 -16
- data/spec/isodoc/terms_spec.rb +9 -9
- data/spec/isodoc/xref_spec.rb +153 -122
- metadata +3 -2
data/lib/isodoc/xref_gen.rb
CHANGED
@@ -36,11 +36,12 @@ module IsoDoc
|
|
36
36
|
|
37
37
|
SECTIONS_XPATH =
|
38
38
|
"//foreword | //introduction | //sections/terms | //annex | "\
|
39
|
-
"//sections/clause | //references
|
40
|
-
"//clause
|
39
|
+
"//sections/clause | //bibliography/references | "\
|
40
|
+
"//bibliography/clause".freeze
|
41
41
|
|
42
42
|
CHILD_NOTES_XPATH =
|
43
|
-
"./*[not(self::xmlns:
|
43
|
+
"./*[not(self::xmlns:clause) and "\
|
44
|
+
"not(self::xmlns:appendix)]//xmlns:note | ./xmlns:note".freeze
|
44
45
|
|
45
46
|
def note_anchor_names(sections)
|
46
47
|
sections.each do |s|
|
@@ -51,13 +52,13 @@ module IsoDoc
|
|
51
52
|
idx = notes.size == 1 ? "" : " #{i + 1}"
|
52
53
|
@anchors[n["id"]] = anchor_struct(idx, s, @note_xref_lbl)
|
53
54
|
end
|
54
|
-
note_anchor_names(s.xpath(ns("./
|
55
|
+
note_anchor_names(s.xpath(ns("./clause | ./appendix")))
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
59
|
CHILD_EXAMPLES_XPATH =
|
59
|
-
"./*[not(self::xmlns:
|
60
|
-
"./xmlns:example".freeze
|
60
|
+
"./*[not(self::xmlns:clause) and not(self::xmlns:appendix)]//"\
|
61
|
+
"xmlns:example | ./xmlns:example".freeze
|
61
62
|
|
62
63
|
def example_anchor_names(sections)
|
63
64
|
sections.each do |s|
|
@@ -67,20 +68,20 @@ module IsoDoc
|
|
67
68
|
idx = notes.size == 1 ? "" : " #{i + 1}"
|
68
69
|
@anchors[n["id"]] = anchor_struct(idx, s, @example_xref_lbl)
|
69
70
|
end
|
70
|
-
example_anchor_names(s.xpath(ns("./
|
71
|
+
example_anchor_names(s.xpath(ns("./clause | ./appendix")))
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
75
|
def list_anchor_names(sections)
|
75
76
|
sections.each do |s|
|
76
|
-
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//
|
77
|
-
s.xpath(ns(".//ol//ol"))
|
77
|
+
notes = s.xpath(ns(".//ol")) - s.xpath(ns(".//clause//ol")) -
|
78
|
+
s.xpath(ns(".//appendix//ol")) - s.xpath(ns(".//ol//ol"))
|
78
79
|
notes.each_with_index do |n, i|
|
79
80
|
idx = notes.size == 1 ? "" : " #{i + 1}"
|
80
81
|
@anchors[n["id"]] = anchor_struct(idx, s, @list_lbl)
|
81
82
|
list_item_anchor_names(n, @anchors[n["id"]], 1, "", notes.size != 1)
|
82
83
|
end
|
83
|
-
list_anchor_names(s.xpath(ns("./
|
84
|
+
list_anchor_names(s.xpath(ns("./clause | ./appendix")))
|
84
85
|
end
|
85
86
|
end
|
86
87
|
|
@@ -106,22 +107,9 @@ module IsoDoc
|
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
109
|
-
def middle_anchor_names(docxml)
|
110
|
-
symbols_abbrevs = docxml.at(ns("//sections/symbols-abbrevs"))
|
111
|
-
sect_num = 4
|
112
|
-
if symbols_abbrevs
|
113
|
-
section_names(symbols_abbrevs, sect_num.to_s, 1)
|
114
|
-
sect_num += 1
|
115
|
-
end
|
116
|
-
clause_names(docxml, sect_num)
|
117
|
-
termnote_anchor_names(docxml)
|
118
|
-
termexample_anchor_names(docxml)
|
119
|
-
end
|
120
|
-
|
121
110
|
# extract names for all anchors, xref and label
|
122
111
|
def anchor_names(docxml)
|
123
112
|
initial_anchor_names(docxml)
|
124
|
-
middle_anchor_names(docxml)
|
125
113
|
back_anchor_names(docxml)
|
126
114
|
# preempt clause notes with all other types of note
|
127
115
|
note_anchor_names(docxml.xpath(ns("//table | //example | //formula | "\
|
@@ -144,10 +132,26 @@ module IsoDoc
|
|
144
132
|
end
|
145
133
|
end
|
146
134
|
|
135
|
+
def anchor_struct_label(lbl, elem)
|
136
|
+
case elem
|
137
|
+
when @appendix_lbl then l10n("#{elem} #{lbl}")
|
138
|
+
else
|
139
|
+
lbl.to_s
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def anchor_struct_xref(lbl, elem)
|
144
|
+
case elem
|
145
|
+
when @formula_lbl then l10n("#{elem} (#{lbl})")
|
146
|
+
else
|
147
|
+
l10n("#{elem} #{lbl}")
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
147
151
|
def anchor_struct(lbl, container, elem)
|
148
|
-
ret = {
|
149
|
-
ret[:
|
150
|
-
|
152
|
+
ret = {}
|
153
|
+
ret[:label] = anchor_struct_label(lbl, elem)
|
154
|
+
ret[:xref] = anchor_struct_xref(lbl, elem)
|
151
155
|
ret[:xref].gsub!(/ $/, "")
|
152
156
|
ret[:container] = get_clause_id(container) unless container.nil?
|
153
157
|
ret
|
data/lib/isodoc/xref_sect_gen.rb
CHANGED
@@ -11,11 +11,17 @@ module IsoDoc
|
|
11
11
|
|
12
12
|
def initial_anchor_names(d)
|
13
13
|
introduction_names(d.at(ns("//introduction")))
|
14
|
-
|
15
|
-
section_names(d.at(ns(
|
16
|
-
|
17
|
-
|
14
|
+
n = 0
|
15
|
+
n = section_names(d.at(ns("//clause[title = 'Scope']")), n, 1)
|
16
|
+
n = section_names(d.at(ns(
|
17
|
+
"//references[title = 'Normative References']")), n, 1)
|
18
|
+
n = section_names(d.at(ns("//sections/terms | "\
|
19
|
+
"//sections/clause[descendant::terms]")), n, 1)
|
20
|
+
n = section_names(d.at(ns("//sections/symbols-abbrevs")), n, 1)
|
18
21
|
middle_section_asset_names(d)
|
22
|
+
clause_names(d, n)
|
23
|
+
termnote_anchor_names(d)
|
24
|
+
termexample_anchor_names(d)
|
19
25
|
end
|
20
26
|
|
21
27
|
def middle_section_asset_names(d)
|
@@ -27,34 +33,37 @@ module IsoDoc
|
|
27
33
|
end
|
28
34
|
|
29
35
|
def clause_names(docxml, sect_num)
|
30
|
-
q = "//clause[parent::sections][not(xmlns:title = 'Scope')]
|
36
|
+
q = "//clause[parent::sections][not(xmlns:title = 'Scope')]"\
|
37
|
+
"[not(descendant::terms)]"
|
31
38
|
docxml.xpath(ns(q)).each_with_index do |c, i|
|
32
|
-
section_names(c, (i + sect_num)
|
39
|
+
section_names(c, (i + sect_num), 1)
|
33
40
|
end
|
34
41
|
end
|
35
42
|
|
36
43
|
def introduction_names(clause)
|
37
44
|
return if clause.nil?
|
38
|
-
clause.xpath(ns("./
|
45
|
+
clause.xpath(ns("./clause")).each_with_index do |c, i|
|
39
46
|
section_names1(c, "0.#{i + 1}", 2)
|
40
47
|
end
|
41
48
|
end
|
42
49
|
|
43
50
|
def section_names(clause, num, lvl)
|
44
|
-
return if clause.nil?
|
51
|
+
return num if clause.nil?
|
52
|
+
num = num + 1
|
45
53
|
@anchors[clause["id"]] =
|
46
|
-
{ label: num, xref: l10n("#{@clause_lbl} #{num}"), level: lvl }
|
47
|
-
clause.xpath(ns("./
|
54
|
+
{ label: num.to_s, xref: l10n("#{@clause_lbl} #{num}"), level: lvl }
|
55
|
+
clause.xpath(ns("./clause | ./term | ./terms | ./symbols-abbrevs")).
|
48
56
|
each_with_index do |c, i|
|
49
57
|
section_names1(c, "#{num}.#{i + 1}", lvl + 1)
|
50
58
|
end
|
59
|
+
num
|
51
60
|
end
|
52
61
|
|
53
62
|
def section_names1(clause, num, level)
|
54
63
|
@anchors[clause["id"]] =
|
55
64
|
{ label: num, level: level, xref: num }
|
56
65
|
# subclauses are not prefixed with "Clause"
|
57
|
-
clause.xpath(ns("./
|
66
|
+
clause.xpath(ns("./clause | ./terms | ./term | ./symbols-abbrevs")).
|
58
67
|
each_with_index do |c, i|
|
59
68
|
section_names1(c, "#{num}.#{i + 1}", level + 1)
|
60
69
|
end
|
@@ -66,17 +75,26 @@ module IsoDoc
|
|
66
75
|
label = l10n("<b>#{@annex_lbl} #{num}</b><br/>#{obl}")
|
67
76
|
@anchors[clause["id"]] =
|
68
77
|
{ label: label, xref: "#{@annex_lbl} #{num}", level: 1 }
|
69
|
-
clause.xpath(ns("./
|
78
|
+
clause.xpath(ns("./clause")).each_with_index do |c, i|
|
70
79
|
annex_names1(c, "#{num}.#{i + 1}", 2)
|
71
80
|
end
|
81
|
+
appendix_names(clause, num)
|
72
82
|
hierarchical_asset_names(clause, num)
|
73
83
|
end
|
74
84
|
|
75
85
|
def annex_names1(clause, num, level)
|
76
86
|
@anchors[clause["id"]] = { label: num, xref: num, level: level }
|
77
|
-
clause.xpath(ns(".//
|
87
|
+
clause.xpath(ns(".//clause")).each_with_index do |c, i|
|
78
88
|
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
79
89
|
end
|
80
90
|
end
|
91
|
+
|
92
|
+
def appendix_names(clause, num)
|
93
|
+
clause.xpath(ns("./appendix")).each_with_index do |c, i|
|
94
|
+
@anchors[c["id"]] = anchor_struct(i + 1, nil, @appendix_lbl)
|
95
|
+
@anchors[c["id"]][:level] = 2
|
96
|
+
@anchors[c["id"]][:container] = clause["id"]
|
97
|
+
end
|
98
|
+
end
|
81
99
|
end
|
82
100
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
This is a script
|
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -4,11 +4,11 @@ RSpec.describe IsoDoc do
|
|
4
4
|
it "processes unlabelled notes" do
|
5
5
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
-
<foreword>
|
7
|
+
<preface><foreword>
|
8
8
|
<note>
|
9
9
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
10
10
|
</note>
|
11
|
-
</foreword>
|
11
|
+
</foreword></preface>
|
12
12
|
</iso-standard>
|
13
13
|
INPUT
|
14
14
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -24,7 +24,7 @@ RSpec.describe IsoDoc do
|
|
24
24
|
<div>
|
25
25
|
<h1 class="ForewordTitle">Foreword</h1>
|
26
26
|
<div id="" class="Note">
|
27
|
-
<p class="Note">NOTE
|
27
|
+
<p class="Note"><span class="note_label">NOTE</span>  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> </p>
|
@@ -42,11 +42,11 @@ RSpec.describe IsoDoc do
|
|
42
42
|
it "processes labelled notes" do
|
43
43
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
44
44
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
45
|
-
<foreword>
|
45
|
+
<preface><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
48
|
</note>
|
49
|
-
</foreword>
|
49
|
+
</foreword></preface>
|
50
50
|
</iso-standard>
|
51
51
|
INPUT
|
52
52
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -62,7 +62,7 @@ INPUT
|
|
62
62
|
<div>
|
63
63
|
<h1 class="ForewordTitle">Foreword</h1>
|
64
64
|
<div id="note1" class="Note">
|
65
|
-
<p class="Note">NOTE
|
65
|
+
<p class="Note"><span class="note_label">NOTE</span>  These results are based on a study carried out on three different types of kernel.</p>
|
66
66
|
</div>
|
67
67
|
</div>
|
68
68
|
<p> </p>
|
@@ -80,14 +80,14 @@ INPUT
|
|
80
80
|
it "processes sequences of notes" do
|
81
81
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
82
82
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
83
|
-
<foreword>
|
83
|
+
<preface><foreword>
|
84
84
|
<note id="note1">
|
85
85
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
86
86
|
</note>
|
87
87
|
<note id="note2">
|
88
88
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
|
89
89
|
</note>
|
90
|
-
</foreword>
|
90
|
+
</foreword></preface>
|
91
91
|
</iso-standard>
|
92
92
|
INPUT
|
93
93
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -103,10 +103,10 @@ INPUT
|
|
103
103
|
<div>
|
104
104
|
<h1 class="ForewordTitle">Foreword</h1>
|
105
105
|
<div id="note1" class="Note">
|
106
|
-
<p class="Note">NOTE 1
|
106
|
+
<p class="Note"><span class="note_label">NOTE 1</span>  These results are based on a study carried out on three different types of kernel.</p>
|
107
107
|
</div>
|
108
108
|
<div id="note2" class="Note">
|
109
|
-
<p class="Note">NOTE 2
|
109
|
+
<p class="Note"><span class="note_label">NOTE 2</span>  These results are based on a study carried out on three different types of kernel.</p>
|
110
110
|
</div>
|
111
111
|
</div>
|
112
112
|
<p> </p>
|
@@ -124,12 +124,12 @@ INPUT
|
|
124
124
|
it "processes multi-para notes" do
|
125
125
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
126
126
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
127
|
-
<foreword>
|
127
|
+
<preface><foreword>
|
128
128
|
<note>
|
129
129
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
130
130
|
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
|
131
131
|
</note>
|
132
|
-
</foreword>
|
132
|
+
</foreword></preface>
|
133
133
|
</iso-standard>
|
134
134
|
INPUT
|
135
135
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -145,7 +145,7 @@ INPUT
|
|
145
145
|
<div>
|
146
146
|
<h1 class="ForewordTitle">Foreword</h1>
|
147
147
|
<div id="" class="Note">
|
148
|
-
<p class="Note">NOTE
|
148
|
+
<p class="Note"><span class="note_label">NOTE</span>  These results are based on a study carried out on three different types of kernel.</p>
|
149
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>
|
150
150
|
</div>
|
151
151
|
</div>
|
@@ -164,7 +164,7 @@ INPUT
|
|
164
164
|
it "processes non-para notes" do
|
165
165
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
166
166
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
167
|
-
<foreword>
|
167
|
+
<preface><foreword>
|
168
168
|
<note>
|
169
169
|
<dl>
|
170
170
|
<dt>A</dt>
|
@@ -173,7 +173,7 @@ INPUT
|
|
173
173
|
<ul>
|
174
174
|
<li>C</li></ul>
|
175
175
|
</note>
|
176
|
-
</foreword>
|
176
|
+
</foreword></preface>
|
177
177
|
</iso-standard>
|
178
178
|
INPUT
|
179
179
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -188,7 +188,7 @@ INPUT
|
|
188
188
|
<br/>
|
189
189
|
<div>
|
190
190
|
<h1 class="ForewordTitle">Foreword</h1>
|
191
|
-
<div id="" class="Note"><p class="Note">NOTE
|
191
|
+
<div id="" class="Note"><p class="Note"><span class="note_label">NOTE</span>  </p>
|
192
192
|
<dl><dt><p class="Note">A</p></dt><dd><p class="Note">B</p></dd></dl>
|
193
193
|
<ul>
|
194
194
|
<li>C</li></ul>
|
@@ -210,7 +210,7 @@ INPUT
|
|
210
210
|
it "processes figures" do
|
211
211
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
212
212
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
213
|
-
<foreword>
|
213
|
+
<preface><foreword>
|
214
214
|
<figure id="figureA-1">
|
215
215
|
<name>Split-it-right sample divider</name>
|
216
216
|
<image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
|
@@ -219,7 +219,7 @@ INPUT
|
|
219
219
|
<dd><p>B</p></dd>
|
220
220
|
</dl>
|
221
221
|
</figure>
|
222
|
-
</foreword>
|
222
|
+
</foreword></preface>
|
223
223
|
</iso-standard>
|
224
224
|
INPUT
|
225
225
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -238,7 +238,7 @@ INPUT
|
|
238
238
|
|
239
239
|
<img src="rice_images/rice_image1.png"/>
|
240
240
|
<p><b>Key</b></p><dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
|
241
|
-
<p class="FigureTitle" align="center"
|
241
|
+
<p class="FigureTitle" align="center">Figure 1 — Split-it-right sample divider</p></div>
|
242
242
|
</div>
|
243
243
|
<p> </p>
|
244
244
|
</div>
|
@@ -255,11 +255,11 @@ INPUT
|
|
255
255
|
it "processes examples" do
|
256
256
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
257
257
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
258
|
-
<foreword>
|
258
|
+
<preface><foreword>
|
259
259
|
<example id="samplecode">
|
260
260
|
<p>Hello</p>
|
261
261
|
</example>
|
262
|
-
</foreword>
|
262
|
+
</foreword></preface>
|
263
263
|
</iso-standard>
|
264
264
|
INPUT
|
265
265
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -276,8 +276,8 @@ INPUT
|
|
276
276
|
<h1 class="ForewordTitle">Foreword</h1>
|
277
277
|
<table id="samplecode" class="example">
|
278
278
|
<tr>
|
279
|
-
<td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE</td>
|
280
|
-
<td valign="top">
|
279
|
+
<td width="110pt" valign="top" class="example_label" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE</td>
|
280
|
+
<td valign="top" class="example">
|
281
281
|
<p>Hello</p>
|
282
282
|
</td>
|
283
283
|
</tr>
|
@@ -299,14 +299,14 @@ INPUT
|
|
299
299
|
it "processes sequences of examples" do
|
300
300
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
301
301
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
302
|
-
<foreword>
|
302
|
+
<preface><foreword>
|
303
303
|
<example id="samplecode">
|
304
304
|
<p>Hello</p>
|
305
305
|
</example>
|
306
|
-
<example id="samplecode2>
|
306
|
+
<example id="samplecode2">
|
307
307
|
<p>Hello</p>
|
308
308
|
</example>
|
309
|
-
</foreword>
|
309
|
+
</foreword></preface>
|
310
310
|
</iso-standard>
|
311
311
|
INPUT
|
312
312
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -323,19 +323,20 @@ INPUT
|
|
323
323
|
<h1 class="ForewordTitle">Foreword</h1>
|
324
324
|
<table id="samplecode" class="example">
|
325
325
|
<tr>
|
326
|
-
<td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 1</td>
|
327
|
-
<td valign="top">
|
326
|
+
<td width="110pt" valign="top" class="example_label" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 1</td>
|
327
|
+
<td valign="top" class="example">
|
328
328
|
<p>Hello</p>
|
329
329
|
</td>
|
330
330
|
</tr>
|
331
331
|
</table>
|
332
|
-
<table id="samplecode2
|
332
|
+
<table id="samplecode2" class="example">
|
333
333
|
<tr>
|
334
|
-
<td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 2</td>
|
335
|
-
<td valign="top"
|
334
|
+
<td width="110pt" valign="top" class="example_label" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 2</td>
|
335
|
+
<td valign="top" class="example">
|
336
|
+
<p>Hello</p>
|
337
|
+
</td>
|
336
338
|
</tr>
|
337
339
|
</table>
|
338
|
-
<p>Hello</p>
|
339
340
|
</div>
|
340
341
|
<p> </p>
|
341
342
|
</div>
|
@@ -352,12 +353,12 @@ INPUT
|
|
352
353
|
it "processes sourcecode" do
|
353
354
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
354
355
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
355
|
-
<foreword>
|
356
|
+
<preface><foreword>
|
356
357
|
<sourcecode id="samplecode">
|
357
358
|
<name>Ruby code</name>
|
358
359
|
puts x
|
359
360
|
</sourcecode>
|
360
|
-
</foreword>
|
361
|
+
</foreword></preface>
|
361
362
|
</iso-standard>
|
362
363
|
INPUT
|
363
364
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -372,7 +373,7 @@ INPUT
|
|
372
373
|
<br/>
|
373
374
|
<div>
|
374
375
|
<h1 class="ForewordTitle">Foreword</h1>
|
375
|
-
<p id="samplecode" class="Sourcecode"><br/>    <br/>  puts x<br/><p class="FigureTitle" align="center"
|
376
|
+
<p id="samplecode" class="Sourcecode"><br/>    <br/>  puts x<br/><p class="FigureTitle" align="center">Ruby code</p></p>
|
376
377
|
</div>
|
377
378
|
<p> </p>
|
378
379
|
</div>
|
@@ -389,7 +390,7 @@ INPUT
|
|
389
390
|
it "processes sourcecode with annotations" do
|
390
391
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
391
392
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
392
|
-
<foreword>
|
393
|
+
<preface><foreword>
|
393
394
|
<sourcecode id="_">puts "Hello, world." <callout target="A">1</callout>
|
394
395
|
%w{a b c}.each do |x|
|
395
396
|
puts x <callout target="B">2</callout>
|
@@ -398,7 +399,7 @@ INPUT
|
|
398
399
|
</annotation><annotation id="B">
|
399
400
|
<p id="_">This is another callout</p>
|
400
401
|
</annotation></sourcecode>
|
401
|
-
</foreword>
|
402
|
+
</foreword></preface>
|
402
403
|
</iso-standard>
|
403
404
|
INPUT
|
404
405
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -434,11 +435,11 @@ INPUT
|
|
434
435
|
it "processes admonitions" do
|
435
436
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
436
437
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
437
|
-
<foreword>
|
438
|
+
<preface><foreword>
|
438
439
|
<admonition id="_70234f78-64e5-4dfc-8b6f-f3f037348b6a" type="caution">
|
439
440
|
<p id="_e94663cc-2473-4ccc-9a72-983a74d989f2">Only use paddy or parboiled rice for the determination of husked rice yield.</p>
|
440
441
|
</admonition>
|
441
|
-
</foreword>
|
442
|
+
</foreword></preface>
|
442
443
|
</iso-standard>
|
443
444
|
INPUT
|
444
445
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -472,7 +473,7 @@ INPUT
|
|
472
473
|
it "processes formulae" do
|
473
474
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
474
475
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
475
|
-
<foreword>
|
476
|
+
<preface><foreword>
|
476
477
|
<formula id="_be9158af-7e93-4ee2-90c5-26d31c181934">
|
477
478
|
<stem type="AsciiMath">r = 1 %</stem>
|
478
479
|
<dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
|
@@ -483,7 +484,7 @@ INPUT
|
|
483
484
|
<p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
|
484
485
|
</dd>
|
485
486
|
</dl></formula>
|
486
|
-
</foreword>
|
487
|
+
</foreword></preface>
|
487
488
|
</iso-standard>
|
488
489
|
INPUT
|
489
490
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -524,12 +525,12 @@ INPUT
|
|
524
525
|
it "processes paragraph alignments" do
|
525
526
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
526
527
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
527
|
-
<foreword>
|
528
|
+
<preface><foreword>
|
528
529
|
<p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
|
529
530
|
Fictitious<br/>
|
530
531
|
World</p>
|
531
532
|
<p align="justify">Justify</p>
|
532
|
-
</foreword>
|
533
|
+
</foreword></preface>
|
533
534
|
</iso-standard>
|
534
535
|
INPUT
|
535
536
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -565,12 +566,12 @@ World</p>
|
|
565
566
|
it "processes paragraph alignments (Word)" do
|
566
567
|
expect(IsoDoc::WordConvert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
567
568
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
568
|
-
<foreword>
|
569
|
+
<preface><foreword>
|
569
570
|
<p align="left" id="_08bfe952-d57f-4150-9c95-5d52098cc2a8">Vache Equipment<br/>
|
570
571
|
Fictitious<br/>
|
571
572
|
World</p>
|
572
573
|
<p align="justify">Justify</p>
|
573
|
-
</foreword>
|
574
|
+
</foreword></preface>
|
574
575
|
</iso-standard>
|
575
576
|
INPUT
|
576
577
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -608,14 +609,14 @@ World</p>
|
|
608
609
|
it "processes blockquotes" do
|
609
610
|
expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
|
610
611
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
611
|
-
<foreword>
|
612
|
+
<preface><foreword>
|
612
613
|
<quote id="_044bd364-c832-4b78-8fea-92242402a1d1">
|
613
614
|
<source type="inline" bibitemid="ISO7301" citeas="ISO 7301: 2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source>
|
614
615
|
<author>ISO</author>
|
615
616
|
<p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<em>Oryza sativa</em> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p>
|
616
617
|
</quote>
|
617
618
|
|
618
|
-
</foreword>
|
619
|
+
</foreword></preface>
|
619
620
|
</iso-standard>
|
620
621
|
INPUT
|
621
622
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
@@ -675,7 +676,7 @@ World</p>
|
|
675
676
|
<br/>
|
676
677
|
<div class="WordSection3">
|
677
678
|
<p class="zzSTDTitle1"/>
|
678
|
-
<div><h1>
|
679
|
+
<div><h1>1.  Terms and Definitions</h1><p>For the purposes of this document,
|
679
680
|
the following terms and definitions apply.</p>
|
680
681
|
<p>ISO and IEC maintain terminological databases for use in
|
681
682
|
standardization at the following addresses:</p>
|
@@ -686,7 +687,7 @@ World</p>
|
|
686
687
|
<li> <p>IEC Electropedia: available at
|
687
688
|
<a href="http://www.electropedia.org">http://www.electropedia.org</a>
|
688
689
|
</p> </li> </ul>
|
689
|
-
<p class="TermNum" id="_extraneous_matter">
|
690
|
+
<p class="TermNum" id="_extraneous_matter">1.1</p><p class="Terms" style="text-align:left;">extraneous matter</p><p class="AltTerms" style="text-align:left;">EM</p>
|
690
691
|
|
691
692
|
<p id="_318b3939-be09-46c4-a284-93f9826b981e"><rice> organic and inorganic components other than whole or broken kernels</p>
|
692
693
|
</div>
|