isodoc 1.6.0 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -8
- data/Rakefile +2 -2
- data/bin/rspec +1 -2
- data/isodoc.gemspec +4 -3
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +10 -4
- data/lib/isodoc/css.rb +30 -26
- data/lib/isodoc/function/blocks.rb +26 -8
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/cleanup.rb +53 -45
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +8 -7
- data/lib/isodoc/function/references.rb +71 -77
- data/lib/isodoc/function/section.rb +28 -16
- data/lib/isodoc/function/table.rb +22 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/function/to_word_html.rb +19 -25
- data/lib/isodoc/function/utils.rb +180 -160
- data/lib/isodoc/gem_tasks.rb +36 -38
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +10 -4
- data/lib/isodoc/html_function/comments.rb +14 -12
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +191 -226
- data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/i18n.rb +33 -31
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/block.rb +17 -8
- data/lib/isodoc/presentation_function/inline.rb +72 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +55 -19
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/footnotes.rb +22 -15
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +11 -10
- data/lib/isodoc/xref/xref_counter.rb +32 -17
- data/lib/isodoc/xref/xref_gen.rb +33 -21
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +2258 -2622
- data/spec/isodoc/cleanup_spec.rb +1103 -1107
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +802 -917
- data/spec/isodoc/inline_spec.rb +1105 -921
- data/spec/isodoc/lists_spec.rb +316 -315
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +1783 -1549
- data/spec/isodoc/presentation_xml_spec.rb +355 -278
- data/spec/isodoc/ref_spec.rb +718 -723
- data/spec/isodoc/section_spec.rb +216 -199
- data/spec/isodoc/sectionsplit_spec.rb +190 -0
- data/spec/isodoc/table_spec.rb +41 -42
- data/spec/isodoc/terms_spec.rb +84 -84
- data/spec/isodoc/xref_spec.rb +1024 -930
- metadata +33 -7
@@ -0,0 +1,156 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe IsoDoc do
|
4
|
+
it "renders form" do
|
5
|
+
input = <<~INPUT
|
6
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
|
+
<sections>
|
8
|
+
<clause id="A">
|
9
|
+
<form action="/action_page.php" id="F0" name="F1">
|
10
|
+
<label for="fname">First name:</label><br/>
|
11
|
+
<input type="text" id="fname" name="fname"/><br/>
|
12
|
+
<label for="lname">Last name:</label><br/>
|
13
|
+
<input type="text" id="lname" name="lname"/><br/>
|
14
|
+
<label for="pwd">Password:</label><br/>
|
15
|
+
<input type="password" id="pwd" name="pwd"/><br/>
|
16
|
+
<input type="radio" id="male" name="gender" value="male"/>
|
17
|
+
<label for="male">Male</label><br/>
|
18
|
+
<input type="radio" id="female" name="gender" value="female"/>
|
19
|
+
<label for="female">Female</label><br/>
|
20
|
+
<input type="radio" id="other" name="gender" value="other"/>
|
21
|
+
<label for="other">Other</label><br/>
|
22
|
+
<input type="checkbox" id="vehicle1" name="vehicle1" value="Bike" checked="true"/>
|
23
|
+
<label for="vehicle1"> I have a bike</label><br/>
|
24
|
+
<input type="checkbox" id="vehicle2" name="vehicle2" value="Car"/>
|
25
|
+
<label for="vehicle2"> I have a car</label><br/>
|
26
|
+
<input type="checkbox" id="vehicle3" name="vehicle3" value="Boat"/>
|
27
|
+
<label for="vehicle3"> I have a boat</label><br/>
|
28
|
+
<input type="date" id="birthday" name="birthday"/><br/>
|
29
|
+
<label for="myfile">Select a file:</label>
|
30
|
+
<input type="file" id="myfile" name="myfile"/><br/>
|
31
|
+
<label for="cars">Select a car:</label>
|
32
|
+
<select id="cars" name="cars" value="fiat">
|
33
|
+
<option value="volvo">Volvo</option>
|
34
|
+
<option value="saab">Saab</option>
|
35
|
+
<option value="fiat">Fiat</option>
|
36
|
+
<option value="audi">Audi</option>
|
37
|
+
</select>
|
38
|
+
<textarea id="t1" name="message" rows="10" cols="30" value="The cat was playing in the garden."/>
|
39
|
+
<input type="button" value="Click Me!"/>
|
40
|
+
<input type="button"/>
|
41
|
+
<input type="submit" value="Submit"/>
|
42
|
+
</form>
|
43
|
+
</clause>
|
44
|
+
</sections>
|
45
|
+
</iso-standard>
|
46
|
+
INPUT
|
47
|
+
|
48
|
+
html = <<~HTML
|
49
|
+
#{HTML_HDR}
|
50
|
+
<p class='zzSTDTitle1'/>
|
51
|
+
<div id='A'>
|
52
|
+
<h1/>
|
53
|
+
<form id='F0' name='F1' action='/action_page.php'>
|
54
|
+
<label for='fname'>First name:</label>
|
55
|
+
<br/>
|
56
|
+
<input id='fname' name='fname' type='text'/>
|
57
|
+
<br/>
|
58
|
+
<label for='lname'>Last name:</label>
|
59
|
+
<br/>
|
60
|
+
<input id='lname' name='lname' type='text'/>
|
61
|
+
<br/>
|
62
|
+
<label for='pwd'>Password:</label>
|
63
|
+
<br/>
|
64
|
+
<input id='pwd' name='pwd' type='password'/>
|
65
|
+
<br/>
|
66
|
+
<input id='male' name='gender' type='radio' value='male'/>
|
67
|
+
<label for='male'>Male</label>
|
68
|
+
<br/>
|
69
|
+
<input id='female' name='gender' type='radio' value='female'/>
|
70
|
+
<label for='female'>Female</label>
|
71
|
+
<br/>
|
72
|
+
<input id='other' name='gender' type='radio' value='other'/>
|
73
|
+
<label for='other'>Other</label>
|
74
|
+
<br/>
|
75
|
+
<input id='vehicle1' name='vehicle1' type='checkbox' value='Bike' checked='true'/>
|
76
|
+
<label for='vehicle1'> I have a bike</label>
|
77
|
+
<br/>
|
78
|
+
<input id='vehicle2' name='vehicle2' type='checkbox' value='Car'/>
|
79
|
+
<label for='vehicle2'> I have a car</label>
|
80
|
+
<br/>
|
81
|
+
<input id='vehicle3' name='vehicle3' type='checkbox' value='Boat'/>
|
82
|
+
<label for='vehicle3'> I have a boat</label>
|
83
|
+
<br/>
|
84
|
+
<input id='birthday' name='birthday' type='date'/>
|
85
|
+
<br/>
|
86
|
+
<label for='myfile'>Select a file:</label>
|
87
|
+
<input id='myfile' name='myfile' type='file'/>
|
88
|
+
<br/>
|
89
|
+
<label for='cars'>Select a car:</label>
|
90
|
+
<select id='cars' name='cars'>
|
91
|
+
<option value='volvo'>Volvo</option>
|
92
|
+
<option value='saab'>Saab</option>
|
93
|
+
<option selected='true' value='fiat'>Fiat</option>
|
94
|
+
<option value='audi'>Audi</option>
|
95
|
+
</select>
|
96
|
+
<textarea id='t1' name='message' rows='10' cols='30'>The cat was playing in the garden.</textarea>
|
97
|
+
<input type='button' value='Click Me!'/>
|
98
|
+
<input type='button'/>
|
99
|
+
<input type='submit' value='Submit'/>
|
100
|
+
</form>
|
101
|
+
</div>
|
102
|
+
</div>
|
103
|
+
</body>
|
104
|
+
</html>
|
105
|
+
HTML
|
106
|
+
|
107
|
+
doc = <<~DOC
|
108
|
+
#{WORD_HDR}
|
109
|
+
<p class='zzSTDTitle1'/>
|
110
|
+
<div id='A'>
|
111
|
+
<h1/>
|
112
|
+
First name:
|
113
|
+
<br/>
|
114
|
+
__________
|
115
|
+
<br/>
|
116
|
+
Last name:
|
117
|
+
<br/>
|
118
|
+
__________
|
119
|
+
<br/>
|
120
|
+
Password:
|
121
|
+
<br/>
|
122
|
+
__________
|
123
|
+
<br/>
|
124
|
+
◎ Male
|
125
|
+
<br/>
|
126
|
+
◎ Female
|
127
|
+
<br/>
|
128
|
+
◎ Other
|
129
|
+
<br/>
|
130
|
+
☐ I have a bike
|
131
|
+
<br/>
|
132
|
+
☐ I have a car
|
133
|
+
<br/>
|
134
|
+
☐ I have a boat
|
135
|
+
<br/>
|
136
|
+
__________
|
137
|
+
<br/>
|
138
|
+
Select a file: __________
|
139
|
+
<br/>
|
140
|
+
Select a car: __________
|
141
|
+
<table border='1' width='50%'>
|
142
|
+
<tr>
|
143
|
+
<td/>
|
144
|
+
</tr>
|
145
|
+
</table>
|
146
|
+
[Click Me!] [BUTTON]
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
</body>
|
150
|
+
</html>
|
151
|
+
DOC
|
152
|
+
|
153
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(html)
|
154
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(doc)
|
155
|
+
end
|
156
|
+
end
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -65,169 +65,149 @@ RSpec.describe IsoDoc do
|
|
65
65
|
</clause>
|
66
66
|
</bibliography>
|
67
67
|
</iso-standard>
|
68
|
-
|
68
|
+
INPUT
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
</
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
(normative)
|
131
|
-
<br/>
|
132
|
-
<br/>
|
133
|
-
<strong>Annex</strong>
|
134
|
-
</title>
|
135
|
-
<clause id='Q' inline-header='false' obligation='normative'>
|
136
|
-
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
137
|
-
<clause id='Q1' inline-header='false' obligation='normative'>
|
138
|
-
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
139
|
-
</clause>
|
140
|
-
</clause>
|
141
|
-
</annex>
|
142
|
-
<bibliography>
|
143
|
-
<references id='R' obligation='informative' normative='true'>
|
144
|
-
<title depth='1'>2.<tab/>Normative References</title>
|
145
|
-
</references>
|
146
|
-
<clause id='S' obligation='informative'>
|
147
|
-
<title depth="1">Bibliography</title>
|
148
|
-
<references id='T' obligation='informative' normative='false'>
|
149
|
-
<title depth="2">Bibliography Subsection</title>
|
150
|
-
</references>
|
151
|
-
</clause>
|
152
|
-
</bibliography>
|
70
|
+
presxml = <<~"PRESXML"
|
71
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
72
|
+
<bibdata>
|
73
|
+
<language current="true">en</language>
|
74
|
+
</bibdata>
|
75
|
+
<preface>
|
76
|
+
<foreword obligation="informative" displayorder="1">
|
77
|
+
<title>Foreword</title>
|
78
|
+
<p id="A">See <xref target="M">Clause 5</xref></p>
|
79
|
+
</foreword>
|
80
|
+
<introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
81
|
+
<title depth="2">Introduction Subsection</title>
|
82
|
+
</clause>
|
83
|
+
</introduction></preface><sections>
|
84
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
85
|
+
<title depth="1">1.<tab/>Scope</title>
|
86
|
+
<p id="E">Text</p>
|
87
|
+
</clause>
|
88
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
89
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
90
|
+
<term id="J"><name>3.1.1.</name>
|
91
|
+
<preferred>Term2</preferred>
|
92
|
+
</term>
|
93
|
+
</terms>
|
94
|
+
<definitions id="K"><title>3.2.</title>
|
95
|
+
<dl>
|
96
|
+
<dt>Symbol</dt>
|
97
|
+
<dd>Definition</dd>
|
98
|
+
</dl>
|
99
|
+
</definitions>
|
100
|
+
</clause>
|
101
|
+
<definitions id="L" displayorder="6"><title>4.</title>
|
102
|
+
<dl>
|
103
|
+
<dt>Symbol</dt>
|
104
|
+
<dd>Definition</dd>
|
105
|
+
</dl>
|
106
|
+
</definitions>
|
107
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
108
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
109
|
+
</clause>
|
110
|
+
<clause id="O" inline-header="false" obligation="normative">
|
111
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
112
|
+
</clause></clause>
|
113
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
114
|
+
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
115
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
116
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
117
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
118
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
119
|
+
</clause>
|
120
|
+
</clause>
|
121
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
122
|
+
<title depth="1">2.<tab/>Normative References</title>
|
123
|
+
</references><clause id="S" obligation="informative" displayorder="9">
|
124
|
+
<title depth="1">Bibliography</title>
|
125
|
+
<references id="T" obligation="informative" normative="false">
|
126
|
+
<title depth="2">Bibliography Subsection</title>
|
127
|
+
</references>
|
128
|
+
</clause>
|
129
|
+
</bibliography>
|
153
130
|
</iso-standard>
|
154
|
-
PRESXML
|
155
|
-
|
156
|
-
output = <<~"OUTPUT"
|
157
|
-
#{HTML_HDR}
|
158
|
-
<br/>
|
159
|
-
<div>
|
160
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
161
|
-
<p id='A'>
|
162
|
-
See
|
163
|
-
<a href='#M'>Clause 5</a>
|
164
|
-
</p>
|
165
|
-
</div>
|
166
|
-
<br/>
|
167
|
-
<div class="Section3" id="B">
|
168
|
-
<h1 class="IntroTitle">Introduction</h1>
|
169
|
-
<div id="C">
|
170
|
-
<h2>Introduction Subsection</h2>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
<p class="zzSTDTitle1"/>
|
174
|
-
<div id="D">
|
175
|
-
<h1>1.  Scope</h1>
|
176
|
-
<p id="E">Text</p>
|
177
|
-
</div>
|
178
|
-
<div>
|
179
|
-
<h1>2.  Normative References</h1>
|
180
|
-
</div>
|
181
|
-
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
182
|
-
<div id="I">
|
183
|
-
<h2>3.1.  Normal Terms</h2>
|
184
|
-
<p class="TermNum" id="J">3.1.1.</p>
|
185
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
131
|
+
PRESXML
|
186
132
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
133
|
+
output = <<~"OUTPUT"
|
134
|
+
#{HTML_HDR}
|
135
|
+
<br/>
|
136
|
+
<div>
|
137
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
138
|
+
<p id='A'>
|
139
|
+
See
|
140
|
+
<a href='#M'>Clause 5</a>
|
141
|
+
</p>
|
142
|
+
</div>
|
143
|
+
<br/>
|
144
|
+
<div class="Section3" id="B">
|
145
|
+
<h1 class="IntroTitle">Introduction</h1>
|
146
|
+
<div id="C">
|
147
|
+
<h2>Introduction Subsection</h2>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
<p class="zzSTDTitle1"/>
|
151
|
+
<div id="D">
|
152
|
+
<h1>1.  Scope</h1>
|
153
|
+
<p id="E">Text</p>
|
154
|
+
</div>
|
155
|
+
<div>
|
156
|
+
<h1>2.  Normative References</h1>
|
157
|
+
</div>
|
158
|
+
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
159
|
+
<div id="I">
|
160
|
+
<h2>3.1.  Normal Terms</h2>
|
161
|
+
<p class="TermNum" id="J">3.1.1.</p>
|
162
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
163
|
+
</div><div id="K"><h2>3.2.</h2>
|
164
|
+
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
165
|
+
</div></div>
|
166
|
+
<div id="L" class="Symbols">
|
167
|
+
<h1>4.</h1>
|
168
|
+
<dl>
|
169
|
+
<dt>
|
170
|
+
<p>Symbol</p>
|
171
|
+
</dt>
|
172
|
+
<dd>Definition</dd>
|
173
|
+
</dl>
|
174
|
+
</div>
|
175
|
+
<div id="M">
|
176
|
+
<h1>5.  Clause 4</h1>
|
177
|
+
<div id="N">
|
178
|
+
<h2>5.1.  Introduction</h2>
|
179
|
+
</div>
|
180
|
+
<div id="O">
|
181
|
+
<h2>5.2.  Clause 4.2</h2>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
<br/>
|
185
|
+
<div id="P" class="Section3">
|
186
|
+
<h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
187
|
+
<div id="Q">
|
188
|
+
<h2>A.1.  Annex A.1</h2>
|
189
|
+
<div id="Q1">
|
190
|
+
<h3>A.1.1.  Annex A.1a</h3>
|
191
|
+
</div>
|
192
|
+
</div>
|
193
|
+
</div>
|
194
|
+
<br/>
|
195
|
+
<div>
|
196
|
+
<h1 class="Section3">Bibliography</h1>
|
197
|
+
<div>
|
198
|
+
<h2 class="Section3">Bibliography Subsection</h2>
|
199
|
+
</div>
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
</body>
|
203
|
+
</html>
|
228
204
|
OUTPUT
|
229
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
230
|
-
|
205
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
206
|
+
.new({}).convert("test", input, true)
|
207
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
208
|
+
.to be_equivalent_to xmlpp(presxml)
|
209
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
210
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
231
211
|
end
|
232
212
|
|
233
213
|
it "defaults to English" do
|
@@ -294,329 +274,75 @@ PRESXML
|
|
294
274
|
</clause>
|
295
275
|
</bibliography>
|
296
276
|
</iso-standard>
|
297
|
-
|
298
|
-
|
299
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
300
|
-
<bibdata>
|
301
|
-
<language current="true">tlh</language>
|
302
|
-
</bibdata>
|
303
|
-
<preface>
|
304
|
-
<foreword obligation='informative'>
|
305
|
-
<title>Foreword</title>
|
306
|
-
<p id='A'>See <xref target='M'>Clause 5</xref></p>
|
307
|
-
</foreword>
|
308
|
-
<introduction id='B' obligation='informative'>
|
309
|
-
<title>Introduction</title>
|
310
|
-
<clause id='C' inline-header='false' obligation='informative'>
|
311
|
-
<title depth='2'>Introduction Subsection</title>
|
312
|
-
</clause>
|
313
|
-
</introduction>
|
314
|
-
</preface>
|
315
|
-
<sections>
|
316
|
-
<clause id='D' obligation='normative' type="scope">
|
317
|
-
<title depth='1'>1.<tab/>Scope</title>
|
318
|
-
<p id='E'>Text</p>
|
319
|
-
</clause>
|
320
|
-
<clause id='H' obligation='normative'>
|
321
|
-
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
322
|
-
<terms id='I' obligation='normative'>
|
323
|
-
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
324
|
-
<term id='J'>
|
325
|
-
<name>3.1.1.</name>
|
326
|
-
<preferred>Term2</preferred>
|
327
|
-
</term>
|
328
|
-
</terms>
|
329
|
-
<definitions id='K'>
|
330
|
-
<title>3.2.</title>
|
331
|
-
<dl>
|
332
|
-
<dt>Symbol</dt>
|
333
|
-
<dd>Definition</dd>
|
334
|
-
</dl>
|
335
|
-
</definitions>
|
336
|
-
</clause>
|
337
|
-
<definitions id='L'>
|
338
|
-
<title>4.</title>
|
339
|
-
<dl>
|
340
|
-
<dt>Symbol</dt>
|
341
|
-
<dd>Definition</dd>
|
342
|
-
</dl>
|
343
|
-
</definitions>
|
344
|
-
<clause id='M' inline-header='false' obligation='normative'>
|
345
|
-
<title depth='1'>5.<tab/>Clause 4</title>
|
346
|
-
<clause id='N' inline-header='false' obligation='normative'>
|
347
|
-
<title depth='2'>5.1.<tab/>Introduction</title>
|
348
|
-
</clause>
|
349
|
-
<clause id='O' inline-header='false' obligation='normative'>
|
350
|
-
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
351
|
-
</clause>
|
352
|
-
</clause>
|
353
|
-
</sections>
|
354
|
-
<annex id='P' inline-header='false' obligation='normative'>
|
355
|
-
<title>
|
356
|
-
<strong>Annex A</strong>
|
357
|
-
<br/>
|
358
|
-
(normative)
|
359
|
-
<br/>
|
360
|
-
<br/>
|
361
|
-
<strong>Annex</strong>
|
362
|
-
</title>
|
363
|
-
<clause id='Q' inline-header='false' obligation='normative'>
|
364
|
-
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
365
|
-
<clause id='Q1' inline-header='false' obligation='normative'>
|
366
|
-
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
367
|
-
</clause>
|
368
|
-
</clause>
|
369
|
-
</annex>
|
370
|
-
<bibliography>
|
371
|
-
<references id='R' obligation='informative' normative='true'>
|
372
|
-
<title depth='1'>2.<tab/>Normative References</title>
|
373
|
-
</references>
|
374
|
-
<clause id='S' obligation='informative'>
|
375
|
-
<title depth="1">Bibliography</title>
|
376
|
-
<references id='T' obligation='informative' normative='false'>
|
377
|
-
<title depth="2">Bibliography Subsection</title>
|
378
|
-
</references>
|
379
|
-
</clause>
|
380
|
-
</bibliography>
|
381
|
-
</iso-standard>
|
382
|
-
OUTPUT
|
383
|
-
end
|
384
|
-
|
385
|
-
it "processes French" do
|
386
|
-
input = <<~"INPUT"
|
387
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
277
|
+
INPUT
|
278
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
388
279
|
<bibdata>
|
389
|
-
<language>
|
280
|
+
<language current="true">tlh</language>
|
390
281
|
</bibdata>
|
391
282
|
<preface>
|
392
|
-
<foreword obligation="informative">
|
283
|
+
<foreword obligation="informative" displayorder="1">
|
393
284
|
<title>Foreword</title>
|
394
|
-
<p id="A">See <xref target="M"
|
285
|
+
<p id="A">See <xref target="M">Clause 5</xref></p>
|
395
286
|
</foreword>
|
396
|
-
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
397
|
-
<title>Introduction Subsection</title>
|
287
|
+
<introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
288
|
+
<title depth="2">Introduction Subsection</title>
|
398
289
|
</clause>
|
399
290
|
</introduction></preface><sections>
|
400
|
-
<clause id="D" obligation="normative" type="scope">
|
401
|
-
<title>Scope</title>
|
291
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
292
|
+
<title depth="1">1.<tab/>Scope</title>
|
402
293
|
<p id="E">Text</p>
|
403
294
|
</clause>
|
404
|
-
|
405
|
-
|
406
|
-
<
|
407
|
-
<term id="J">
|
295
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
296
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
297
|
+
<term id="J"><name>3.1.1.</name>
|
408
298
|
<preferred>Term2</preferred>
|
409
299
|
</term>
|
410
300
|
</terms>
|
411
|
-
<definitions id="K">
|
301
|
+
<definitions id="K"><title>3.2.</title>
|
412
302
|
<dl>
|
413
303
|
<dt>Symbol</dt>
|
414
304
|
<dd>Definition</dd>
|
415
305
|
</dl>
|
416
306
|
</definitions>
|
417
307
|
</clause>
|
418
|
-
<definitions id="L">
|
308
|
+
<definitions id="L" displayorder="6"><title>4.</title>
|
419
309
|
<dl>
|
420
310
|
<dt>Symbol</dt>
|
421
311
|
<dd>Definition</dd>
|
422
312
|
</dl>
|
423
313
|
</definitions>
|
424
|
-
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
425
|
-
<title>Introduction</title>
|
314
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
315
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
426
316
|
</clause>
|
427
317
|
<clause id="O" inline-header="false" obligation="normative">
|
428
|
-
<title>Clause 4.2</title>
|
318
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
429
319
|
</clause></clause>
|
430
|
-
|
431
|
-
|
432
|
-
<title>Annex</title>
|
320
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
321
|
+
<title><strong>Annex A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
433
322
|
<clause id="Q" inline-header="false" obligation="normative">
|
434
|
-
<title>Annex A.1</title>
|
323
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
435
324
|
<clause id="Q1" inline-header="false" obligation="normative">
|
436
|
-
<title>Annex A.1a</title>
|
325
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
437
326
|
</clause>
|
438
327
|
</clause>
|
439
|
-
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
440
|
-
<title>Normative References</title>
|
441
|
-
</references><clause id="S" obligation="informative">
|
442
|
-
<title>
|
328
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
329
|
+
<title depth="1">2.<tab/>Normative References</title>
|
330
|
+
</references><clause id="S" obligation="informative" displayorder="9">
|
331
|
+
<title depth="1">Bibliography</title>
|
443
332
|
<references id="T" obligation="informative" normative="false">
|
444
|
-
<title>Bibliography Subsection</title>
|
333
|
+
<title depth="2">Bibliography Subsection</title>
|
445
334
|
</references>
|
446
335
|
</clause>
|
447
336
|
</bibliography>
|
448
337
|
</iso-standard>
|
449
|
-
INPUT
|
450
|
-
|
451
|
-
presxml = <<~"PRESXML"
|
452
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
453
|
-
<bibdata>
|
454
|
-
<language current="true">fr</language>
|
455
|
-
</bibdata>
|
456
|
-
<preface>
|
457
|
-
<foreword obligation='informative'>
|
458
|
-
<title>Foreword</title>
|
459
|
-
<p id='A'>See <xref target='M'>Article 5</xref></p>
|
460
|
-
</foreword>
|
461
|
-
<introduction id='B' obligation='informative'>
|
462
|
-
<title>Introduction</title>
|
463
|
-
<clause id='C' inline-header='false' obligation='informative'>
|
464
|
-
<title depth='2'>Introduction Subsection</title>
|
465
|
-
</clause>
|
466
|
-
</introduction>
|
467
|
-
</preface>
|
468
|
-
<sections>
|
469
|
-
<clause id='D' obligation='normative' type="scope">
|
470
|
-
<title depth='1'>1.<tab/>Scope</title>
|
471
|
-
<p id='E'>Text</p>
|
472
|
-
</clause>
|
473
|
-
<clause id='H' obligation='normative'>
|
474
|
-
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
475
|
-
<terms id='I' obligation='normative'>
|
476
|
-
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
477
|
-
<term id='J'>
|
478
|
-
<name>3.1.1.</name>
|
479
|
-
<preferred>Term2</preferred>
|
480
|
-
</term>
|
481
|
-
</terms>
|
482
|
-
<definitions id='K'>
|
483
|
-
<title>3.2.</title>
|
484
|
-
<dl>
|
485
|
-
<dt>Symbol</dt>
|
486
|
-
<dd>Definition</dd>
|
487
|
-
</dl>
|
488
|
-
</definitions>
|
489
|
-
</clause>
|
490
|
-
<definitions id='L'>
|
491
|
-
<title>4.</title>
|
492
|
-
<dl>
|
493
|
-
<dt>Symbol</dt>
|
494
|
-
<dd>Definition</dd>
|
495
|
-
</dl>
|
496
|
-
</definitions>
|
497
|
-
<clause id='M' inline-header='false' obligation='normative'>
|
498
|
-
<title depth='1'>5.<tab/>Clause 4</title>
|
499
|
-
<clause id='N' inline-header='false' obligation='normative'>
|
500
|
-
<title depth='2'>5.1.<tab/>Introduction</title>
|
501
|
-
</clause>
|
502
|
-
<clause id='O' inline-header='false' obligation='normative'>
|
503
|
-
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
504
|
-
</clause>
|
505
|
-
</clause>
|
506
|
-
</sections>
|
507
|
-
<annex id='P' inline-header='false' obligation='normative'>
|
508
|
-
<title>
|
509
|
-
<strong>Annexe A</strong>
|
510
|
-
<br/>
|
511
|
-
(normative)
|
512
|
-
<br/>
|
513
|
-
<br/>
|
514
|
-
<strong>Annex</strong>
|
515
|
-
</title>
|
516
|
-
<clause id='Q' inline-header='false' obligation='normative'>
|
517
|
-
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
518
|
-
<clause id='Q1' inline-header='false' obligation='normative'>
|
519
|
-
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
520
|
-
</clause>
|
521
|
-
</clause>
|
522
|
-
</annex>
|
523
|
-
<bibliography>
|
524
|
-
<references id='R' obligation='informative' normative='true'>
|
525
|
-
<title depth='1'>2.<tab/>Normative References</title>
|
526
|
-
</references>
|
527
|
-
<clause id='S' obligation='informative'>
|
528
|
-
<title depth="1">Bibliographie</title>
|
529
|
-
<references id='T' obligation='informative' normative='false'>
|
530
|
-
<title depth="2">Bibliography Subsection</title>
|
531
|
-
</references>
|
532
|
-
</clause>
|
533
|
-
</bibliography>
|
534
|
-
</iso-standard>
|
535
|
-
PRESXML
|
536
|
-
|
537
|
-
output = <<~"OUTPUT"
|
538
|
-
#{HTML_HDR.gsub(/ lang="en">/, ' lang="fr">')}
|
539
|
-
<br/>
|
540
|
-
<div>
|
541
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
542
|
-
<p id='A'>
|
543
|
-
See
|
544
|
-
<a href='#M'>Article 5</a>
|
545
|
-
</p>
|
546
|
-
</div>
|
547
|
-
<br/>
|
548
|
-
<div class="Section3" id="B">
|
549
|
-
<h1 class="IntroTitle">Introduction</h1>
|
550
|
-
<div id="C">
|
551
|
-
<h2>Introduction Subsection</h2>
|
552
|
-
</div>
|
553
|
-
</div>
|
554
|
-
<p class="zzSTDTitle1"/>
|
555
|
-
<div id="D">
|
556
|
-
<h1>1.  Scope</h1>
|
557
|
-
<p id="E">Text</p>
|
558
|
-
</div>
|
559
|
-
<div>
|
560
|
-
<h1>2.  Normative References</h1>
|
561
|
-
</div>
|
562
|
-
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
563
|
-
<div id="I">
|
564
|
-
<h2>3.1.  Normal Terms</h2>
|
565
|
-
<p class="TermNum" id="J">3.1.1.</p>
|
566
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
567
|
-
|
568
|
-
</div><div id="K"><h2>3.2.</h2>
|
569
|
-
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
570
|
-
</div></div>
|
571
|
-
<div id="L" class="Symbols">
|
572
|
-
<h1>4.</h1>
|
573
|
-
<dl>
|
574
|
-
<dt>
|
575
|
-
<p>Symbol</p>
|
576
|
-
</dt>
|
577
|
-
<dd>Definition</dd>
|
578
|
-
</dl>
|
579
|
-
</div>
|
580
|
-
<div id="M">
|
581
|
-
<h1>5.  Clause 4</h1>
|
582
|
-
<div id="N">
|
583
|
-
<h2>5.1.  Introduction</h2>
|
584
|
-
</div>
|
585
|
-
<div id="O">
|
586
|
-
<h2>5.2.  Clause 4.2</h2>
|
587
|
-
</div>
|
588
|
-
</div>
|
589
|
-
<br/>
|
590
|
-
<div id="P" class="Section3">
|
591
|
-
<h1 class="Annex"><b>Annexe A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
592
|
-
<div id="Q">
|
593
|
-
<h2>A.1.  Annex A.1</h2>
|
594
|
-
<div id="Q1">
|
595
|
-
<h3>A.1.1.  Annex A.1a</h3>
|
596
|
-
</div>
|
597
|
-
</div>
|
598
|
-
</div>
|
599
|
-
<br/>
|
600
|
-
<div>
|
601
|
-
<h1 class="Section3">Bibliographie</h1>
|
602
|
-
<div>
|
603
|
-
<h2 class="Section3">Bibliography Subsection</h2>
|
604
|
-
</div>
|
605
|
-
</div>
|
606
|
-
</div>
|
607
|
-
</body>
|
608
|
-
</html>
|
609
338
|
OUTPUT
|
610
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
611
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
612
339
|
end
|
613
340
|
|
614
|
-
it "processes
|
341
|
+
it "processes French" do
|
615
342
|
input = <<~"INPUT"
|
616
343
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
617
344
|
<bibdata>
|
618
|
-
<language>
|
619
|
-
<script>Hans</script>
|
345
|
+
<language>fr</language>
|
620
346
|
</bibdata>
|
621
347
|
<preface>
|
622
348
|
<foreword obligation="informative">
|
@@ -629,7 +355,7 @@ PRESXML
|
|
629
355
|
</introduction></preface><sections>
|
630
356
|
<clause id="D" obligation="normative" type="scope">
|
631
357
|
<title>Scope</title>
|
632
|
-
<p id="E"
|
358
|
+
<p id="E">Text</p>
|
633
359
|
</clause>
|
634
360
|
|
635
361
|
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
@@ -668,537 +394,696 @@ PRESXML
|
|
668
394
|
</clause>
|
669
395
|
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
670
396
|
<title>Normative References</title>
|
671
|
-
<bibitem id="ISO712" type="standard">
|
672
|
-
<title format="text/plain">Cereals and cereal products</title>
|
673
|
-
<docidentifier>ISO 712</docidentifier>
|
674
|
-
<contributor>
|
675
|
-
<role type="publisher"/>
|
676
|
-
<organization>
|
677
|
-
<abbreviation>ISO</abbreviation>
|
678
|
-
</organization>
|
679
|
-
</contributor>
|
680
|
-
</bibitem>
|
681
397
|
</references><clause id="S" obligation="informative">
|
682
|
-
<title>
|
398
|
+
<title>Bibliographie</title>
|
683
399
|
<references id="T" obligation="informative" normative="false">
|
684
400
|
<title>Bibliography Subsection</title>
|
685
401
|
</references>
|
686
402
|
</clause>
|
687
403
|
</bibliography>
|
688
404
|
</iso-standard>
|
689
|
-
|
405
|
+
INPUT
|
690
406
|
|
691
|
-
|
692
|
-
|
693
|
-
<bibdata>
|
694
|
-
<language current="true">zh</language>
|
695
|
-
<script current="true">Hans</script>
|
696
|
-
</bibdata>
|
697
|
-
<preface>
|
698
|
-
<foreword obligation='informative'>
|
699
|
-
<title>Foreword</title>
|
700
|
-
<p id='A'>See <xref target='M'>条5</xref></p>
|
701
|
-
</foreword>
|
702
|
-
<introduction id='B' obligation='informative'>
|
703
|
-
<title>Introduction</title>
|
704
|
-
<clause id='C' inline-header='false' obligation='informative'>
|
705
|
-
<title depth='2'>Introduction Subsection</title>
|
706
|
-
</clause>
|
707
|
-
</introduction>
|
708
|
-
</preface>
|
709
|
-
<sections>
|
710
|
-
<clause id='D' obligation='normative' type="scope">
|
711
|
-
<title depth='1'>1.<tab/>Scope</title>
|
712
|
-
<p id='E'>
|
713
|
-
<eref type='inline' bibitemid='ISO712'><locality type='table'><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712、第1–1表</eref></p>
|
714
|
-
</clause>
|
715
|
-
<clause id='H' obligation='normative'>
|
716
|
-
<title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
|
717
|
-
<terms id='I' obligation='normative'>
|
718
|
-
<title depth='2'>3.1.<tab/>Normal Terms</title>
|
719
|
-
<term id='J'>
|
720
|
-
<name>3.1.1.</name>
|
721
|
-
<preferred>Term2</preferred>
|
722
|
-
</term>
|
723
|
-
</terms>
|
724
|
-
<definitions id='K'>
|
725
|
-
<title>3.2.</title>
|
726
|
-
<dl>
|
727
|
-
<dt>Symbol</dt>
|
728
|
-
<dd>Definition</dd>
|
729
|
-
</dl>
|
730
|
-
</definitions>
|
731
|
-
</clause>
|
732
|
-
<definitions id='L'>
|
733
|
-
<title>4.</title>
|
734
|
-
<dl>
|
735
|
-
<dt>Symbol</dt>
|
736
|
-
<dd>Definition</dd>
|
737
|
-
</dl>
|
738
|
-
</definitions>
|
739
|
-
<clause id='M' inline-header='false' obligation='normative'>
|
740
|
-
<title depth='1'>5.<tab/>Clause 4</title>
|
741
|
-
<clause id='N' inline-header='false' obligation='normative'>
|
742
|
-
<title depth='2'>5.1.<tab/>Introduction</title>
|
743
|
-
</clause>
|
744
|
-
<clause id='O' inline-header='false' obligation='normative'>
|
745
|
-
<title depth='2'>5.2.<tab/>Clause 4.2</title>
|
746
|
-
</clause>
|
747
|
-
</clause>
|
748
|
-
</sections>
|
749
|
-
<annex id='P' inline-header='false' obligation='normative'>
|
750
|
-
<title>
|
751
|
-
<strong>附件A</strong>
|
752
|
-
<br/>
|
753
|
-
(规范性附录)
|
754
|
-
<br/>
|
755
|
-
<br/>
|
756
|
-
<strong>Annex</strong>
|
757
|
-
</title>
|
758
|
-
<clause id='Q' inline-header='false' obligation='normative'>
|
759
|
-
<title depth='2'>A.1.<tab/>Annex A.1</title>
|
760
|
-
<clause id='Q1' inline-header='false' obligation='normative'>
|
761
|
-
<title depth='3'>A.1.1.<tab/>Annex A.1a</title>
|
762
|
-
</clause>
|
763
|
-
</clause>
|
764
|
-
</annex>
|
765
|
-
<bibliography>
|
766
|
-
<references id='R' obligation='informative' normative='true'>
|
767
|
-
<title depth='1'>2.<tab/>Normative References</title>
|
768
|
-
<bibitem id='ISO712' type='standard'>
|
769
|
-
<title format='text/plain'>Cereals and cereal products</title>
|
770
|
-
<docidentifier>ISO 712</docidentifier>
|
771
|
-
<contributor>
|
772
|
-
<role type='publisher'/>
|
773
|
-
<organization>
|
774
|
-
<abbreviation>ISO</abbreviation>
|
775
|
-
</organization>
|
776
|
-
</contributor>
|
777
|
-
</bibitem>
|
778
|
-
</references>
|
779
|
-
<clause id='S' obligation='informative'>
|
780
|
-
<title depth="1">Bibliography</title>
|
781
|
-
<references id='T' obligation='informative' normative='false'>
|
782
|
-
<title depth="2">Bibliography Subsection</title>
|
783
|
-
</references>
|
784
|
-
</clause>
|
785
|
-
</bibliography>
|
786
|
-
</iso-standard>
|
787
|
-
PRESXML
|
788
|
-
|
789
|
-
output = <<~"OUTPUT"
|
790
|
-
#{HTML_HDR.gsub(/ lang="en">/, ' lang="zh">')}
|
791
|
-
<br/>
|
792
|
-
<div>
|
793
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
794
|
-
<p id='A'>
|
795
|
-
See
|
796
|
-
<a href='#M'>条5</a>
|
797
|
-
</p>
|
798
|
-
</div>
|
799
|
-
<br/>
|
800
|
-
<div class="Section3" id="B">
|
801
|
-
<h1 class="IntroTitle">Introduction</h1>
|
802
|
-
<div id="C">
|
803
|
-
<h2>Introduction Subsection</h2>
|
804
|
-
</div>
|
805
|
-
</div>
|
806
|
-
<p class="zzSTDTitle1"/>
|
807
|
-
<div id="D">
|
808
|
-
<h1>1. Scope</h1>
|
809
|
-
<p id="E">
|
810
|
-
<a href='#ISO712'>ISO 712、第1–1表</a>
|
811
|
-
</p>
|
812
|
-
</div>
|
813
|
-
<div>
|
814
|
-
<h1>2. Normative References</h1>
|
815
|
-
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
|
816
|
-
</div>
|
817
|
-
<div id="H"><h1>3. Terms, definitions, symbols and abbreviated terms</h1>
|
818
|
-
<div id="I">
|
819
|
-
<h2>3.1. Normal Terms</h2>
|
820
|
-
<p class="TermNum" id="J">3.1.1.</p>
|
821
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
822
|
-
|
823
|
-
</div><div id="K"><h2>3.2.</h2>
|
824
|
-
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
825
|
-
</div></div>
|
826
|
-
<div id="L" class="Symbols">
|
827
|
-
<h1>4.</h1>
|
828
|
-
<dl>
|
829
|
-
<dt>
|
830
|
-
<p>Symbol</p>
|
831
|
-
</dt>
|
832
|
-
<dd>Definition</dd>
|
833
|
-
</dl>
|
834
|
-
</div>
|
835
|
-
<div id="M">
|
836
|
-
<h1>5. Clause 4</h1>
|
837
|
-
<div id="N">
|
838
|
-
<h2>5.1. Introduction</h2>
|
839
|
-
</div>
|
840
|
-
<div id="O">
|
841
|
-
<h2>5.2. Clause 4.2</h2>
|
842
|
-
</div>
|
843
|
-
</div>
|
844
|
-
<br/>
|
845
|
-
<div id="P" class="Section3">
|
846
|
-
<h1 class="Annex"><b>附件A</b><br/>(规范性附录)<br/><br/><b>Annex</b></h1>
|
847
|
-
<div id="Q">
|
848
|
-
<h2>A.1. Annex A.1</h2>
|
849
|
-
<div id="Q1">
|
850
|
-
<h3>A.1.1. Annex A.1a</h3>
|
851
|
-
</div>
|
852
|
-
</div>
|
853
|
-
</div>
|
854
|
-
<br/>
|
855
|
-
<div>
|
856
|
-
<h1 class="Section3">Bibliography</h1>
|
857
|
-
<div>
|
858
|
-
<h2 class="Section3">Bibliography Subsection</h2>
|
859
|
-
</div>
|
860
|
-
</div>
|
861
|
-
</div>
|
862
|
-
</body>
|
863
|
-
</html>
|
864
|
-
OUTPUT
|
865
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
|
866
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
867
|
-
end
|
868
|
-
|
869
|
-
it "processes i18n file" do
|
870
|
-
mock_i18n
|
871
|
-
input = <<~"INPUT"
|
872
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
407
|
+
presxml = <<~"PRESXML"
|
408
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
873
409
|
<bibdata>
|
874
|
-
<language>
|
875
|
-
<script>Latn</script>
|
876
|
-
<status>
|
877
|
-
<stage>published</stage>
|
878
|
-
<substage>withdrawn</substage>
|
879
|
-
</status>
|
880
|
-
<ext>
|
881
|
-
<doctype>brochure</doctype>
|
882
|
-
</ext>
|
410
|
+
<language current="true">fr</language>
|
883
411
|
</bibdata>
|
884
412
|
<preface>
|
885
|
-
<foreword obligation="informative">
|
413
|
+
<foreword obligation="informative" displayorder="1">
|
886
414
|
<title>Foreword</title>
|
887
|
-
<p id="A">See <xref target="M"
|
888
|
-
<p id="A">See <xref target="tab"/></p>
|
889
|
-
<table id="tab"/>
|
415
|
+
<p id="A">See <xref target="M">Article 5</xref></p>
|
890
416
|
</foreword>
|
891
|
-
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
892
|
-
<title>Introduction Subsection</title>
|
417
|
+
<introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
418
|
+
<title depth="2">Introduction Subsection</title>
|
893
419
|
</clause>
|
894
420
|
</introduction></preface><sections>
|
895
|
-
<clause id="D" obligation="normative" type="scope">
|
896
|
-
<title>Scope</title>
|
897
|
-
<p id="E"
|
421
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
422
|
+
<title depth="1">1.<tab/>Scope</title>
|
423
|
+
<p id="E">Text</p>
|
898
424
|
</clause>
|
899
|
-
|
900
|
-
|
901
|
-
<
|
902
|
-
<term id="J">
|
425
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
426
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
427
|
+
<term id="J"><name>3.1.1.</name>
|
903
428
|
<preferred>Term2</preferred>
|
904
429
|
</term>
|
905
430
|
</terms>
|
906
|
-
<definitions id="K">
|
431
|
+
<definitions id="K"><title>3.2.</title>
|
907
432
|
<dl>
|
908
433
|
<dt>Symbol</dt>
|
909
434
|
<dd>Definition</dd>
|
910
435
|
</dl>
|
911
436
|
</definitions>
|
912
437
|
</clause>
|
913
|
-
<definitions id="L">
|
438
|
+
<definitions id="L" displayorder="6"><title>4.</title>
|
914
439
|
<dl>
|
915
440
|
<dt>Symbol</dt>
|
916
441
|
<dd>Definition</dd>
|
917
442
|
</dl>
|
918
443
|
</definitions>
|
919
|
-
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
920
|
-
<title>Introduction</title>
|
921
|
-
<note id="M-n1"/>
|
444
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
445
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
922
446
|
</clause>
|
923
447
|
<clause id="O" inline-header="false" obligation="normative">
|
924
|
-
<title>Clause 4.2</title>
|
448
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
925
449
|
</clause></clause>
|
926
|
-
|
927
|
-
|
928
|
-
<title>Annex</title>
|
450
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
451
|
+
<title><strong>Annexe A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
929
452
|
<clause id="Q" inline-header="false" obligation="normative">
|
930
|
-
<title>Annex A.1</title>
|
453
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
931
454
|
<clause id="Q1" inline-header="false" obligation="normative">
|
932
|
-
<title>Annex A.1a</title>
|
455
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
933
456
|
</clause>
|
934
457
|
</clause>
|
935
|
-
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
936
|
-
<title>Normative References</title>
|
937
|
-
|
938
|
-
|
939
|
-
<docidentifier>ISO 712</docidentifier>
|
940
|
-
<contributor>
|
941
|
-
<role type="publisher"/>
|
942
|
-
<organization>
|
943
|
-
<abbreviation>ISO</abbreviation>
|
944
|
-
</organization>
|
945
|
-
</contributor>
|
946
|
-
</bibitem>
|
947
|
-
</references><clause id="S" obligation="informative">
|
948
|
-
<title>Bibliography</title>
|
458
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
459
|
+
<title depth="1">2.<tab/>Normative References</title>
|
460
|
+
</references><clause id="S" obligation="informative" displayorder="9">
|
461
|
+
<title depth="1">Bibliographie</title>
|
949
462
|
<references id="T" obligation="informative" normative="false">
|
950
|
-
<title>Bibliography Subsection</title>
|
463
|
+
<title depth="2">Bibliography Subsection</title>
|
951
464
|
</references>
|
952
465
|
</clause>
|
953
466
|
</bibliography>
|
954
467
|
</iso-standard>
|
955
|
-
|
468
|
+
PRESXML
|
956
469
|
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
<
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
<
|
969
|
-
<
|
970
|
-
<
|
971
|
-
</
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
<
|
976
|
-
<
|
977
|
-
<
|
978
|
-
|
979
|
-
<
|
980
|
-
<
|
981
|
-
|
982
|
-
<
|
983
|
-
<
|
984
|
-
<
|
985
|
-
<
|
986
|
-
<
|
987
|
-
|
988
|
-
<
|
989
|
-
|
990
|
-
<
|
991
|
-
<
|
992
|
-
<
|
993
|
-
<
|
994
|
-
<
|
995
|
-
|
996
|
-
<
|
997
|
-
|
998
|
-
|
999
|
-
<
|
1000
|
-
</
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
<
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
470
|
+
output = <<~"OUTPUT"
|
471
|
+
#{HTML_HDR.gsub(/ lang="en">/, ' lang="fr">')}
|
472
|
+
<br/>
|
473
|
+
<div>
|
474
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
475
|
+
<p id='A'>
|
476
|
+
See
|
477
|
+
<a href='#M'>Article 5</a>
|
478
|
+
</p>
|
479
|
+
</div>
|
480
|
+
<br/>
|
481
|
+
<div class="Section3" id="B">
|
482
|
+
<h1 class="IntroTitle">Introduction</h1>
|
483
|
+
<div id="C">
|
484
|
+
<h2>Introduction Subsection</h2>
|
485
|
+
</div>
|
486
|
+
</div>
|
487
|
+
<p class="zzSTDTitle1"/>
|
488
|
+
<div id="D">
|
489
|
+
<h1>1.  Scope</h1>
|
490
|
+
<p id="E">Text</p>
|
491
|
+
</div>
|
492
|
+
<div>
|
493
|
+
<h1>2.  Normative References</h1>
|
494
|
+
</div>
|
495
|
+
<div id="H"><h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
496
|
+
<div id="I">
|
497
|
+
<h2>3.1.  Normal Terms</h2>
|
498
|
+
<p class="TermNum" id="J">3.1.1.</p>
|
499
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
500
|
+
</div><div id="K"><h2>3.2.</h2>
|
501
|
+
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
502
|
+
</div></div>
|
503
|
+
<div id="L" class="Symbols">
|
504
|
+
<h1>4.</h1>
|
505
|
+
<dl>
|
506
|
+
<dt>
|
507
|
+
<p>Symbol</p>
|
508
|
+
</dt>
|
509
|
+
<dd>Definition</dd>
|
510
|
+
</dl>
|
511
|
+
</div>
|
512
|
+
<div id="M">
|
513
|
+
<h1>5.  Clause 4</h1>
|
514
|
+
<div id="N">
|
515
|
+
<h2>5.1.  Introduction</h2>
|
516
|
+
</div>
|
517
|
+
<div id="O">
|
518
|
+
<h2>5.2.  Clause 4.2</h2>
|
519
|
+
</div>
|
520
|
+
</div>
|
521
|
+
<br/>
|
522
|
+
<div id="P" class="Section3">
|
523
|
+
<h1 class="Annex"><b>Annexe A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
|
524
|
+
<div id="Q">
|
525
|
+
<h2>A.1.  Annex A.1</h2>
|
526
|
+
<div id="Q1">
|
527
|
+
<h3>A.1.1.  Annex A.1a</h3>
|
528
|
+
</div>
|
529
|
+
</div>
|
530
|
+
</div>
|
531
|
+
<br/>
|
532
|
+
<div>
|
533
|
+
<h1 class="Section3">Bibliographie</h1>
|
534
|
+
<div>
|
535
|
+
<h2 class="Section3">Bibliography Subsection</h2>
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
</div>
|
539
|
+
</body>
|
540
|
+
</html>
|
541
|
+
OUTPUT
|
542
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
543
|
+
.convert("test", input, true)
|
544
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
545
|
+
.to be_equivalent_to xmlpp(presxml)
|
546
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
547
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
548
|
+
end
|
1018
549
|
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
</clause>
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
550
|
+
it "processes Simplified Chinese" do
|
551
|
+
input = <<~"INPUT"
|
552
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
553
|
+
<bibdata>
|
554
|
+
<language>zh</language>
|
555
|
+
<script>Hans</script>
|
556
|
+
</bibdata>
|
557
|
+
<preface>
|
558
|
+
<foreword obligation="informative">
|
559
|
+
<title>Foreword</title>
|
560
|
+
<p id="A">See <xref target="M"/></p>
|
561
|
+
</foreword>
|
562
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
563
|
+
<title>Introduction Subsection</title>
|
564
|
+
</clause>
|
565
|
+
</introduction></preface><sections>
|
566
|
+
<clause id="D" obligation="normative" type="scope">
|
567
|
+
<title>Scope</title>
|
568
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
569
|
+
</clause>
|
570
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
571
|
+
<title>Normal Terms</title>
|
572
|
+
<term id="J">
|
573
|
+
<preferred>Term2</preferred>
|
574
|
+
</term>
|
575
|
+
</terms>
|
576
|
+
<definitions id="K">
|
577
|
+
<dl>
|
578
|
+
<dt>Symbol</dt>
|
579
|
+
<dd>Definition</dd>
|
580
|
+
</dl>
|
581
|
+
</definitions>
|
582
|
+
</clause>
|
583
|
+
<definitions id="L">
|
584
|
+
<dl>
|
585
|
+
<dt>Symbol</dt>
|
586
|
+
<dd>Definition</dd>
|
587
|
+
</dl>
|
588
|
+
</definitions>
|
589
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
590
|
+
<title>Introduction</title>
|
591
|
+
</clause>
|
592
|
+
<clause id="O" inline-header="false" obligation="normative">
|
593
|
+
<title>Clause 4.2</title>
|
594
|
+
</clause></clause>
|
595
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
596
|
+
<title>Annex</title>
|
597
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
598
|
+
<title>Annex A.1</title>
|
599
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
600
|
+
<title>Annex A.1a</title>
|
601
|
+
</clause>
|
602
|
+
</clause>
|
603
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
604
|
+
<title>Normative References</title>
|
605
|
+
<bibitem id="ISO712" type="standard">
|
606
|
+
<title format="text/plain">Cereals and cereal products</title>
|
607
|
+
<docidentifier>ISO 712</docidentifier>
|
608
|
+
<contributor>
|
609
|
+
<role type="publisher"/>
|
610
|
+
<organization>
|
611
|
+
<abbreviation>ISO</abbreviation>
|
612
|
+
</organization>
|
613
|
+
</contributor>
|
614
|
+
</bibitem>
|
615
|
+
</references><clause id="S" obligation="informative">
|
616
|
+
<title>Bibliography</title>
|
617
|
+
<references id="T" obligation="informative" normative="false">
|
618
|
+
<title>Bibliography Subsection</title>
|
619
|
+
</references>
|
620
|
+
</clause>
|
621
|
+
</bibliography>
|
622
|
+
</iso-standard>
|
623
|
+
INPUT
|
1045
624
|
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
625
|
+
presxml = <<~"PRESXML"
|
626
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
627
|
+
<bibdata>
|
628
|
+
<language current="true">zh</language>
|
629
|
+
<script current="true">Hans</script>
|
630
|
+
</bibdata>
|
631
|
+
<preface>
|
632
|
+
<foreword obligation="informative" displayorder="1">
|
633
|
+
<title>Foreword</title>
|
634
|
+
<p id="A">See <xref target="M">条5</xref></p>
|
635
|
+
</foreword>
|
636
|
+
<introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
637
|
+
<title depth="2">Introduction Subsection</title>
|
638
|
+
</clause>
|
639
|
+
</introduction></preface><sections>
|
640
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
641
|
+
<title depth="1">1.<tab/>Scope</title>
|
642
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712、第1–1表</eref></p>
|
643
|
+
</clause>
|
644
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
645
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
646
|
+
<term id="J"><name>3.1.1.</name>
|
647
|
+
<preferred>Term2</preferred>
|
648
|
+
</term>
|
649
|
+
</terms>
|
650
|
+
<definitions id="K"><title>3.2.</title>
|
651
|
+
<dl>
|
652
|
+
<dt>Symbol</dt>
|
653
|
+
<dd>Definition</dd>
|
654
|
+
</dl>
|
655
|
+
</definitions>
|
656
|
+
</clause>
|
657
|
+
<definitions id="L" displayorder="6"><title>4.</title>
|
658
|
+
<dl>
|
659
|
+
<dt>Symbol</dt>
|
660
|
+
<dd>Definition</dd>
|
661
|
+
</dl>
|
662
|
+
</definitions>
|
663
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
664
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
665
|
+
</clause>
|
666
|
+
<clause id="O" inline-header="false" obligation="normative">
|
667
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
668
|
+
</clause></clause>
|
669
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
670
|
+
<title><strong>附件A</strong><br/>(规范性附录)<br/><br/><strong>Annex</strong></title>
|
671
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
672
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
673
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
674
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
675
|
+
</clause>
|
676
|
+
</clause>
|
677
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
678
|
+
<title depth="1">2.<tab/>Normative References</title>
|
679
|
+
<bibitem id="ISO712" type="standard">
|
680
|
+
<title format="text/plain">Cereals and cereal products</title>
|
681
|
+
<docidentifier>ISO 712</docidentifier>
|
682
|
+
<contributor>
|
683
|
+
<role type="publisher"/>
|
684
|
+
<organization>
|
685
|
+
<abbreviation>ISO</abbreviation>
|
686
|
+
</organization>
|
687
|
+
</contributor>
|
688
|
+
</bibitem>
|
689
|
+
</references><clause id="S" obligation="informative" displayorder="9">
|
690
|
+
<title depth="1">Bibliography</title>
|
691
|
+
<references id="T" obligation="informative" normative="false">
|
692
|
+
<title depth="2">Bibliography Subsection</title>
|
693
|
+
</references>
|
694
|
+
</clause>
|
695
|
+
</bibliography>
|
696
|
+
</iso-standard>
|
697
|
+
PRESXML
|
1075
698
|
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
</
|
1096
|
-
<p id=
|
1097
|
-
|
1098
|
-
|
1099
|
-
</
|
1100
|
-
<
|
1101
|
-
<
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
699
|
+
output = <<~"OUTPUT"
|
700
|
+
#{HTML_HDR.gsub(/ lang="en">/, ' lang="zh">')}
|
701
|
+
<br/>
|
702
|
+
<div>
|
703
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
704
|
+
<p id='A'>
|
705
|
+
See
|
706
|
+
<a href='#M'>条5</a>
|
707
|
+
</p>
|
708
|
+
</div>
|
709
|
+
<br/>
|
710
|
+
<div class="Section3" id="B">
|
711
|
+
<h1 class="IntroTitle">Introduction</h1>
|
712
|
+
<div id="C">
|
713
|
+
<h2>Introduction Subsection</h2>
|
714
|
+
</div>
|
715
|
+
</div>
|
716
|
+
<p class="zzSTDTitle1"/>
|
717
|
+
<div id="D">
|
718
|
+
<h1>1. Scope</h1>
|
719
|
+
<p id="E">
|
720
|
+
<a href='#ISO712'>ISO 712、第1–1表</a>
|
721
|
+
</p>
|
722
|
+
</div>
|
723
|
+
<div>
|
724
|
+
<h1>2. Normative References</h1>
|
725
|
+
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
|
726
|
+
</div>
|
727
|
+
<div id="H"><h1>3. Terms, definitions, symbols and abbreviated terms</h1>
|
728
|
+
<div id="I">
|
729
|
+
<h2>3.1. Normal Terms</h2>
|
730
|
+
<p class="TermNum" id="J">3.1.1.</p>
|
731
|
+
<p class="Terms" style="text-align:left;">Term2</p>
|
732
|
+
</div><div id="K"><h2>3.2.</h2>
|
733
|
+
<dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
|
734
|
+
</div></div>
|
735
|
+
<div id="L" class="Symbols">
|
736
|
+
<h1>4.</h1>
|
737
|
+
<dl>
|
738
|
+
<dt>
|
739
|
+
<p>Symbol</p>
|
740
|
+
</dt>
|
741
|
+
<dd>Definition</dd>
|
742
|
+
</dl>
|
743
|
+
</div>
|
744
|
+
<div id="M">
|
745
|
+
<h1>5. Clause 4</h1>
|
746
|
+
<div id="N">
|
747
|
+
<h2>5.1. Introduction</h2>
|
748
|
+
</div>
|
749
|
+
<div id="O">
|
750
|
+
<h2>5.2. Clause 4.2</h2>
|
751
|
+
</div>
|
752
|
+
</div>
|
753
|
+
<br/>
|
754
|
+
<div id="P" class="Section3">
|
755
|
+
<h1 class="Annex"><b>附件A</b><br/>(规范性附录)<br/><br/><b>Annex</b></h1>
|
756
|
+
<div id="Q">
|
757
|
+
<h2>A.1. Annex A.1</h2>
|
758
|
+
<div id="Q1">
|
759
|
+
<h3>A.1.1. Annex A.1a</h3>
|
760
|
+
</div>
|
761
|
+
</div>
|
762
|
+
</div>
|
763
|
+
<br/>
|
764
|
+
<div>
|
765
|
+
<h1 class="Section3">Bibliography</h1>
|
766
|
+
<div>
|
767
|
+
<h2 class="Section3">Bibliography Subsection</h2>
|
768
|
+
</div>
|
769
|
+
</div>
|
770
|
+
</div>
|
771
|
+
</body>
|
772
|
+
</html>
|
773
|
+
OUTPUT
|
774
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
775
|
+
.convert("test", input, true)
|
776
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
777
|
+
.to be_equivalent_to xmlpp(presxml)
|
778
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
779
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
780
|
+
end
|
781
|
+
|
782
|
+
it "processes i18n file" do
|
783
|
+
mock_i18n
|
784
|
+
input = <<~"INPUT"
|
785
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
786
|
+
<bibdata>
|
787
|
+
<language>eo</language>
|
788
|
+
<script>Latn</script>
|
789
|
+
<status>
|
790
|
+
<stage>published</stage>
|
791
|
+
<substage>withdrawn</substage>
|
792
|
+
</status>
|
793
|
+
<ext>
|
794
|
+
<doctype>brochure</doctype>
|
795
|
+
</ext>
|
796
|
+
</bibdata>
|
797
|
+
<preface>
|
798
|
+
<foreword obligation="informative">
|
799
|
+
<title>Foreword</title>
|
800
|
+
<p id="A">See <xref target="M"/></p>
|
801
|
+
<p id="A">See <xref target="tab"/></p>
|
802
|
+
<table id="tab"/>
|
803
|
+
</foreword>
|
804
|
+
<introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
805
|
+
<title>Introduction Subsection</title>
|
806
|
+
</clause>
|
807
|
+
</introduction></preface><sections>
|
808
|
+
<clause id="D" obligation="normative" type="scope">
|
809
|
+
<title>Scope</title>
|
810
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
|
811
|
+
</clause>
|
812
|
+
<clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
813
|
+
<title>Normal Terms</title>
|
814
|
+
<term id="J">
|
815
|
+
<preferred>Term2</preferred>
|
816
|
+
</term>
|
817
|
+
</terms>
|
818
|
+
<definitions id="K">
|
1143
819
|
<dl>
|
1144
|
-
|
1145
|
-
|
1146
|
-
</dt>
|
1147
|
-
<dd>Definition</dd>
|
820
|
+
<dt>Symbol</dt>
|
821
|
+
<dd>Definition</dd>
|
1148
822
|
</dl>
|
1149
|
-
</
|
1150
|
-
|
1151
|
-
|
1152
|
-
<
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
</
|
1165
|
-
|
1166
|
-
|
1167
|
-
<
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
823
|
+
</definitions>
|
824
|
+
</clause>
|
825
|
+
<definitions id="L">
|
826
|
+
<dl>
|
827
|
+
<dt>Symbol</dt>
|
828
|
+
<dd>Definition</dd>
|
829
|
+
</dl>
|
830
|
+
</definitions>
|
831
|
+
<clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
832
|
+
<title>Introduction</title>
|
833
|
+
<note id="M-n1"/>
|
834
|
+
</clause>
|
835
|
+
<clause id="O" inline-header="false" obligation="normative">
|
836
|
+
<title>Clause 4.2</title>
|
837
|
+
</clause></clause>
|
838
|
+
</sections><annex id="P" inline-header="false" obligation="normative">
|
839
|
+
<title>Annex</title>
|
840
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
841
|
+
<title>Annex A.1</title>
|
842
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
843
|
+
<title>Annex A.1a</title>
|
844
|
+
</clause>
|
845
|
+
</clause>
|
846
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true">
|
847
|
+
<title>Normative References</title>
|
848
|
+
<bibitem id="ISO712" type="standard">
|
849
|
+
<title format="text/plain">Cereals and cereal products</title>
|
850
|
+
<docidentifier>ISO 712</docidentifier>
|
851
|
+
<contributor>
|
852
|
+
<role type="publisher"/>
|
853
|
+
<organization>
|
854
|
+
<abbreviation>ISO</abbreviation>
|
855
|
+
</organization>
|
856
|
+
</contributor>
|
857
|
+
</bibitem>
|
858
|
+
</references><clause id="S" obligation="informative">
|
859
|
+
<title>Bibliography</title>
|
860
|
+
<references id="T" obligation="informative" normative="false">
|
861
|
+
<title>Bibliography Subsection</title>
|
862
|
+
</references>
|
863
|
+
</clause>
|
864
|
+
</bibliography>
|
865
|
+
</iso-standard>
|
866
|
+
INPUT
|
867
|
+
|
868
|
+
presxml = <<~OUTPUT
|
869
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
870
|
+
<bibdata>
|
871
|
+
<language current="true">eo</language>
|
872
|
+
<script current="true">Latn</script>
|
873
|
+
<status>
|
874
|
+
<stage language="">published</stage><stage language="eo">publikigita</stage>
|
875
|
+
<substage language="">withdrawn</substage><substage language="eo">fortirita</substage>
|
876
|
+
</status>
|
877
|
+
<ext>
|
878
|
+
<doctype language="">brochure</doctype><doctype language="eo">broŝuro</doctype>
|
879
|
+
</ext>
|
880
|
+
</bibdata><localized-strings><localized-string key="foreword" language="eo">Antaŭparolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">klaŭzo</localized-string><localized-string key="table" language="eo">tabelo</localized-string><localized-string key="source" language="eo">SOURCE</localized-string><localized-string key="modified" language="eo">modified</localized-string><localized-string key="scope" language="eo">Amplekso</localized-string><localized-string key="symbols" language="eo">Simboloj kai mallongigitaj terminoj</localized-string><localized-string key="annex" language="eo">Aldono</localized-string><localized-string key="normref" language="eo">Normaj citaĵoj</localized-string><localized-string key="bibliography" language="eo">Bibliografio</localized-string><localized-string key="inform_annex" language="eo">informa</localized-string><localized-string key="all_parts" language="eo">ĉiuj partoj</localized-string><localized-string key="norm_annex" language="eo">normative</localized-string><localized-string key="note" language="eo">NOTO</localized-string><localized-string key="locality.table" language="eo">Tabelo</localized-string><localized-string key="doctype_dict.brochure" language="eo">broŝuro</localized-string><localized-string key="doctype_dict.conference_proceedings" language="eo">konferencaktoj</localized-string><localized-string key="stage_dict.published" language="eo">publikigita</localized-string><localized-string key="substage_dict.withdrawn" language="eo">fortirita</localized-string><localized-string key="array.0" language="eo">elem1</localized-string><localized-string key="array.1" language="eo">elem2</localized-string><localized-string key="array.2.elem3" language="eo">elem4</localized-string><localized-string key="array.2.elem5" language="eo">elem6</localized-string><localized-string key="language" language="eo">eo</localized-string><localized-string key="script" language="eo">Latn</localized-string></localized-strings>
|
881
|
+
<preface>
|
882
|
+
<foreword obligation="informative" displayorder="1">
|
883
|
+
<title>Foreword</title>
|
884
|
+
<p id="A">See <xref target="M">klaŭzo 5</xref></p>
|
885
|
+
<p id="A">See <xref target="tab">tabelo 1</xref></p>
|
886
|
+
<table id="tab"><name>Tabelo 1</name></table>
|
887
|
+
</foreword>
|
888
|
+
<introduction id="B" obligation="informative" displayorder="2"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
|
889
|
+
<title depth="2">Introduction Subsection</title>
|
890
|
+
</clause>
|
891
|
+
</introduction></preface><sections>
|
892
|
+
<clause id="D" obligation="normative" type="scope" displayorder="3">
|
893
|
+
<title depth="1">1.<tab/>Scope</title>
|
894
|
+
<p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Tabelo 1–1</eref></p>
|
895
|
+
</clause>
|
896
|
+
<clause id="H" obligation="normative" displayorder="5"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
|
897
|
+
<title depth="2">3.1.<tab/>Normal Terms</title>
|
898
|
+
<term id="J"><name>3.1.1.</name>
|
899
|
+
<preferred>Term2</preferred>
|
900
|
+
</term>
|
901
|
+
</terms>
|
902
|
+
<definitions id="K"><title>3.2.</title>
|
903
|
+
<dl>
|
904
|
+
<dt>Symbol</dt>
|
905
|
+
<dd>Definition</dd>
|
906
|
+
</dl>
|
907
|
+
</definitions>
|
908
|
+
</clause>
|
909
|
+
<definitions id="L" displayorder="6"><title>4.</title>
|
910
|
+
<dl>
|
911
|
+
<dt>Symbol</dt>
|
912
|
+
<dd>Definition</dd>
|
913
|
+
</dl>
|
914
|
+
</definitions>
|
915
|
+
<clause id="M" inline-header="false" obligation="normative" displayorder="7"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
|
916
|
+
<title depth="2">5.1.<tab/>Introduction</title>
|
917
|
+
<note id="M-n1"><name>NOTO </name></note>
|
918
|
+
</clause>
|
919
|
+
<clause id="O" inline-header="false" obligation="normative">
|
920
|
+
<title depth="2">5.2.<tab/>Clause 4.2</title>
|
921
|
+
</clause></clause>
|
922
|
+
</sections><annex id="P" inline-header="false" obligation="normative" displayorder="8">
|
923
|
+
<title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
|
924
|
+
<clause id="Q" inline-header="false" obligation="normative">
|
925
|
+
<title depth="2">A.1.<tab/>Annex A.1</title>
|
926
|
+
<clause id="Q1" inline-header="false" obligation="normative">
|
927
|
+
<title depth="3">A.1.1.<tab/>Annex A.1a</title>
|
928
|
+
</clause>
|
929
|
+
</clause>
|
930
|
+
</annex><bibliography><references id="R" obligation="informative" normative="true" displayorder="4">
|
931
|
+
<title depth="1">2.<tab/>Normative References</title>
|
932
|
+
<bibitem id="ISO712" type="standard">
|
933
|
+
<title format="text/plain">Cereals and cereal products</title>
|
934
|
+
<docidentifier>ISO 712</docidentifier>
|
935
|
+
<contributor>
|
936
|
+
<role type="publisher"/>
|
937
|
+
<organization>
|
938
|
+
<abbreviation>ISO</abbreviation>
|
939
|
+
</organization>
|
940
|
+
</contributor>
|
941
|
+
</bibitem>
|
942
|
+
</references><clause id="S" obligation="informative" displayorder="9">
|
943
|
+
<title depth="1">Bibliography</title>
|
944
|
+
<references id="T" obligation="informative" normative="false">
|
945
|
+
<title depth="2">Bibliography Subsection</title>
|
946
|
+
</references>
|
947
|
+
</clause>
|
948
|
+
</bibliography>
|
949
|
+
</iso-standard>
|
950
|
+
OUTPUT
|
951
|
+
|
952
|
+
output = <<~OUTPUT
|
953
|
+
<html lang='eo'>
|
954
|
+
<head/>
|
955
|
+
<body lang='eo'>
|
956
|
+
<div class='title-section'>
|
957
|
+
<p> </p>
|
958
|
+
</div>
|
1171
959
|
<br/>
|
960
|
+
<div class='prefatory-section'>
|
961
|
+
<p> </p>
|
962
|
+
</div>
|
1172
963
|
<br/>
|
1173
|
-
<
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
964
|
+
<div class='main-section'>
|
965
|
+
<br/>
|
966
|
+
<div>
|
967
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
968
|
+
<p id='A'>
|
969
|
+
See
|
970
|
+
<a href='#M'>klaŭzo 5</a>
|
971
|
+
</p>
|
972
|
+
<p id='A'>
|
973
|
+
See
|
974
|
+
<a href='#tab'>tabelo 1</a>
|
975
|
+
</p>
|
976
|
+
<p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
|
977
|
+
<table id='tab' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
|
978
|
+
</div>
|
979
|
+
<br/>
|
980
|
+
<div class='Section3' id='B'>
|
981
|
+
<h1 class='IntroTitle'>Introduction</h1>
|
982
|
+
<div id='C'>
|
983
|
+
<h2>Introduction Subsection</h2>
|
984
|
+
</div>
|
985
|
+
</div>
|
986
|
+
<p class='zzSTDTitle1'/>
|
987
|
+
<div id='D'>
|
988
|
+
<h1>1.  Scope</h1>
|
989
|
+
<p id='E'>
|
990
|
+
<a href='#ISO712'>ISO 712, Tabelo 1–1</a>
|
991
|
+
</p>
|
992
|
+
</div>
|
993
|
+
<div>
|
994
|
+
<h1>2.  Normative References</h1>
|
995
|
+
<p id='ISO712' class='NormRef'>
|
996
|
+
ISO 712,
|
997
|
+
<i>Cereals and cereal products</i>
|
998
|
+
</p>
|
999
|
+
</div>
|
1000
|
+
<div id='H'>
|
1001
|
+
<h1>3.  Terms, definitions, symbols and abbreviated terms</h1>
|
1002
|
+
<div id='I'>
|
1003
|
+
<h2>3.1.  Normal Terms</h2>
|
1004
|
+
<p class='TermNum' id='J'>3.1.1.</p>
|
1005
|
+
<p class='Terms' style='text-align:left;'>Term2</p>
|
1006
|
+
</div>
|
1007
|
+
<div id='K'>
|
1008
|
+
<h2>3.2.</h2>
|
1009
|
+
<dl>
|
1010
|
+
<dt>
|
1011
|
+
<p>Symbol</p>
|
1012
|
+
</dt>
|
1013
|
+
<dd>Definition</dd>
|
1014
|
+
</dl>
|
1015
|
+
</div>
|
1016
|
+
</div>
|
1017
|
+
<div id='L' class='Symbols'>
|
1018
|
+
<h1>4.</h1>
|
1019
|
+
<dl>
|
1020
|
+
<dt>
|
1021
|
+
<p>Symbol</p>
|
1022
|
+
</dt>
|
1023
|
+
<dd>Definition</dd>
|
1024
|
+
</dl>
|
1025
|
+
</div>
|
1026
|
+
<div id='M'>
|
1027
|
+
<h1>5.  Clause 4</h1>
|
1028
|
+
<div id='N'>
|
1029
|
+
<h2>5.1.  Introduction</h2>
|
1030
|
+
<div id='M-n1' class='Note'>
|
1031
|
+
<p>
|
1032
|
+
<span class='note_label'>NOTO </span>
|
1033
|
+
 
|
1034
|
+
</p>
|
1035
|
+
</div>
|
1036
|
+
</div>
|
1037
|
+
<div id='O'>
|
1038
|
+
<h2>5.2.  Clause 4.2</h2>
|
1039
|
+
</div>
|
1040
|
+
</div>
|
1041
|
+
<br/>
|
1042
|
+
<div id='P' class='Section3'>
|
1043
|
+
<h1 class='Annex'>
|
1044
|
+
<b>Aldono A</b>
|
1045
|
+
<br/>
|
1046
|
+
(normative)
|
1047
|
+
<br/>
|
1048
|
+
<br/>
|
1049
|
+
<b>Annex</b>
|
1050
|
+
</h1>
|
1051
|
+
<div id='Q'>
|
1052
|
+
<h2>A.1.  Annex A.1</h2>
|
1053
|
+
<div id='Q1'>
|
1054
|
+
<h3>A.1.1.  Annex A.1a</h3>
|
1055
|
+
</div>
|
1056
|
+
</div>
|
1057
|
+
</div>
|
1058
|
+
<br/>
|
1059
|
+
<div>
|
1060
|
+
<h1 class='Section3'>Bibliography</h1>
|
1061
|
+
<div>
|
1062
|
+
<h2 class='Section3'>Bibliography Subsection</h2>
|
1063
|
+
</div>
|
1064
|
+
</div>
|
1179
1065
|
</div>
|
1180
|
-
</
|
1181
|
-
</
|
1182
|
-
|
1183
|
-
<div>
|
1184
|
-
<h1 class='Section3'>Bibliography</h1>
|
1185
|
-
<div>
|
1186
|
-
<h2 class='Section3'>Bibliography Subsection</h2>
|
1187
|
-
</div>
|
1188
|
-
</div>
|
1189
|
-
</div>
|
1190
|
-
</body>
|
1191
|
-
</html>
|
1192
|
-
OUTPUT
|
1066
|
+
</body>
|
1067
|
+
</html>
|
1068
|
+
OUTPUT
|
1193
1069
|
|
1194
|
-
|
1195
|
-
|
1070
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1071
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1072
|
+
.convert("test", input, true)))
|
1073
|
+
.to be_equivalent_to xmlpp(presxml)
|
1074
|
+
expect(xmlpp(IsoDoc::HtmlConvert
|
1075
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1076
|
+
.convert("test", presxml, true)))
|
1077
|
+
.to be_equivalent_to xmlpp(output)
|
1196
1078
|
end
|
1197
1079
|
|
1198
1080
|
private
|
1199
1081
|
|
1200
1082
|
def mock_i18n
|
1201
|
-
allow_any_instance_of(::IsoDoc::I18n)
|
1083
|
+
allow_any_instance_of(::IsoDoc::I18n)
|
1084
|
+
.to receive(:load_yaml)
|
1085
|
+
.with("eo", "Latn", "spec/assets/i18n.yaml")
|
1086
|
+
.and_return(IsoDoc::I18n.new("eo", "Latn")
|
1087
|
+
.normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
|
1202
1088
|
end
|
1203
|
-
|
1204
1089
|
end
|