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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/Rakefile +2 -2
  6. data/bin/rspec +1 -2
  7. data/isodoc.gemspec +4 -3
  8. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  9. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  10. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  13. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  14. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  15. data/lib/isodoc.rb +0 -2
  16. data/lib/isodoc/common.rb +2 -0
  17. data/lib/isodoc/convert.rb +10 -4
  18. data/lib/isodoc/css.rb +30 -26
  19. data/lib/isodoc/function/blocks.rb +26 -8
  20. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  21. data/lib/isodoc/function/cleanup.rb +53 -45
  22. data/lib/isodoc/function/form.rb +51 -0
  23. data/lib/isodoc/function/inline.rb +8 -7
  24. data/lib/isodoc/function/references.rb +71 -77
  25. data/lib/isodoc/function/section.rb +28 -16
  26. data/lib/isodoc/function/table.rb +22 -22
  27. data/lib/isodoc/function/terms.rb +6 -7
  28. data/lib/isodoc/function/to_word_html.rb +19 -25
  29. data/lib/isodoc/function/utils.rb +180 -160
  30. data/lib/isodoc/gem_tasks.rb +36 -38
  31. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  32. data/lib/isodoc/html_convert.rb +10 -4
  33. data/lib/isodoc/html_function/comments.rb +14 -12
  34. data/lib/isodoc/html_function/footnotes.rb +14 -7
  35. data/lib/isodoc/html_function/form.rb +62 -0
  36. data/lib/isodoc/html_function/html.rb +30 -26
  37. data/lib/isodoc/html_function/postprocess.rb +191 -226
  38. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  39. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  40. data/lib/isodoc/i18n.rb +33 -31
  41. data/lib/isodoc/metadata.rb +22 -20
  42. data/lib/isodoc/metadata_contributor.rb +31 -28
  43. data/lib/isodoc/pdf_convert.rb +11 -13
  44. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  45. data/lib/isodoc/presentation_function/block.rb +17 -8
  46. data/lib/isodoc/presentation_function/inline.rb +72 -120
  47. data/lib/isodoc/presentation_function/math.rb +84 -0
  48. data/lib/isodoc/presentation_function/section.rb +55 -19
  49. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  50. data/lib/isodoc/sassc_importer.rb +1 -1
  51. data/lib/isodoc/version.rb +1 -1
  52. data/lib/isodoc/word_function/body.rb +28 -24
  53. data/lib/isodoc/word_function/footnotes.rb +22 -15
  54. data/lib/isodoc/word_function/postprocess.rb +50 -36
  55. data/lib/isodoc/xref.rb +11 -10
  56. data/lib/isodoc/xref/xref_counter.rb +32 -17
  57. data/lib/isodoc/xref/xref_gen.rb +33 -21
  58. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  59. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  60. data/spec/assets/scripts_override.html +3 -0
  61. data/spec/isodoc/blocks_spec.rb +2258 -2622
  62. data/spec/isodoc/cleanup_spec.rb +1103 -1107
  63. data/spec/isodoc/form_spec.rb +156 -0
  64. data/spec/isodoc/i18n_spec.rb +802 -917
  65. data/spec/isodoc/inline_spec.rb +1105 -921
  66. data/spec/isodoc/lists_spec.rb +316 -315
  67. data/spec/isodoc/metadata_spec.rb +384 -379
  68. data/spec/isodoc/postproc_spec.rb +1783 -1549
  69. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  70. data/spec/isodoc/ref_spec.rb +718 -723
  71. data/spec/isodoc/section_spec.rb +216 -199
  72. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  73. data/spec/isodoc/table_spec.rb +41 -42
  74. data/spec/isodoc/terms_spec.rb +84 -84
  75. data/spec/isodoc/xref_spec.rb +1024 -930
  76. 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
+ &#9678; Male
125
+ <br/>
126
+ &#9678; Female
127
+ <br/>
128
+ &#9678; Other
129
+ <br/>
130
+ &#9744; I have a bike
131
+ <br/>
132
+ &#9744; I have a car
133
+ <br/>
134
+ &#9744; 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
@@ -65,169 +65,149 @@ RSpec.describe IsoDoc do
65
65
  </clause>
66
66
  </bibliography>
67
67
  </iso-standard>
68
- INPUT
68
+ INPUT
69
69
 
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'>
77
- <title>Foreword</title>
78
- <p id='A'>See <xref target='M'>Clause 5</xref></p>
79
- </foreword>
80
- <introduction id='B' obligation='informative'>
81
- <title>Introduction</title>
82
- <clause id='C' inline-header='false' obligation='informative'>
83
- <title depth='2'>Introduction Subsection</title>
84
- </clause>
85
- </introduction>
86
- </preface>
87
- <sections>
88
- <clause id='D' obligation='normative' type="scope">
89
- <title depth='1'>1.<tab/>Scope</title>
90
- <p id='E'>Text</p>
91
- </clause>
92
- <clause id='H' obligation='normative'>
93
- <title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
94
- <terms id='I' obligation='normative'>
95
- <title depth='2'>3.1.<tab/>Normal Terms</title>
96
- <term id='J'>
97
- <name>3.1.1.</name>
98
- <preferred>Term2</preferred>
99
- </term>
100
- </terms>
101
- <definitions id='K'>
102
- <title>3.2.</title>
103
- <dl>
104
- <dt>Symbol</dt>
105
- <dd>Definition</dd>
106
- </dl>
107
- </definitions>
108
- </clause>
109
- <definitions id='L'>
110
- <title>4.</title>
111
- <dl>
112
- <dt>Symbol</dt>
113
- <dd>Definition</dd>
114
- </dl>
115
- </definitions>
116
- <clause id='M' inline-header='false' obligation='normative'>
117
- <title depth='1'>5.<tab/>Clause 4</title>
118
- <clause id='N' inline-header='false' obligation='normative'>
119
- <title depth='2'>5.1.<tab/>Introduction</title>
120
- </clause>
121
- <clause id='O' inline-header='false' obligation='normative'>
122
- <title depth='2'>5.2.<tab/>Clause 4.2</title>
123
- </clause>
124
- </clause>
125
- </sections>
126
- <annex id='P' inline-header='false' obligation='normative'>
127
- <title>
128
- <strong>Annex A</strong>
129
- <br/>
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.&#160; Scope</h1>
176
- <p id="E">Text</p>
177
- </div>
178
- <div>
179
- <h1>2.&#160; Normative References</h1>
180
- </div>
181
- <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
182
- <div id="I">
183
- <h2>3.1.&#160; 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
- </div><div id="K"><h2>3.2.</h2>
188
- <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
189
- </div></div>
190
- <div id="L" class="Symbols">
191
- <h1>4.</h1>
192
- <dl>
193
- <dt>
194
- <p>Symbol</p>
195
- </dt>
196
- <dd>Definition</dd>
197
- </dl>
198
- </div>
199
- <div id="M">
200
- <h1>5.&#160; Clause 4</h1>
201
- <div id="N">
202
- <h2>5.1.&#160; Introduction</h2>
203
- </div>
204
- <div id="O">
205
- <h2>5.2.&#160; Clause 4.2</h2>
206
- </div>
207
- </div>
208
- <br/>
209
- <div id="P" class="Section3">
210
- <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
211
- <div id="Q">
212
- <h2>A.1.&#160; Annex A.1</h2>
213
- <div id="Q1">
214
- <h3>A.1.1.&#160; Annex A.1a</h3>
215
- </div>
216
- </div>
217
- </div>
218
- <br/>
219
- <div>
220
- <h1 class="Section3">Bibliography</h1>
221
- <div>
222
- <h2 class="Section3">Bibliography Subsection</h2>
223
- </div>
224
- </div>
225
- </div>
226
- </body>
227
- </html>
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.&#160; Scope</h1>
153
+ <p id="E">Text</p>
154
+ </div>
155
+ <div>
156
+ <h1>2.&#160; Normative References</h1>
157
+ </div>
158
+ <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
159
+ <div id="I">
160
+ <h2>3.1.&#160; 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.&#160; Clause 4</h1>
177
+ <div id="N">
178
+ <h2>5.1.&#160; Introduction</h2>
179
+ </div>
180
+ <div id="O">
181
+ <h2>5.2.&#160; 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.&#160; Annex A.1</h2>
189
+ <div id="Q1">
190
+ <h3>A.1.1.&#160; 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.new({}).convert("test", input, true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(presxml)
230
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
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
- INPUT
298
- <?xml version='1.0'?>
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>fr</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"/></p>
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
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
406
- <title>Normal Terms</title>
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
- </sections><annex id="P" inline-header="false" obligation="normative">
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>Bibliographie</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.&#160; Scope</h1>
557
- <p id="E">Text</p>
558
- </div>
559
- <div>
560
- <h1>2.&#160; Normative References</h1>
561
- </div>
562
- <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
563
- <div id="I">
564
- <h2>3.1.&#160; 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.&#160; Clause 4</h1>
582
- <div id="N">
583
- <h2>5.1.&#160; Introduction</h2>
584
- </div>
585
- <div id="O">
586
- <h2>5.2.&#160; 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.&#160; Annex A.1</h2>
594
- <div id="Q1">
595
- <h3>A.1.1.&#160; 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 Simplified Chinese" do
341
+ it "processes French" do
615
342
  input = <<~"INPUT"
616
343
  <iso-standard xmlns="http://riboseinc.com/isoxml">
617
344
  <bibdata>
618
- <language>zh</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"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
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>Bibliography</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
- INPUT
405
+ INPUT
690
406
 
691
- presxml = <<~"PRESXML"
692
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
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'>&#x6761;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&#x3001;&#x7B2C;1&#x2013;1&#x8868;</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>&#x9644;&#x4EF6;A</strong>
752
- <br/>
753
- &#xFF08;&#x89C4;&#x8303;&#x6027;&#x9644;&#x5F55;&#xFF09;
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'>&#26465;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.&#12288;Scope</h1>
809
- <p id="E">
810
- <a href='#ISO712'>ISO 712&#12289;&#31532;1&#8211;1&#34920;</a>
811
- </p>
812
- </div>
813
- <div>
814
- <h1>2.&#12288;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.&#12288;Terms, definitions, symbols and abbreviated terms</h1>
818
- <div id="I">
819
- <h2>3.1.&#12288;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.&#12288;Clause 4</h1>
837
- <div id="N">
838
- <h2>5.1.&#12288;Introduction</h2>
839
- </div>
840
- <div id="O">
841
- <h2>5.2.&#12288;Clause 4.2</h2>
842
- </div>
843
- </div>
844
- <br/>
845
- <div id="P" class="Section3">
846
- <h1 class="Annex"><b>&#38468;&#20214;A</b><br/>&#65288;&#35268;&#33539;&#24615;&#38468;&#24405;&#65289;<br/><br/><b>Annex</b></h1>
847
- <div id="Q">
848
- <h2>A.1.&#12288;Annex A.1</h2>
849
- <div id="Q1">
850
- <h3>A.1.1.&#12288;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>eo</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"/></p>
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"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
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
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
901
- <title>Normal Terms</title>
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
- </sections><annex id="P" inline-header="false" obligation="normative">
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
- <bibitem id="ISO712" type="standard">
938
- <title format="text/plain">Cereals and cereal products</title>
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
- INPUT
468
+ PRESXML
956
469
 
957
- presxml = <<~OUTPUT
958
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
959
- <bibdata>
960
- <language current="true">eo</language>
961
- <script current="true">Latn</script>
962
- <status>
963
- <stage language=''>published</stage>
964
- <stage language='eo'>publikigita</stage>
965
- <substage language=''>withdrawn</substage>
966
- <substage language='eo'>fortirita</substage>
967
- </status>
968
- <ext>
969
- <doctype language=''>brochure</doctype>
970
- <doctype language='eo'>bro&#x15D;uro</doctype>
971
- </ext>
972
- </bibdata>
973
- <localized-strings>
974
- <localized-string key='foreword' language='eo'>Anta&#x16D;parolo</localized-string>
975
- <localized-string key='introduction' language='eo'>Enkonduko</localized-string>
976
- <localized-string key='clause' language='eo'>kla&#x16D;zo</localized-string>
977
- <localized-string key='table' language='eo'>tabelo</localized-string>
978
- <localized-string key='source' language='eo'>SOURCE</localized-string>
979
- <localized-string key='modified' language='eo'>modified</localized-string>
980
- <localized-string key='scope' language='eo'>Amplekso</localized-string>
981
- <localized-string key='symbols' language='eo'>Simboloj kai mallongigitaj terminoj</localized-string>
982
- <localized-string key='annex' language='eo'>Aldono</localized-string>
983
- <localized-string key='normref' language='eo'>Normaj cita&#x135;oj</localized-string>
984
- <localized-string key='bibliography' language='eo'>Bibliografio</localized-string>
985
- <localized-string key='inform_annex' language='eo'>informa</localized-string>
986
- <localized-string key='all_parts' language='eo'>&#x109;iuj partoj</localized-string>
987
- <localized-string key='norm_annex' language='eo'>normative</localized-string>
988
- <localized-string key='note' language='eo'>NOTO</localized-string>
989
- <localized-string key='locality.table' language='eo'>Tabelo</localized-string>
990
- <localized-string key='doctype_dict.brochure' language='eo'>bro&#x15D;uro</localized-string>
991
- <localized-string key='doctype_dict.conference_proceedings' language='eo'>konferencaktoj</localized-string>
992
- <localized-string key='stage_dict.published' language='eo'>publikigita</localized-string>
993
- <localized-string key='substage_dict.withdrawn' language='eo'>fortirita</localized-string>
994
- <localized-string key='array.0' language='eo'>elem1</localized-string>
995
- <localized-string key='array.1' language='eo'>elem2</localized-string>
996
- <localized-string key='array.2.elem3' language='eo'>elem4</localized-string>
997
- <localized-string key='array.2.elem5' language='eo'>elem6</localized-string>
998
- <localized-string key='language' language='eo'>eo</localized-string>
999
- <localized-string key='script' language='eo'>Latn</localized-string>
1000
- </localized-strings>
1001
- <preface>
1002
- <foreword obligation="informative">
1003
- <title>Foreword</title>
1004
- <p id='A'>See <xref target='M'>kla&#x16D;zo 5</xref></p>
1005
- <p id='A'>See <xref target='tab'>tabelo 1</xref></p>
1006
- <table id='tab'>
1007
- <name>Tabelo 1</name>
1008
- </table>
1009
- </foreword>
1010
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
1011
- <title depth="2">Introduction Subsection</title>
1012
- </clause>
1013
- </introduction></preface><sections>
1014
- <clause id="D" obligation="normative" type="scope">
1015
- <title depth="1">1.<tab/>Scope</title>
1016
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Tabelo 1&#x2013;1</eref></p>
1017
- </clause>
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.&#160; Scope</h1>
490
+ <p id="E">Text</p>
491
+ </div>
492
+ <div>
493
+ <h1>2.&#160; Normative References</h1>
494
+ </div>
495
+ <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
496
+ <div id="I">
497
+ <h2>3.1.&#160; 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.&#160; Clause 4</h1>
514
+ <div id="N">
515
+ <h2>5.1.&#160; Introduction</h2>
516
+ </div>
517
+ <div id="O">
518
+ <h2>5.2.&#160; 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.&#160; Annex A.1</h2>
526
+ <div id="Q1">
527
+ <h3>A.1.1.&#160; 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
- <clause id="H" obligation="normative"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
1020
- <title depth="2">3.1.<tab/>Normal Terms</title>
1021
- <term id="J"><name>3.1.1.</name>
1022
- <preferred>Term2</preferred>
1023
- </term>
1024
- </terms>
1025
- <definitions id="K"><title>3.2.</title>
1026
- <dl>
1027
- <dt>Symbol</dt>
1028
- <dd>Definition</dd>
1029
- </dl>
1030
- </definitions>
1031
- </clause>
1032
- <definitions id="L"><title>4.</title>
1033
- <dl>
1034
- <dt>Symbol</dt>
1035
- <dd>Definition</dd>
1036
- </dl>
1037
- </definitions>
1038
- <clause id="M" inline-header="false" obligation="normative"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
1039
- <title depth="2">5.1.<tab/>Introduction</title>
1040
- <note id='M-n1'><name>NOTO </name></note>
1041
- </clause>
1042
- <clause id="O" inline-header="false" obligation="normative">
1043
- <title depth="2">5.2.<tab/>Clause 4.2</title>
1044
- </clause></clause>
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
- </sections><annex id="P" inline-header="false" obligation="normative">
1047
- <title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
1048
- <clause id="Q" inline-header="false" obligation="normative">
1049
- <title depth="2">A.1.<tab/>Annex A.1</title>
1050
- <clause id="Q1" inline-header="false" obligation="normative">
1051
- <title depth="3">A.1.1.<tab/>Annex A.1a</title>
1052
- </clause>
1053
- </clause>
1054
- </annex><bibliography><references id="R" obligation="informative" normative="true">
1055
- <title depth="1">2.<tab/>Normative References</title>
1056
- <bibitem id="ISO712" type="standard">
1057
- <title format="text/plain">Cereals and cereal products</title>
1058
- <docidentifier>ISO 712</docidentifier>
1059
- <contributor>
1060
- <role type="publisher"/>
1061
- <organization>
1062
- <abbreviation>ISO</abbreviation>
1063
- </organization>
1064
- </contributor>
1065
- </bibitem>
1066
- </references><clause id="S" obligation="informative">
1067
- <title depth="1">Bibliography</title>
1068
- <references id="T" obligation="informative" normative="false">
1069
- <title depth="2">Bibliography Subsection</title>
1070
- </references>
1071
- </clause>
1072
- </bibliography>
1073
- </iso-standard>
1074
- OUTPUT
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">&#x6761;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&#x3001;&#x7B2C;1&#x2013;1&#x8868;</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>&#x9644;&#x4EF6;A</strong><br/>&#xFF08;&#x89C4;&#x8303;&#x6027;&#x9644;&#x5F55;&#xFF09;<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
- output = <<~OUTPUT
1077
- <html lang='eo'>
1078
- <head/>
1079
- <body lang='eo'>
1080
- <div class='title-section'>
1081
- <p>&#160;</p>
1082
- </div>
1083
- <br/>
1084
- <div class='prefatory-section'>
1085
- <p>&#160;</p>
1086
- </div>
1087
- <br/>
1088
- <div class='main-section'>
1089
- <br/>
1090
- <div>
1091
- <h1 class='ForewordTitle'>Foreword</h1>
1092
- <p id='A'>
1093
- See
1094
- <a href='#M'>kla&#365;zo 5</a>
1095
- </p>
1096
- <p id='A'>
1097
- See
1098
- <a href='#tab'>tabelo 1</a>
1099
- </p>
1100
- <p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
1101
- <table id='tab' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
1102
- </div>
1103
- <br/>
1104
- <div class='Section3' id='B'>
1105
- <h1 class='IntroTitle'>Introduction</h1>
1106
- <div id='C'>
1107
- <h2>Introduction Subsection</h2>
1108
- </div>
1109
- </div>
1110
- <p class='zzSTDTitle1'/>
1111
- <div id='D'>
1112
- <h1>1.&#160; Scope</h1>
1113
- <p id='E'>
1114
- <a href='#ISO712'>ISO 712, Tabelo 1&#8211;1</a>
1115
- </p>
1116
- </div>
1117
- <div>
1118
- <h1>2.&#160; Normative References</h1>
1119
- <p id='ISO712' class='NormRef'>
1120
- ISO 712,
1121
- <i>Cereals and cereal products</i>
1122
- </p>
1123
- </div>
1124
- <div id='H'>
1125
- <h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
1126
- <div id='I'>
1127
- <h2>3.1.&#160; Normal Terms</h2>
1128
- <p class='TermNum' id='J'>3.1.1.</p>
1129
- <p class='Terms' style='text-align:left;'>Term2</p>
1130
- </div>
1131
- <div id='K'>
1132
- <h2>3.2.</h2>
1133
- <dl>
1134
- <dt>
1135
- <p>Symbol</p>
1136
- </dt>
1137
- <dd>Definition</dd>
1138
- </dl>
1139
- </div>
1140
- </div>
1141
- <div id='L' class='Symbols'>
1142
- <h1>4.</h1>
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'>&#26465;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.&#12288;Scope</h1>
719
+ <p id="E">
720
+ <a href='#ISO712'>ISO 712&#12289;&#31532;1&#8211;1&#34920;</a>
721
+ </p>
722
+ </div>
723
+ <div>
724
+ <h1>2.&#12288;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.&#12288;Terms, definitions, symbols and abbreviated terms</h1>
728
+ <div id="I">
729
+ <h2>3.1.&#12288;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.&#12288;Clause 4</h1>
746
+ <div id="N">
747
+ <h2>5.1.&#12288;Introduction</h2>
748
+ </div>
749
+ <div id="O">
750
+ <h2>5.2.&#12288;Clause 4.2</h2>
751
+ </div>
752
+ </div>
753
+ <br/>
754
+ <div id="P" class="Section3">
755
+ <h1 class="Annex"><b>&#38468;&#20214;A</b><br/>&#65288;&#35268;&#33539;&#24615;&#38468;&#24405;&#65289;<br/><br/><b>Annex</b></h1>
756
+ <div id="Q">
757
+ <h2>A.1.&#12288;Annex A.1</h2>
758
+ <div id="Q1">
759
+ <h3>A.1.1.&#12288;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
- <dt>
1145
- <p>Symbol</p>
1146
- </dt>
1147
- <dd>Definition</dd>
820
+ <dt>Symbol</dt>
821
+ <dd>Definition</dd>
1148
822
  </dl>
1149
- </div>
1150
- <div id='M'>
1151
- <h1>5.&#160; Clause 4</h1>
1152
- <div id='N'>
1153
- <h2>5.1.&#160; Introduction</h2>
1154
- <div id='M-n1' class='Note'>
1155
- <p>
1156
- <span class='note_label'>NOTO </span>
1157
- &#160;
1158
- </p>
1159
- </div>
1160
- </div>
1161
- <div id='O'>
1162
- <h2>5.2.&#160; Clause 4.2</h2>
1163
- </div>
1164
- </div>
1165
- <br/>
1166
- <div id='P' class='Section3'>
1167
- <h1 class='Annex'>
1168
- <b>Aldono A</b>
1169
- <br/>
1170
- (normative)
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&#x15D;uro</doctype>
879
+ </ext>
880
+ </bibdata><localized-strings><localized-string key="foreword" language="eo">Anta&#x16D;parolo</localized-string><localized-string key="introduction" language="eo">Enkonduko</localized-string><localized-string key="clause" language="eo">kla&#x16D;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&#x135;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">&#x109;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&#x15D;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&#x16D;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&#x2013;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>&#160;</p>
958
+ </div>
1171
959
  <br/>
960
+ <div class='prefatory-section'>
961
+ <p>&#160;</p>
962
+ </div>
1172
963
  <br/>
1173
- <b>Annex</b>
1174
- </h1>
1175
- <div id='Q'>
1176
- <h2>A.1.&#160; Annex A.1</h2>
1177
- <div id='Q1'>
1178
- <h3>A.1.1.&#160; Annex A.1a</h3>
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&#365;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.&#160; Scope</h1>
989
+ <p id='E'>
990
+ <a href='#ISO712'>ISO 712, Tabelo 1&#8211;1</a>
991
+ </p>
992
+ </div>
993
+ <div>
994
+ <h1>2.&#160; 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.&#160; Terms, definitions, symbols and abbreviated terms</h1>
1002
+ <div id='I'>
1003
+ <h2>3.1.&#160; 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.&#160; Clause 4</h1>
1028
+ <div id='N'>
1029
+ <h2>5.1.&#160; Introduction</h2>
1030
+ <div id='M-n1' class='Note'>
1031
+ <p>
1032
+ <span class='note_label'>NOTO </span>
1033
+ &#160;
1034
+ </p>
1035
+ </div>
1036
+ </div>
1037
+ <div id='O'>
1038
+ <h2>5.2.&#160; 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.&#160; Annex A.1</h2>
1053
+ <div id='Q1'>
1054
+ <h3>A.1.1.&#160; 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
- </div>
1181
- </div>
1182
- <br/>
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
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1195
- expect(xmlpp(IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
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).to receive(:load_yaml).with("eo", "Latn", "spec/assets/i18n.yaml").and_return(IsoDoc::I18n.new("eo", "Latn").normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
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