isodoc 1.5.4 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +6 -4
  3. data/Gemfile +2 -2
  4. data/Rakefile +2 -2
  5. data/bin/rspec +1 -2
  6. data/isodoc.gemspec +11 -11
  7. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  8. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  9. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  10. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  11. data/lib/isodoc/base_style/all.css +7 -0
  12. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  13. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  14. data/lib/isodoc/base_style/reset.css +7 -0
  15. data/lib/isodoc/base_style/reset.scss +9 -0
  16. data/lib/isodoc/base_style/scripts.html +187 -0
  17. data/lib/isodoc/class_utils.rb +6 -5
  18. data/lib/isodoc/common.rb +2 -0
  19. data/lib/isodoc/convert.rb +30 -17
  20. data/lib/isodoc/css.rb +42 -28
  21. data/lib/isodoc/function/blocks.rb +21 -4
  22. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  23. data/lib/isodoc/function/cleanup.rb +1 -2
  24. data/lib/isodoc/function/form.rb +51 -0
  25. data/lib/isodoc/function/inline.rb +32 -10
  26. data/lib/isodoc/function/references.rb +55 -42
  27. data/lib/isodoc/function/table.rb +1 -0
  28. data/lib/isodoc/function/to_word_html.rb +29 -28
  29. data/lib/isodoc/function/utils.rb +41 -38
  30. data/lib/isodoc/gem_tasks.rb +30 -31
  31. data/lib/isodoc/html_convert.rb +6 -4
  32. data/lib/isodoc/html_function/form.rb +62 -0
  33. data/lib/isodoc/html_function/postprocess.rb +35 -76
  34. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  35. data/lib/isodoc/i18n.rb +33 -31
  36. data/lib/isodoc/pdf_convert.rb +1 -3
  37. data/lib/isodoc/presentation_function/bibdata.rb +13 -10
  38. data/lib/isodoc/presentation_function/block.rb +17 -8
  39. data/lib/isodoc/presentation_function/inline.rb +75 -118
  40. data/lib/isodoc/presentation_function/math.rb +84 -0
  41. data/lib/isodoc/presentation_function/section.rb +20 -22
  42. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  43. data/lib/isodoc/sassc_importer.rb +1 -1
  44. data/lib/isodoc/version.rb +1 -1
  45. data/lib/isodoc/word_function/body.rb +28 -24
  46. data/lib/isodoc/word_function/footnotes.rb +22 -15
  47. data/lib/isodoc/word_function/postprocess.rb +16 -6
  48. data/lib/isodoc/xref.rb +10 -11
  49. data/lib/isodoc/xref/xref_counter.rb +32 -17
  50. data/lib/isodoc/xref/xref_gen.rb +45 -32
  51. data/lib/isodoc/xref/xref_sect_gen.rb +33 -31
  52. data/lib/isodoc/xslfo_convert.rb +36 -25
  53. data/spec/assets/html_override.css +1 -0
  54. data/spec/assets/word_override.css +1 -0
  55. data/spec/isodoc/blocks_spec.rb +2518 -2570
  56. data/spec/isodoc/cleanup_spec.rb +1107 -1109
  57. data/spec/isodoc/footnotes_spec.rb +1 -16
  58. data/spec/isodoc/form_spec.rb +156 -0
  59. data/spec/isodoc/i18n_spec.rb +984 -972
  60. data/spec/isodoc/inline_spec.rb +984 -920
  61. data/spec/isodoc/lists_spec.rb +316 -315
  62. data/spec/isodoc/postproc_spec.rb +1692 -1538
  63. data/spec/isodoc/presentation_xml_spec.rb +345 -342
  64. data/spec/isodoc/ref_spec.rb +718 -723
  65. data/spec/isodoc/section_spec.rb +910 -902
  66. data/spec/isodoc/table_spec.rb +566 -556
  67. data/spec/isodoc/terms_spec.rb +252 -256
  68. data/spec/isodoc/xref_spec.rb +3040 -2985
  69. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  70. data/spec/spec_helper.rb +30 -29
  71. metadata +80 -70
  72. data/.rubocop.ribose.yml +0 -65
  73. data/.rubocop.tb.yml +0 -650
  74. data/lib/twitter-cldr/patch.rb +0 -39
@@ -155,17 +155,8 @@ RSpec.describe IsoDoc do
155
155
  </preface>
156
156
  </iso-standard>
157
157
  INPUT
158
- html = File.read("test.html").sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")
158
+ html = File.read("test.html").sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")
159
159
  expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
160
- <body lang="en" xml:lang="en">
161
- <div class="title-section">
162
- <p>&#xA0;</p>
163
- </div>
164
- <br />
165
- <div class="prefatory-section">
166
- <p>&#xA0;</p>
167
- </div>
168
- <br />
169
160
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
170
161
  <br />
171
162
  <div>
@@ -180,12 +171,6 @@ RSpec.describe IsoDoc do
180
171
  </div>
181
172
  <p class="zzSTDTitle1"></p>
182
173
  </main>
183
- <script type='text/x-mathjax-config'>
184
- MathJax.Hub.Config({ "HTML-CSS": { preferredFont: "STIX" }, asciimath2jax:
185
- { delimiters: [['(#(', ')#)']] } });
186
- </script>
187
- <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=MML_HTMLorMML-full" async="async"></script>
188
- <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"></script></body>
189
174
  OUTPUT
190
175
  end
191
176
 
@@ -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,172 @@ 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>
153
- </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>
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>
153
+ </iso-standard>
154
+ PRESXML
186
155
 
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>
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>
186
+ </div><div id="K"><h2>3.2.</h2>
187
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
188
+ </div></div>
189
+ <div id="L" class="Symbols">
190
+ <h1>4.</h1>
191
+ <dl>
192
+ <dt>
193
+ <p>Symbol</p>
194
+ </dt>
195
+ <dd>Definition</dd>
196
+ </dl>
197
+ </div>
198
+ <div id="M">
199
+ <h1>5.&#160; Clause 4</h1>
200
+ <div id="N">
201
+ <h2>5.1.&#160; Introduction</h2>
202
+ </div>
203
+ <div id="O">
204
+ <h2>5.2.&#160; Clause 4.2</h2>
205
+ </div>
206
+ </div>
207
+ <br/>
208
+ <div id="P" class="Section3">
209
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
210
+ <div id="Q">
211
+ <h2>A.1.&#160; Annex A.1</h2>
212
+ <div id="Q1">
213
+ <h3>A.1.1.&#160; Annex A.1a</h3>
214
+ </div>
215
+ </div>
216
+ </div>
217
+ <br/>
218
+ <div>
219
+ <h1 class="Section3">Bibliography</h1>
220
+ <div>
221
+ <h2 class="Section3">Bibliography Subsection</h2>
222
+ </div>
223
+ </div>
224
+ </div>
225
+ </body>
226
+ </html>
228
227
  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)
228
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
229
+ .new({}).convert("test", input, true)
230
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
231
+ .to be_equivalent_to xmlpp(presxml)
232
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
233
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
231
234
  end
232
235
 
233
236
  it "defaults to English" do
@@ -294,91 +297,91 @@ PRESXML
294
297
  </clause>
295
298
  </bibliography>
296
299
  </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>
300
+ INPUT
301
+ <?xml version='1.0'?>
302
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
303
+ <bibdata>
304
+ <language current="true">tlh</language>
305
+ </bibdata>
306
+ <preface>
307
+ <foreword obligation='informative'>
308
+ <title>Foreword</title>
309
+ <p id='A'>See <xref target='M'>Clause 5</xref></p>
310
+ </foreword>
311
+ <introduction id='B' obligation='informative'>
312
+ <title>Introduction</title>
313
+ <clause id='C' inline-header='false' obligation='informative'>
314
+ <title depth='2'>Introduction Subsection</title>
315
+ </clause>
316
+ </introduction>
317
+ </preface>
318
+ <sections>
319
+ <clause id='D' obligation='normative' type="scope">
320
+ <title depth='1'>1.<tab/>Scope</title>
321
+ <p id='E'>Text</p>
322
+ </clause>
323
+ <clause id='H' obligation='normative'>
324
+ <title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
325
+ <terms id='I' obligation='normative'>
326
+ <title depth='2'>3.1.<tab/>Normal Terms</title>
327
+ <term id='J'>
328
+ <name>3.1.1.</name>
329
+ <preferred>Term2</preferred>
330
+ </term>
331
+ </terms>
332
+ <definitions id='K'>
333
+ <title>3.2.</title>
334
+ <dl>
335
+ <dt>Symbol</dt>
336
+ <dd>Definition</dd>
337
+ </dl>
338
+ </definitions>
339
+ </clause>
340
+ <definitions id='L'>
341
+ <title>4.</title>
342
+ <dl>
343
+ <dt>Symbol</dt>
344
+ <dd>Definition</dd>
345
+ </dl>
346
+ </definitions>
347
+ <clause id='M' inline-header='false' obligation='normative'>
348
+ <title depth='1'>5.<tab/>Clause 4</title>
349
+ <clause id='N' inline-header='false' obligation='normative'>
350
+ <title depth='2'>5.1.<tab/>Introduction</title>
351
+ </clause>
352
+ <clause id='O' inline-header='false' obligation='normative'>
353
+ <title depth='2'>5.2.<tab/>Clause 4.2</title>
354
+ </clause>
355
+ </clause>
356
+ </sections>
357
+ <annex id='P' inline-header='false' obligation='normative'>
358
+ <title>
359
+ <strong>Annex A</strong>
360
+ <br/>
361
+ (normative)
362
+ <br/>
363
+ <br/>
364
+ <strong>Annex</strong>
365
+ </title>
366
+ <clause id='Q' inline-header='false' obligation='normative'>
367
+ <title depth='2'>A.1.<tab/>Annex A.1</title>
368
+ <clause id='Q1' inline-header='false' obligation='normative'>
369
+ <title depth='3'>A.1.1.<tab/>Annex A.1a</title>
370
+ </clause>
371
+ </clause>
372
+ </annex>
373
+ <bibliography>
374
+ <references id='R' obligation='informative' normative='true'>
375
+ <title depth='1'>2.<tab/>Normative References</title>
376
+ </references>
377
+ <clause id='S' obligation='informative'>
378
+ <title depth="1">Bibliography</title>
379
+ <references id='T' obligation='informative' normative='false'>
380
+ <title depth="2">Bibliography Subsection</title>
381
+ </references>
382
+ </clause>
383
+ </bibliography>
384
+ </iso-standard>
382
385
  OUTPUT
383
386
  end
384
387
 
@@ -446,759 +449,768 @@ PRESXML
446
449
  </clause>
447
450
  </bibliography>
448
451
  </iso-standard>
449
- INPUT
452
+ INPUT
450
453
 
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
454
+ presxml = <<~"PRESXML"
455
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
456
+ <bibdata>
457
+ <language current="true">fr</language>
458
+ </bibdata>
459
+ <preface>
460
+ <foreword obligation='informative'>
461
+ <title>Foreword</title>
462
+ <p id='A'>See <xref target='M'>Article 5</xref></p>
463
+ </foreword>
464
+ <introduction id='B' obligation='informative'>
465
+ <title>Introduction</title>
466
+ <clause id='C' inline-header='false' obligation='informative'>
467
+ <title depth='2'>Introduction Subsection</title>
468
+ </clause>
469
+ </introduction>
470
+ </preface>
471
+ <sections>
472
+ <clause id='D' obligation='normative' type="scope">
473
+ <title depth='1'>1.<tab/>Scope</title>
474
+ <p id='E'>Text</p>
475
+ </clause>
476
+ <clause id='H' obligation='normative'>
477
+ <title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
478
+ <terms id='I' obligation='normative'>
479
+ <title depth='2'>3.1.<tab/>Normal Terms</title>
480
+ <term id='J'>
481
+ <name>3.1.1.</name>
482
+ <preferred>Term2</preferred>
483
+ </term>
484
+ </terms>
485
+ <definitions id='K'>
486
+ <title>3.2.</title>
487
+ <dl>
488
+ <dt>Symbol</dt>
489
+ <dd>Definition</dd>
490
+ </dl>
491
+ </definitions>
492
+ </clause>
493
+ <definitions id='L'>
494
+ <title>4.</title>
495
+ <dl>
496
+ <dt>Symbol</dt>
497
+ <dd>Definition</dd>
498
+ </dl>
499
+ </definitions>
500
+ <clause id='M' inline-header='false' obligation='normative'>
501
+ <title depth='1'>5.<tab/>Clause 4</title>
502
+ <clause id='N' inline-header='false' obligation='normative'>
503
+ <title depth='2'>5.1.<tab/>Introduction</title>
504
+ </clause>
505
+ <clause id='O' inline-header='false' obligation='normative'>
506
+ <title depth='2'>5.2.<tab/>Clause 4.2</title>
507
+ </clause>
508
+ </clause>
509
+ </sections>
510
+ <annex id='P' inline-header='false' obligation='normative'>
511
+ <title>
512
+ <strong>Annexe A</strong>
513
+ <br/>
514
+ (normative)
515
+ <br/>
516
+ <br/>
517
+ <strong>Annex</strong>
518
+ </title>
519
+ <clause id='Q' inline-header='false' obligation='normative'>
520
+ <title depth='2'>A.1.<tab/>Annex A.1</title>
521
+ <clause id='Q1' inline-header='false' obligation='normative'>
522
+ <title depth='3'>A.1.1.<tab/>Annex A.1a</title>
523
+ </clause>
524
+ </clause>
525
+ </annex>
526
+ <bibliography>
527
+ <references id='R' obligation='informative' normative='true'>
528
+ <title depth='1'>2.<tab/>Normative References</title>
529
+ </references>
530
+ <clause id='S' obligation='informative'>
531
+ <title depth="1">Bibliographie</title>
532
+ <references id='T' obligation='informative' normative='false'>
533
+ <title depth="2">Bibliography Subsection</title>
534
+ </references>
535
+ </clause>
536
+ </bibliography>
537
+ </iso-standard>
538
+ PRESXML
536
539
 
537
540
  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>
541
+ #{HTML_HDR.gsub(/ lang="en">/, ' lang="fr">')}
542
+ <br/>
543
+ <div>
544
+ <h1 class="ForewordTitle">Foreword</h1>
545
+ <p id='A'>
546
+ See
547
+ <a href='#M'>Article 5</a>
548
+ </p>
549
+ </div>
550
+ <br/>
551
+ <div class="Section3" id="B">
552
+ <h1 class="IntroTitle">Introduction</h1>
553
+ <div id="C">
554
+ <h2>Introduction Subsection</h2>
555
+ </div>
556
+ </div>
557
+ <p class="zzSTDTitle1"/>
558
+ <div id="D">
559
+ <h1>1.&#160; Scope</h1>
560
+ <p id="E">Text</p>
561
+ </div>
562
+ <div>
563
+ <h1>2.&#160; Normative References</h1>
564
+ </div>
565
+ <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
566
+ <div id="I">
567
+ <h2>3.1.&#160; Normal Terms</h2>
568
+ <p class="TermNum" id="J">3.1.1.</p>
569
+ <p class="Terms" style="text-align:left;">Term2</p>
570
+ </div><div id="K"><h2>3.2.</h2>
571
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
572
+ </div></div>
573
+ <div id="L" class="Symbols">
574
+ <h1>4.</h1>
575
+ <dl>
576
+ <dt>
577
+ <p>Symbol</p>
578
+ </dt>
579
+ <dd>Definition</dd>
580
+ </dl>
581
+ </div>
582
+ <div id="M">
583
+ <h1>5.&#160; Clause 4</h1>
584
+ <div id="N">
585
+ <h2>5.1.&#160; Introduction</h2>
586
+ </div>
587
+ <div id="O">
588
+ <h2>5.2.&#160; Clause 4.2</h2>
589
+ </div>
590
+ </div>
591
+ <br/>
592
+ <div id="P" class="Section3">
593
+ <h1 class="Annex"><b>Annexe A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
594
+ <div id="Q">
595
+ <h2>A.1.&#160; Annex A.1</h2>
596
+ <div id="Q1">
597
+ <h3>A.1.1.&#160; Annex A.1a</h3>
598
+ </div>
599
+ </div>
600
+ </div>
601
+ <br/>
602
+ <div>
603
+ <h1 class="Section3">Bibliographie</h1>
604
+ <div>
605
+ <h2 class="Section3">Bibliography Subsection</h2>
606
+ </div>
607
+ </div>
608
+ </div>
609
+ </body>
610
+ </html>
609
611
  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
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
613
+ .convert("test", input, true)
614
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
615
+ .to be_equivalent_to xmlpp(presxml)
616
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
617
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
612
618
  end
613
619
 
614
620
  it "processes Simplified Chinese" do
615
621
  input = <<~"INPUT"
616
- <iso-standard xmlns="http://riboseinc.com/isoxml">
617
- <bibdata>
618
- <language>zh</language>
619
- <script>Hans</script>
620
- </bibdata>
621
- <preface>
622
- <foreword obligation="informative">
623
- <title>Foreword</title>
624
- <p id="A">See <xref target="M"/></p>
625
- </foreword>
626
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
627
- <title>Introduction Subsection</title>
628
- </clause>
629
- </introduction></preface><sections>
630
- <clause id="D" obligation="normative" type="scope">
631
- <title>Scope</title>
632
- <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
633
- </clause>
634
-
635
- <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
636
- <title>Normal Terms</title>
637
- <term id="J">
638
- <preferred>Term2</preferred>
639
- </term>
640
- </terms>
641
- <definitions id="K">
642
- <dl>
643
- <dt>Symbol</dt>
644
- <dd>Definition</dd>
645
- </dl>
646
- </definitions>
647
- </clause>
648
- <definitions id="L">
649
- <dl>
650
- <dt>Symbol</dt>
651
- <dd>Definition</dd>
652
- </dl>
653
- </definitions>
654
- <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
655
- <title>Introduction</title>
656
- </clause>
657
- <clause id="O" inline-header="false" obligation="normative">
658
- <title>Clause 4.2</title>
659
- </clause></clause>
660
-
661
- </sections><annex id="P" inline-header="false" obligation="normative">
662
- <title>Annex</title>
663
- <clause id="Q" inline-header="false" obligation="normative">
664
- <title>Annex A.1</title>
665
- <clause id="Q1" inline-header="false" obligation="normative">
666
- <title>Annex A.1a</title>
667
- </clause>
668
- </clause>
669
- </annex><bibliography><references id="R" obligation="informative" normative="true">
670
- <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
- </references><clause id="S" obligation="informative">
682
- <title>Bibliography</title>
683
- <references id="T" obligation="informative" normative="false">
684
- <title>Bibliography Subsection</title>
685
- </references>
686
- </clause>
687
- </bibliography>
688
- </iso-standard>
689
- INPUT
690
-
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
622
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
623
+ <bibdata>
624
+ <language>zh</language>
625
+ <script>Hans</script>
626
+ </bibdata>
627
+ <preface>
628
+ <foreword obligation="informative">
629
+ <title>Foreword</title>
630
+ <p id="A">See <xref target="M"/></p>
631
+ </foreword>
632
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
633
+ <title>Introduction Subsection</title>
634
+ </clause>
635
+ </introduction></preface><sections>
636
+ <clause id="D" obligation="normative" type="scope">
637
+ <title>Scope</title>
638
+ <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
639
+ </clause>
640
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
641
+ <title>Normal Terms</title>
642
+ <term id="J">
643
+ <preferred>Term2</preferred>
644
+ </term>
645
+ </terms>
646
+ <definitions id="K">
647
+ <dl>
648
+ <dt>Symbol</dt>
649
+ <dd>Definition</dd>
650
+ </dl>
651
+ </definitions>
652
+ </clause>
653
+ <definitions id="L">
654
+ <dl>
655
+ <dt>Symbol</dt>
656
+ <dd>Definition</dd>
657
+ </dl>
658
+ </definitions>
659
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
660
+ <title>Introduction</title>
661
+ </clause>
662
+ <clause id="O" inline-header="false" obligation="normative">
663
+ <title>Clause 4.2</title>
664
+ </clause></clause>
665
+ </sections><annex id="P" inline-header="false" obligation="normative">
666
+ <title>Annex</title>
667
+ <clause id="Q" inline-header="false" obligation="normative">
668
+ <title>Annex A.1</title>
669
+ <clause id="Q1" inline-header="false" obligation="normative">
670
+ <title>Annex A.1a</title>
671
+ </clause>
672
+ </clause>
673
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
674
+ <title>Normative References</title>
675
+ <bibitem id="ISO712" type="standard">
676
+ <title format="text/plain">Cereals and cereal products</title>
677
+ <docidentifier>ISO 712</docidentifier>
678
+ <contributor>
679
+ <role type="publisher"/>
680
+ <organization>
681
+ <abbreviation>ISO</abbreviation>
682
+ </organization>
683
+ </contributor>
684
+ </bibitem>
685
+ </references><clause id="S" obligation="informative">
686
+ <title>Bibliography</title>
687
+ <references id="T" obligation="informative" normative="false">
688
+ <title>Bibliography Subsection</title>
689
+ </references>
690
+ </clause>
691
+ </bibliography>
692
+ </iso-standard>
693
+ INPUT
788
694
 
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>
695
+ presxml = <<~"PRESXML"
696
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
697
+ <bibdata>
698
+ <language current="true">zh</language>
699
+ <script current="true">Hans</script>
700
+ </bibdata>
701
+ <preface>
702
+ <foreword obligation='informative'>
703
+ <title>Foreword</title>
704
+ <p id='A'>See <xref target='M'>&#x6761;5</xref></p>
705
+ </foreword>
706
+ <introduction id='B' obligation='informative'>
707
+ <title>Introduction</title>
708
+ <clause id='C' inline-header='false' obligation='informative'>
709
+ <title depth='2'>Introduction Subsection</title>
710
+ </clause>
711
+ </introduction>
712
+ </preface>
713
+ <sections>
714
+ <clause id='D' obligation='normative' type="scope">
715
+ <title depth='1'>1.<tab/>Scope</title>
716
+ <p id='E'>
717
+ <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>
718
+ </clause>
719
+ <clause id='H' obligation='normative'>
720
+ <title depth='1'>3.<tab/>Terms, definitions, symbols and abbreviated terms</title>
721
+ <terms id='I' obligation='normative'>
722
+ <title depth='2'>3.1.<tab/>Normal Terms</title>
723
+ <term id='J'>
724
+ <name>3.1.1.</name>
725
+ <preferred>Term2</preferred>
726
+ </term>
727
+ </terms>
728
+ <definitions id='K'>
729
+ <title>3.2.</title>
730
+ <dl>
731
+ <dt>Symbol</dt>
732
+ <dd>Definition</dd>
733
+ </dl>
734
+ </definitions>
735
+ </clause>
736
+ <definitions id='L'>
737
+ <title>4.</title>
738
+ <dl>
739
+ <dt>Symbol</dt>
740
+ <dd>Definition</dd>
741
+ </dl>
742
+ </definitions>
743
+ <clause id='M' inline-header='false' obligation='normative'>
744
+ <title depth='1'>5.<tab/>Clause 4</title>
745
+ <clause id='N' inline-header='false' obligation='normative'>
746
+ <title depth='2'>5.1.<tab/>Introduction</title>
747
+ </clause>
748
+ <clause id='O' inline-header='false' obligation='normative'>
749
+ <title depth='2'>5.2.<tab/>Clause 4.2</title>
750
+ </clause>
751
+ </clause>
752
+ </sections>
753
+ <annex id='P' inline-header='false' obligation='normative'>
754
+ <title>
755
+ <strong>&#x9644;&#x4EF6;A</strong>
756
+ <br/>
757
+ &#xFF08;&#x89C4;&#x8303;&#x6027;&#x9644;&#x5F55;&#xFF09;
758
+ <br/>
759
+ <br/>
760
+ <strong>Annex</strong>
761
+ </title>
762
+ <clause id='Q' inline-header='false' obligation='normative'>
763
+ <title depth='2'>A.1.<tab/>Annex A.1</title>
764
+ <clause id='Q1' inline-header='false' obligation='normative'>
765
+ <title depth='3'>A.1.1.<tab/>Annex A.1a</title>
766
+ </clause>
767
+ </clause>
768
+ </annex>
769
+ <bibliography>
770
+ <references id='R' obligation='informative' normative='true'>
771
+ <title depth='1'>2.<tab/>Normative References</title>
772
+ <bibitem id='ISO712' type='standard'>
773
+ <title format='text/plain'>Cereals and cereal products</title>
774
+ <docidentifier>ISO 712</docidentifier>
775
+ <contributor>
776
+ <role type='publisher'/>
777
+ <organization>
778
+ <abbreviation>ISO</abbreviation>
779
+ </organization>
780
+ </contributor>
781
+ </bibitem>
782
+ </references>
783
+ <clause id='S' obligation='informative'>
784
+ <title depth="1">Bibliography</title>
785
+ <references id='T' obligation='informative' normative='false'>
786
+ <title depth="2">Bibliography Subsection</title>
787
+ </references>
788
+ </clause>
789
+ </bibliography>
790
+ </iso-standard>
791
+ PRESXML
822
792
 
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>
793
+ output = <<~"OUTPUT"
794
+ #{HTML_HDR.gsub(/ lang="en">/, ' lang="zh">')}
795
+ <br/>
796
+ <div>
797
+ <h1 class="ForewordTitle">Foreword</h1>
798
+ <p id='A'>
799
+ See
800
+ <a href='#M'>&#26465;5</a>
801
+ </p>
802
+ </div>
803
+ <br/>
804
+ <div class="Section3" id="B">
805
+ <h1 class="IntroTitle">Introduction</h1>
806
+ <div id="C">
807
+ <h2>Introduction Subsection</h2>
808
+ </div>
809
+ </div>
810
+ <p class="zzSTDTitle1"/>
811
+ <div id="D">
812
+ <h1>1.&#12288;Scope</h1>
813
+ <p id="E">
814
+ <a href='#ISO712'>ISO 712&#12289;&#31532;1&#8211;1&#34920;</a>
815
+ </p>
816
+ </div>
817
+ <div>
818
+ <h1>2.&#12288;Normative References</h1>
819
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
820
+ </div>
821
+ <div id="H"><h1>3.&#12288;Terms, definitions, symbols and abbreviated terms</h1>
822
+ <div id="I">
823
+ <h2>3.1.&#12288;Normal Terms</h2>
824
+ <p class="TermNum" id="J">3.1.1.</p>
825
+ <p class="Terms" style="text-align:left;">Term2</p>
826
+ </div><div id="K"><h2>3.2.</h2>
827
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
828
+ </div></div>
829
+ <div id="L" class="Symbols">
830
+ <h1>4.</h1>
831
+ <dl>
832
+ <dt>
833
+ <p>Symbol</p>
834
+ </dt>
835
+ <dd>Definition</dd>
836
+ </dl>
837
+ </div>
838
+ <div id="M">
839
+ <h1>5.&#12288;Clause 4</h1>
840
+ <div id="N">
841
+ <h2>5.1.&#12288;Introduction</h2>
842
+ </div>
843
+ <div id="O">
844
+ <h2>5.2.&#12288;Clause 4.2</h2>
845
+ </div>
846
+ </div>
847
+ <br/>
848
+ <div id="P" class="Section3">
849
+ <h1 class="Annex"><b>&#38468;&#20214;A</b><br/>&#65288;&#35268;&#33539;&#24615;&#38468;&#24405;&#65289;<br/><br/><b>Annex</b></h1>
850
+ <div id="Q">
851
+ <h2>A.1.&#12288;Annex A.1</h2>
852
+ <div id="Q1">
853
+ <h3>A.1.1.&#12288;Annex A.1a</h3>
854
+ </div>
855
+ </div>
856
+ </div>
857
+ <br/>
858
+ <div>
859
+ <h1 class="Section3">Bibliography</h1>
860
+ <div>
861
+ <h2 class="Section3">Bibliography Subsection</h2>
862
+ </div>
863
+ </div>
864
+ </div>
865
+ </body>
866
+ </html>
864
867
  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)
868
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
869
+ .convert("test", input, true)
870
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
871
+ .to be_equivalent_to xmlpp(presxml)
872
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
873
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
867
874
  end
868
875
 
869
876
  it "processes i18n file" do
870
877
  mock_i18n
871
878
  input = <<~"INPUT"
872
- <iso-standard xmlns="http://riboseinc.com/isoxml">
873
- <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>
883
- </bibdata>
884
- <preface>
885
- <foreword obligation="informative">
886
- <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"/>
890
- </foreword>
891
- <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
892
- <title>Introduction Subsection</title>
893
- </clause>
894
- </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>
898
- </clause>
879
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
880
+ <bibdata>
881
+ <language>eo</language>
882
+ <script>Latn</script>
883
+ <status>
884
+ <stage>published</stage>
885
+ <substage>withdrawn</substage>
886
+ </status>
887
+ <ext>
888
+ <doctype>brochure</doctype>
889
+ </ext>
890
+ </bibdata>
891
+ <preface>
892
+ <foreword obligation="informative">
893
+ <title>Foreword</title>
894
+ <p id="A">See <xref target="M"/></p>
895
+ <p id="A">See <xref target="tab"/></p>
896
+ <table id="tab"/>
897
+ </foreword>
898
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
899
+ <title>Introduction Subsection</title>
900
+ </clause>
901
+ </introduction></preface><sections>
902
+ <clause id="D" obligation="normative" type="scope">
903
+ <title>Scope</title>
904
+ <p id="E"><eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref></p>
905
+ </clause>
906
+ <clause id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
907
+ <title>Normal Terms</title>
908
+ <term id="J">
909
+ <preferred>Term2</preferred>
910
+ </term>
911
+ </terms>
912
+ <definitions id="K">
913
+ <dl>
914
+ <dt>Symbol</dt>
915
+ <dd>Definition</dd>
916
+ </dl>
917
+ </definitions>
918
+ </clause>
919
+ <definitions id="L">
920
+ <dl>
921
+ <dt>Symbol</dt>
922
+ <dd>Definition</dd>
923
+ </dl>
924
+ </definitions>
925
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
926
+ <title>Introduction</title>
927
+ <note id="M-n1"/>
928
+ </clause>
929
+ <clause id="O" inline-header="false" obligation="normative">
930
+ <title>Clause 4.2</title>
931
+ </clause></clause>
932
+ </sections><annex id="P" inline-header="false" obligation="normative">
933
+ <title>Annex</title>
934
+ <clause id="Q" inline-header="false" obligation="normative">
935
+ <title>Annex A.1</title>
936
+ <clause id="Q1" inline-header="false" obligation="normative">
937
+ <title>Annex A.1a</title>
938
+ </clause>
939
+ </clause>
940
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
941
+ <title>Normative References</title>
942
+ <bibitem id="ISO712" type="standard">
943
+ <title format="text/plain">Cereals and cereal products</title>
944
+ <docidentifier>ISO 712</docidentifier>
945
+ <contributor>
946
+ <role type="publisher"/>
947
+ <organization>
948
+ <abbreviation>ISO</abbreviation>
949
+ </organization>
950
+ </contributor>
951
+ </bibitem>
952
+ </references><clause id="S" obligation="informative">
953
+ <title>Bibliography</title>
954
+ <references id="T" obligation="informative" normative="false">
955
+ <title>Bibliography Subsection</title>
956
+ </references>
957
+ </clause>
958
+ </bibliography>
959
+ </iso-standard>
960
+ INPUT
899
961
 
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">
903
- <preferred>Term2</preferred>
904
- </term>
905
- </terms>
906
- <definitions id="K">
907
- <dl>
908
- <dt>Symbol</dt>
909
- <dd>Definition</dd>
910
- </dl>
911
- </definitions>
912
- </clause>
913
- <definitions id="L">
914
- <dl>
915
- <dt>Symbol</dt>
916
- <dd>Definition</dd>
917
- </dl>
918
- </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"/>
922
- </clause>
923
- <clause id="O" inline-header="false" obligation="normative">
924
- <title>Clause 4.2</title>
925
- </clause></clause>
926
-
927
- </sections><annex id="P" inline-header="false" obligation="normative">
928
- <title>Annex</title>
929
- <clause id="Q" inline-header="false" obligation="normative">
930
- <title>Annex A.1</title>
931
- <clause id="Q1" inline-header="false" obligation="normative">
932
- <title>Annex A.1a</title>
933
- </clause>
934
- </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>
949
- <references id="T" obligation="informative" normative="false">
950
- <title>Bibliography Subsection</title>
951
- </references>
952
- </clause>
953
- </bibliography>
954
- </iso-standard>
955
- INPUT
956
-
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>
1018
-
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>
1045
-
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
962
+ presxml = <<~OUTPUT
963
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
964
+ <bibdata>
965
+ <language current="true">eo</language>
966
+ <script current="true">Latn</script>
967
+ <status>
968
+ <stage language=''>published</stage>
969
+ <stage language='eo'>publikigita</stage>
970
+ <substage language=''>withdrawn</substage>
971
+ <substage language='eo'>fortirita</substage>
972
+ </status>
973
+ <ext>
974
+ <doctype language=''>brochure</doctype>
975
+ <doctype language='eo'>bro&#x15D;uro</doctype>
976
+ </ext>
977
+ </bibdata>
978
+ <localized-strings>
979
+ <localized-string key='foreword' language='eo'>Anta&#x16D;parolo</localized-string>
980
+ <localized-string key='introduction' language='eo'>Enkonduko</localized-string>
981
+ <localized-string key='clause' language='eo'>kla&#x16D;zo</localized-string>
982
+ <localized-string key='table' language='eo'>tabelo</localized-string>
983
+ <localized-string key='source' language='eo'>SOURCE</localized-string>
984
+ <localized-string key='modified' language='eo'>modified</localized-string>
985
+ <localized-string key='scope' language='eo'>Amplekso</localized-string>
986
+ <localized-string key='symbols' language='eo'>Simboloj kai mallongigitaj terminoj</localized-string>
987
+ <localized-string key='annex' language='eo'>Aldono</localized-string>
988
+ <localized-string key='normref' language='eo'>Normaj cita&#x135;oj</localized-string>
989
+ <localized-string key='bibliography' language='eo'>Bibliografio</localized-string>
990
+ <localized-string key='inform_annex' language='eo'>informa</localized-string>
991
+ <localized-string key='all_parts' language='eo'>&#x109;iuj partoj</localized-string>
992
+ <localized-string key='norm_annex' language='eo'>normative</localized-string>
993
+ <localized-string key='note' language='eo'>NOTO</localized-string>
994
+ <localized-string key='locality.table' language='eo'>Tabelo</localized-string>
995
+ <localized-string key='doctype_dict.brochure' language='eo'>bro&#x15D;uro</localized-string>
996
+ <localized-string key='doctype_dict.conference_proceedings' language='eo'>konferencaktoj</localized-string>
997
+ <localized-string key='stage_dict.published' language='eo'>publikigita</localized-string>
998
+ <localized-string key='substage_dict.withdrawn' language='eo'>fortirita</localized-string>
999
+ <localized-string key='array.0' language='eo'>elem1</localized-string>
1000
+ <localized-string key='array.1' language='eo'>elem2</localized-string>
1001
+ <localized-string key='array.2.elem3' language='eo'>elem4</localized-string>
1002
+ <localized-string key='array.2.elem5' language='eo'>elem6</localized-string>
1003
+ <localized-string key='language' language='eo'>eo</localized-string>
1004
+ <localized-string key='script' language='eo'>Latn</localized-string>
1005
+ </localized-strings>
1006
+ <preface>
1007
+ <foreword obligation="informative">
1008
+ <title>Foreword</title>
1009
+ <p id='A'>See <xref target='M'>kla&#x16D;zo 5</xref></p>
1010
+ <p id='A'>See <xref target='tab'>tabelo 1</xref></p>
1011
+ <table id='tab'>
1012
+ <name>Tabelo 1</name>
1013
+ </table>
1014
+ </foreword>
1015
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
1016
+ <title depth="2">Introduction Subsection</title>
1017
+ </clause>
1018
+ </introduction></preface><sections>
1019
+ <clause id="D" obligation="normative" type="scope">
1020
+ <title depth="1">1.<tab/>Scope</title>
1021
+ <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>
1022
+ </clause>
1023
+ <clause id="H" obligation="normative"><title depth="1">3.<tab/>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
1024
+ <title depth="2">3.1.<tab/>Normal Terms</title>
1025
+ <term id="J"><name>3.1.1.</name>
1026
+ <preferred>Term2</preferred>
1027
+ </term>
1028
+ </terms>
1029
+ <definitions id="K"><title>3.2.</title>
1030
+ <dl>
1031
+ <dt>Symbol</dt>
1032
+ <dd>Definition</dd>
1033
+ </dl>
1034
+ </definitions>
1035
+ </clause>
1036
+ <definitions id="L"><title>4.</title>
1037
+ <dl>
1038
+ <dt>Symbol</dt>
1039
+ <dd>Definition</dd>
1040
+ </dl>
1041
+ </definitions>
1042
+ <clause id="M" inline-header="false" obligation="normative"><title depth="1">5.<tab/>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
1043
+ <title depth="2">5.1.<tab/>Introduction</title>
1044
+ <note id='M-n1'><name>NOTO </name></note>
1045
+ </clause>
1046
+ <clause id="O" inline-header="false" obligation="normative">
1047
+ <title depth="2">5.2.<tab/>Clause 4.2</title>
1048
+ </clause></clause>
1049
+ </sections><annex id="P" inline-header="false" obligation="normative">
1050
+ <title><strong>Aldono A</strong><br/>(normative)<br/><br/><strong>Annex</strong></title>
1051
+ <clause id="Q" inline-header="false" obligation="normative">
1052
+ <title depth="2">A.1.<tab/>Annex A.1</title>
1053
+ <clause id="Q1" inline-header="false" obligation="normative">
1054
+ <title depth="3">A.1.1.<tab/>Annex A.1a</title>
1055
+ </clause>
1056
+ </clause>
1057
+ </annex><bibliography><references id="R" obligation="informative" normative="true">
1058
+ <title depth="1">2.<tab/>Normative References</title>
1059
+ <bibitem id="ISO712" type="standard">
1060
+ <title format="text/plain">Cereals and cereal products</title>
1061
+ <docidentifier>ISO 712</docidentifier>
1062
+ <contributor>
1063
+ <role type="publisher"/>
1064
+ <organization>
1065
+ <abbreviation>ISO</abbreviation>
1066
+ </organization>
1067
+ </contributor>
1068
+ </bibitem>
1069
+ </references><clause id="S" obligation="informative">
1070
+ <title depth="1">Bibliography</title>
1071
+ <references id="T" obligation="informative" normative="false">
1072
+ <title depth="2">Bibliography Subsection</title>
1073
+ </references>
1074
+ </clause>
1075
+ </bibliography>
1076
+ </iso-standard>
1077
+ OUTPUT
1075
1078
 
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>
1143
- <dl>
1144
- <dt>
1145
- <p>Symbol</p>
1146
- </dt>
1147
- <dd>Definition</dd>
1148
- </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)
1079
+ output = <<~OUTPUT
1080
+ <html lang='eo'>
1081
+ <head/>
1082
+ <body lang='eo'>
1083
+ <div class='title-section'>
1084
+ <p>&#160;</p>
1085
+ </div>
1171
1086
  <br/>
1087
+ <div class='prefatory-section'>
1088
+ <p>&#160;</p>
1089
+ </div>
1172
1090
  <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>
1091
+ <div class='main-section'>
1092
+ <br/>
1093
+ <div>
1094
+ <h1 class='ForewordTitle'>Foreword</h1>
1095
+ <p id='A'>
1096
+ See
1097
+ <a href='#M'>kla&#365;zo 5</a>
1098
+ </p>
1099
+ <p id='A'>
1100
+ See
1101
+ <a href='#tab'>tabelo 1</a>
1102
+ </p>
1103
+ <p class='TableTitle' style='text-align:center;'>Tabelo 1</p>
1104
+ <table id='tab' class='MsoISOTable' style='border-width:1px;border-spacing:0;'/>
1105
+ </div>
1106
+ <br/>
1107
+ <div class='Section3' id='B'>
1108
+ <h1 class='IntroTitle'>Introduction</h1>
1109
+ <div id='C'>
1110
+ <h2>Introduction Subsection</h2>
1111
+ </div>
1112
+ </div>
1113
+ <p class='zzSTDTitle1'/>
1114
+ <div id='D'>
1115
+ <h1>1.&#160; Scope</h1>
1116
+ <p id='E'>
1117
+ <a href='#ISO712'>ISO 712, Tabelo 1&#8211;1</a>
1118
+ </p>
1119
+ </div>
1120
+ <div>
1121
+ <h1>2.&#160; Normative References</h1>
1122
+ <p id='ISO712' class='NormRef'>
1123
+ ISO 712,
1124
+ <i>Cereals and cereal products</i>
1125
+ </p>
1126
+ </div>
1127
+ <div id='H'>
1128
+ <h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1>
1129
+ <div id='I'>
1130
+ <h2>3.1.&#160; Normal Terms</h2>
1131
+ <p class='TermNum' id='J'>3.1.1.</p>
1132
+ <p class='Terms' style='text-align:left;'>Term2</p>
1133
+ </div>
1134
+ <div id='K'>
1135
+ <h2>3.2.</h2>
1136
+ <dl>
1137
+ <dt>
1138
+ <p>Symbol</p>
1139
+ </dt>
1140
+ <dd>Definition</dd>
1141
+ </dl>
1142
+ </div>
1143
+ </div>
1144
+ <div id='L' class='Symbols'>
1145
+ <h1>4.</h1>
1146
+ <dl>
1147
+ <dt>
1148
+ <p>Symbol</p>
1149
+ </dt>
1150
+ <dd>Definition</dd>
1151
+ </dl>
1152
+ </div>
1153
+ <div id='M'>
1154
+ <h1>5.&#160; Clause 4</h1>
1155
+ <div id='N'>
1156
+ <h2>5.1.&#160; Introduction</h2>
1157
+ <div id='M-n1' class='Note'>
1158
+ <p>
1159
+ <span class='note_label'>NOTO </span>
1160
+ &#160;
1161
+ </p>
1162
+ </div>
1163
+ </div>
1164
+ <div id='O'>
1165
+ <h2>5.2.&#160; Clause 4.2</h2>
1166
+ </div>
1167
+ </div>
1168
+ <br/>
1169
+ <div id='P' class='Section3'>
1170
+ <h1 class='Annex'>
1171
+ <b>Aldono A</b>
1172
+ <br/>
1173
+ (normative)
1174
+ <br/>
1175
+ <br/>
1176
+ <b>Annex</b>
1177
+ </h1>
1178
+ <div id='Q'>
1179
+ <h2>A.1.&#160; Annex A.1</h2>
1180
+ <div id='Q1'>
1181
+ <h3>A.1.1.&#160; Annex A.1a</h3>
1182
+ </div>
1183
+ </div>
1184
+ </div>
1185
+ <br/>
1186
+ <div>
1187
+ <h1 class='Section3'>Bibliography</h1>
1188
+ <div>
1189
+ <h2 class='Section3'>Bibliography Subsection</h2>
1190
+ </div>
1191
+ </div>
1179
1192
  </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
1193
+ </body>
1194
+ </html>
1195
+ OUTPUT
1193
1196
 
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)
1197
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1198
+ .new({ i18nyaml: "spec/assets/i18n.yaml" })
1199
+ .convert("test", input, true)))
1200
+ .to be_equivalent_to xmlpp(presxml)
1201
+ expect(xmlpp(IsoDoc::HtmlConvert
1202
+ .new({ i18nyaml: "spec/assets/i18n.yaml" })
1203
+ .convert("test", presxml, true)))
1204
+ .to be_equivalent_to xmlpp(output)
1196
1205
  end
1197
1206
 
1198
1207
  private
1199
1208
 
1200
1209
  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")))
1210
+ allow_any_instance_of(::IsoDoc::I18n)
1211
+ .to receive(:load_yaml)
1212
+ .with("eo", "Latn", "spec/assets/i18n.yaml")
1213
+ .and_return(IsoDoc::I18n.new("eo", "Latn")
1214
+ .normalise_hash(YAML.load_file("spec/assets/i18n.yaml")))
1202
1215
  end
1203
-
1204
1216
  end