isodoc 1.6.6 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@ require_relative "xref_gen_seq"
3
3
  module IsoDoc::XrefGen
4
4
  module Blocks
5
5
  NUMBERED_BLOCKS = %w(termnote termexample note example requirement
6
- recommendation permission figure table formula admonition sourcecode).freeze
6
+ recommendation permission figure table formula admonition sourcecode).freeze
7
7
 
8
8
  def amend_preprocess(xmldoc)
9
9
  xmldoc.xpath(ns("//amend[newcontent]")).each do |a|
@@ -60,9 +60,9 @@ module IsoDoc::XrefGen
60
60
 
61
61
  c.increment(n)
62
62
  idx = increment_label(examples, n, c, false)
63
- @anchors[n["id"]] = {
64
- type: "termexample", label: idx, value: c.print,
65
- xref: l10n("#{anchor(t['id'], :xref)}, "\
63
+ @anchors[n["id"]] =
64
+ { type: "termexample", label: idx, value: c.print,
65
+ xref: l10n("#{anchor(t['id'], :xref)}, "\
66
66
  "#{@labels['example_xref']} #{c.print}") }
67
67
  end
68
68
  end
@@ -86,9 +86,8 @@ module IsoDoc::XrefGen
86
86
 
87
87
  def note_anchor_names(sections)
88
88
  sections.each do |s|
89
- notes = s.xpath(CHILD_NOTES_XPATH)
90
89
  c = Counter.new
91
- notes.each do |n|
90
+ (notes = s.xpath(CHILD_NOTES_XPATH)).each do |n|
92
91
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
93
92
 
94
93
  @anchors[n["id"]] =
@@ -105,13 +104,12 @@ module IsoDoc::XrefGen
105
104
  "xmlns:example | ./xmlns:example".freeze
106
105
 
107
106
  CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | "\
108
- "./references"
107
+ "./references".freeze
109
108
 
110
109
  def example_anchor_names(sections)
111
110
  sections.each do |s|
112
- notes = s.xpath(CHILD_EXAMPLES_XPATH)
113
111
  c = Counter.new
114
- notes.each do |n|
112
+ (notes = s.xpath(CHILD_EXAMPLES_XPATH)).each do |n|
115
113
  next if @anchors[n["id"]] || n["id"].nil? || n["id"].empty?
116
114
 
117
115
  @anchors[n["id"]] =
@@ -145,14 +143,44 @@ module IsoDoc::XrefGen
145
143
  label = "#{prev_label}.#{label}" unless prev_label.empty?
146
144
  label = "#{list_anchor[:xref]} #{label}" if refer_list
147
145
  li["id"] and @anchors[li["id"]] =
148
- { xref: "#{label})", type: "listitem",
149
- container: list_anchor[:container] }
146
+ { xref: "#{label})", type: "listitem",
147
+ container: list_anchor[:container] }
150
148
  li.xpath(ns("./ol")).each do |ol|
151
149
  list_item_anchor_names(ol, list_anchor, depth + 1, label, false)
152
150
  end
153
151
  end
154
152
  end
155
153
 
154
+ def deflist_anchor_names(sections)
155
+ sections.each do |s|
156
+ notes = s.xpath(ns(".//dl")) - s.xpath(ns(".//clause//dl")) -
157
+ s.xpath(ns(".//appendix//dl")) - s.xpath(ns(".//dl//dl"))
158
+ c = Counter.new
159
+ notes.each do |n|
160
+ next if n["id"].nil? || n["id"].empty?
161
+
162
+ @anchors[n["id"]] =
163
+ anchor_struct(increment_label(notes, n, c), n,
164
+ @labels["deflist"], "deflist", false)
165
+ deflist_term_anchor_names(n, @anchors[n["id"]])
166
+ end
167
+ deflist_anchor_names(s.xpath(ns(CHILD_SECTIONS)))
168
+ end
169
+ end
170
+
171
+ def deflist_term_anchor_names(list, list_anchor)
172
+ list.xpath(ns("./dt")).each do |li|
173
+ label = li.text
174
+ label = l10n("#{list_anchor[:xref]}: #{label}")
175
+ li["id"] and @anchors[li["id"]] =
176
+ { xref: label, type: "deflistitem",
177
+ container: list_anchor[:container] }
178
+ li.xpath(ns("./dl")).each do |dl|
179
+ deflist_term_anchor_names(dl, list_anchor)
180
+ end
181
+ end
182
+ end
183
+
156
184
  def bookmark_anchor_names(docxml)
157
185
  docxml.xpath(ns(".//bookmark")).each do |n|
158
186
  next if n["id"].nil? || n["id"].empty?
@@ -6,7 +6,7 @@ RSpec.describe IsoDoc do
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <sections>
8
8
  <clause id="A">
9
- <form action="/action_page.php" id="F0" name="F1">
9
+ <form action="/action_page.php" id="F0" name="F1" class="C">
10
10
  <label for="fname">First name:</label><br/>
11
11
  <input type="text" id="fname" name="fname"/><br/>
12
12
  <label for="lname">Last name:</label><br/>
@@ -46,111 +46,115 @@ RSpec.describe IsoDoc do
46
46
  INPUT
47
47
 
48
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>
49
+ #{HTML_HDR}
50
+ <p class='zzSTDTitle1'/>
51
+ <div id='A'>
52
+ <h1/>
53
+ <form id='F0' name='F1' action='/action_page.php' class="C">
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
+ <div class="C" id="F0">
113
+ First name:
55
114
  <br/>
56
- <input id='fname' name='fname' type='text'/>
115
+ __________
57
116
  <br/>
58
- <label for='lname'>Last name:</label>
117
+ Last name:
59
118
  <br/>
60
- <input id='lname' name='lname' type='text'/>
119
+ __________
61
120
  <br/>
62
- <label for='pwd'>Password:</label>
121
+ Password:
63
122
  <br/>
64
- <input id='pwd' name='pwd' type='password'/>
123
+ __________
65
124
  <br/>
66
- <input id='male' name='gender' type='radio' value='male'/>
67
- <label for='male'>Male</label>
125
+ &#9678; Male
68
126
  <br/>
69
- <input id='female' name='gender' type='radio' value='female'/>
70
- <label for='female'>Female</label>
127
+ &#9678; Female
71
128
  <br/>
72
- <input id='other' name='gender' type='radio' value='other'/>
73
- <label for='other'>Other</label>
129
+ &#9678; Other
74
130
  <br/>
75
- <input id='vehicle1' name='vehicle1' type='checkbox' value='Bike' checked='true'/>
76
- <label for='vehicle1'> I have a bike</label>
131
+ &#9744; I have a bike
77
132
  <br/>
78
- <input id='vehicle2' name='vehicle2' type='checkbox' value='Car'/>
79
- <label for='vehicle2'> I have a car</label>
133
+ &#9744; I have a car
80
134
  <br/>
81
- <input id='vehicle3' name='vehicle3' type='checkbox' value='Boat'/>
82
- <label for='vehicle3'> I have a boat</label>
135
+ &#9744; I have a boat
83
136
  <br/>
84
- <input id='birthday' name='birthday' type='date'/>
137
+ __________
85
138
  <br/>
86
- <label for='myfile'>Select a file:</label>
87
- <input id='myfile' name='myfile' type='file'/>
139
+ Select a file: __________
88
140
  <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]
141
+ Select a car: __________
142
+ <table border='1' width='50%'>
143
+ <tr>
144
+ <td/>
145
+ </tr>
146
+ </table>
147
+ [Click Me!] [BUTTON]
148
+ </div>
149
+ </div>
147
150
  </div>
148
- </div>
149
- </body>
150
- </html>
151
+ </body>
152
+ </html>
151
153
  DOC
152
154
 
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
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
156
+ .convert("test", input, true))).to be_equivalent_to xmlpp(html)
157
+ expect(xmlpp(IsoDoc::WordConvert.new({})
158
+ .convert("test", input, true))).to be_equivalent_to xmlpp(doc)
155
159
  end
156
160
  end
@@ -139,19 +139,28 @@ RSpec.describe IsoDoc do
139
139
  <preface><foreword>
140
140
  <p>
141
141
  <ul>
142
- <li><concept term='term'>
142
+ <li>
143
+ <concept><refterm>term</refterm>
143
144
  <xref target='clause1'/>
144
145
  </concept></li>
145
- <li><concept term='term'>
146
- <xref target='clause1'>w[o]rd</xref>
146
+ <li><concept><refterm>term</refterm>
147
+ <renderterm>term</renderterm>
148
+ <xref target='clause1'/>
149
+ </concept></li>
150
+ <li><concept><refterm>term</refterm>
151
+ <renderterm>w[o]rd</renderterm>
152
+ <xref target='clause1'>Clause #1</xref>
147
153
  </concept></li>
148
- <li><concept term='term'>
154
+ <li><concept><refterm>term</refterm>
155
+ <renderterm>term</renderterm>
149
156
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
150
157
  </concept></li>
151
- <li><concept term='term'>
152
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
158
+ <li><concept><refterm>term</refterm>
159
+ <renderterm>word</renderterm>
160
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>
153
161
  </concept></li>
154
- <li><concept>
162
+ <li><concept><refterm>term</refterm>
163
+ <renderterm>word</renderterm>
155
164
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
156
165
  <locality type='clause'>
157
166
  <referenceFrom>3.1</referenceFrom>
@@ -161,7 +170,8 @@ RSpec.describe IsoDoc do
161
170
  </locality>
162
171
  </eref>
163
172
  </concept></li>
164
- <li><concept>
173
+ <li><concept><refterm>term</refterm>
174
+ <renderterm>word</renderterm>
165
175
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
166
176
  <localityStack>
167
177
  <locality type='clause'>
@@ -175,7 +185,8 @@ RSpec.describe IsoDoc do
175
185
  </localityStack>
176
186
  </eref>
177
187
  </concept></li>
178
- <li><concept>
188
+ <li><concept><refterm>term</refterm>
189
+ <renderterm>word</renderterm>
179
190
  <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
180
191
  <localityStack>
181
192
  <locality type='clause'>
@@ -187,15 +198,22 @@ RSpec.describe IsoDoc do
187
198
  <referenceFrom>b</referenceFrom>
188
199
  </locality>
189
200
  </localityStack>
190
- <em>word</em>
201
+ The Aforementioned Citation
191
202
  </eref>
192
203
  </concept></li>
193
- <li><concept term='term'>
204
+ <li><concept><refterm>term</refterm>
205
+ <renderterm>word</renderterm>
194
206
  <termref base='IEV' target='135-13-13'/>
195
207
  </concept></li>
196
- <li><concept term='term'>
197
- <termref base='IEV' target='135-13-13'><em>word</em> word</termref>
208
+ <li><concept><refterm>term</refterm>
209
+ <renderterm>word</renderterm>
210
+ <termref base='IEV' target='135-13-13'>The IEV database</termref>
198
211
  </concept></li>
212
+ <li><concept><refterm>term</refterm>
213
+ <renderterm>word</renderterm>
214
+ <strong>error!</strong>
215
+ </concept>
216
+ </li>
199
217
  </ul>
200
218
  </p>
201
219
  </foreword></preface>
@@ -219,190 +237,159 @@ RSpec.describe IsoDoc do
219
237
  </iso-standard>
220
238
  INPUT
221
239
  presxml = <<~OUTPUT
222
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
223
- <preface>
224
- <foreword displayorder="1">
225
- <p>
226
- <ul>
227
- <li>
228
- <em>
229
- <xref target='clause1'>Clause 2</xref>
230
- </em>
231
- </li>
232
- <li>
233
- <em>
234
- <xref target='clause1'>w[o]rd</xref>
235
- </em>
236
- </li>
237
- <li>
238
- <em>
239
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
240
- </em>
241
- </li>
242
- <li>
243
- <em>
244
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
245
- </em>
246
- </li>
247
- <li>
248
- <em>
249
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
250
- <locality type='clause'>
251
- <referenceFrom>3.1</referenceFrom>
252
- </locality>
253
- <locality type='figure'>
254
- <referenceFrom>a</referenceFrom>
255
- </locality>
256
- ISO 712, Clause 3.1, Figure a
257
- </eref>
258
- </em>
259
- </li>
260
- <li>
261
- <em>
262
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
263
- <localityStack>
264
- <locality type='clause'>
265
- <referenceFrom>3.1</referenceFrom>
266
- </locality>
267
- </localityStack>
268
- <localityStack>
269
- <locality type='figure'>
270
- <referenceFrom>b</referenceFrom>
271
- </locality>
272
- </localityStack>
273
- ISO 712, Clause 3.1; Figure b
274
- </eref>
275
- </em>
276
- </li>
277
- <li>
278
- <em>
279
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
280
- <localityStack>
281
- <locality type='clause'>
282
- <referenceFrom>3.1</referenceFrom>
283
- </locality>
284
- </localityStack>
285
- <localityStack>
286
- <locality type='figure'>
287
- <referenceFrom>b</referenceFrom>
288
- </locality>
289
- </localityStack>
290
- <em>word</em>
291
- </eref>
292
- </em>
293
- </li>
294
- <li>
295
- [term defined in
296
- <termref base='IEV' target='135-13-13'/>
297
- ]
298
- </li>
299
- <li>
300
- <em>
301
- <termref base='IEV' target='135-13-13'>
302
- <em>word</em>
303
- word
304
- </termref>
305
- </em>
306
- </li>
307
- </ul>
308
- </p>
309
- </foreword>
310
- </preface>
240
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
241
+ <preface><foreword displayorder="1">
242
+ <p>
243
+ <ul>
244
+ <li>
245
+ [term defined in <xref target="clause1">Clause 2</xref>]
246
+ </li>
247
+ <li>
248
+ <em>term</em> [term defined in <xref target="clause1">Clause 2</xref>]
249
+ </li>
250
+ <li>
251
+ <em>w[o]rd</em> [<xref target="clause1">Clause #1</xref>]
252
+ </li>
253
+ <li>
254
+ <em>term</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>]
255
+ </li>
256
+ <li>
257
+ <em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>]
258
+ </li>
259
+ <li>
260
+ <em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
261
+ <referenceFrom>3.1</referenceFrom>
262
+ </locality><locality type="figure">
263
+ <referenceFrom>a</referenceFrom>
264
+ </locality>ISO 712, Clause 3.1, Figure a</eref>]
265
+ </li>
266
+ <li>
267
+ <em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack>
268
+ <locality type="clause">
269
+ <referenceFrom>3.1</referenceFrom>
270
+ </locality>
271
+ </localityStack><localityStack>
272
+ <locality type="figure">
273
+ <referenceFrom>b</referenceFrom>
274
+ </locality>
275
+ </localityStack>ISO 712, Clause 3.1; Figure b</eref>]
276
+ </li>
277
+ <li>
278
+ <em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
279
+ <localityStack>
280
+ <locality type="clause">
281
+ <referenceFrom>3.1</referenceFrom>
282
+ </locality>
283
+ </localityStack>
284
+ <localityStack>
285
+ <locality type="figure">
286
+ <referenceFrom>b</referenceFrom>
287
+ </locality>
288
+ </localityStack>
289
+ The Aforementioned Citation
290
+ </eref>]
291
+ </li>
292
+ <li>
293
+ <em>word</em> [term defined in <termref base="IEV" target="135-13-13"/>]
294
+ </li>
295
+ <li>
296
+ <em>word</em> [<termref base="IEV" target="135-13-13">The IEV database</termref>]
297
+ </li>
298
+ <li> <em>word</em> <strong>error!</strong> </li>
299
+ </ul>
300
+ </p>
301
+ </foreword></preface>
311
302
  <sections>
312
- <clause id='clause1' displayorder="3">
313
- <title depth='1'>
314
- 2.
315
- <tab/>
316
- Clause 1
317
- </title>
318
- </clause>
303
+ <clause id="clause1" displayorder="3"><title depth="1">2.<tab/>Clause 1</title></clause>
319
304
  </sections>
320
- <bibliography>
321
- <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
322
- <title depth='1'>
323
- 1.
324
- <tab/>
325
- Normative References
326
- </title>
327
- <p>
328
- The following documents are referred to in the text in such a way that
329
- some or all of their content constitutes requirements of this document.
330
- For dated references, only the edition cited applies. For undated
331
- references, the latest edition of the referenced document (including any
332
- amendments) applies.
333
- </p>
334
- <bibitem id='ISO712' type='standard'>
335
- <title format='text/plain'>Cereals or cereal products</title>
336
- <title type='main' format='text/plain'>Cereals and cereal products</title>
337
- <docidentifier type='ISO'>ISO 712</docidentifier>
338
- <contributor>
339
- <role type='publisher'/>
340
- <organization>
341
- <name>International Organization for Standardization</name>
342
- </organization>
343
- </contributor>
344
- </bibitem>
345
- </references>
346
- </bibliography>
347
- </iso-standard>
305
+ <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1.<tab/>Normative References</title>
306
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
307
+ <bibitem id="ISO712" type="standard">
308
+ <title format="text/plain">Cereals or cereal products</title>
309
+ <title type="main" format="text/plain">Cereals and cereal products</title>
310
+ <docidentifier type="ISO">ISO 712</docidentifier>
311
+ <contributor>
312
+ <role type="publisher"/>
313
+ <organization>
314
+ <name>International Organization for Standardization</name>
315
+ </organization>
316
+ </contributor>
317
+ </bibitem>
318
+ </references></bibliography>
319
+ </iso-standard>
348
320
  OUTPUT
349
321
  output = <<~OUTPUT
350
322
  #{HTML_HDR}
351
- <br/>
323
+ <br/>
352
324
  <div>
353
325
  <h1 class='ForewordTitle'>Foreword</h1>
354
326
  <p>
355
327
  <ul>
356
328
  <li>
357
- <i>
358
- <a href='#clause1'>Clause 2</a>
359
- </i>
329
+ [term defined in
330
+ <a href='#clause1'>Clause 2</a>
331
+ ]
360
332
  </li>
361
333
  <li>
362
- <i>
363
- <a href='#clause1'>w[o]rd</a>
364
- </i>
334
+ <i>term</i>
335
+ [term defined in
336
+ <a href='#clause1'>Clause 2</a>
337
+ ]
365
338
  </li>
366
339
  <li>
367
- <i>
368
- <a href='#ISO712'>ISO 712</a>
369
- </i>
340
+ <i>w[o]rd</i>
341
+ [
342
+ <a href='#clause1'>Clause #1</a>
343
+ ]
370
344
  </li>
371
345
  <li>
372
- <i>
373
- <a href='#ISO712'>word</a>
374
- </i>
346
+ <i>term</i>
347
+ [term defined in
348
+ <a href='#ISO712'>ISO 712</a>
349
+ ]
375
350
  </li>
376
351
  <li>
377
- <i>
378
- <a href='#ISO712'> ISO 712, Clause 3.1, Figure a </a>
379
- </i>
352
+ <i>word</i>
353
+ [
354
+ <a href='#ISO712'>The Aforementioned Citation</a>
355
+ ]
380
356
  </li>
381
357
  <li>
382
- <i>
383
- <a href='#ISO712'> ISO 712, Clause 3.1; Figure b </a>
384
- </i>
358
+ <i>word</i>
359
+ [term defined in
360
+ <a href='#ISO712'>ISO 712, Clause 3.1, Figure a</a>
361
+ ]
385
362
  </li>
386
363
  <li>
387
- <i>
388
- <a href='#ISO712'>
389
- <i>word</i>
390
- </a>
391
- </i>
364
+ <i>word</i>
365
+ [term defined in
366
+ <a href='#ISO712'>ISO 712, Clause 3.1; Figure b</a>
367
+ ]
392
368
  </li>
393
- <li> [term defined in Termbase IEV, term ID 135-13-13 ] </li>
394
369
  <li>
395
- <i> Termbase IEV, term ID 135-13-13 </i>
370
+ <i>word</i>
371
+ [
372
+ <a href='#ISO712'> The Aforementioned Citation </a>
373
+ ]
396
374
  </li>
375
+ <li>
376
+ <i>word</i>
377
+ [term defined in Termbase IEV, term ID 135-13-13]
378
+ </li>
379
+ <li>
380
+ <i>word</i>
381
+ [The IEV database]
382
+ </li>
383
+ <li> <i>word</i> <b>error!</b> </li>
397
384
  </ul>
398
385
  </p>
399
386
  </div>
400
387
  <p class='zzSTDTitle1'/>
401
388
  <div>
402
- <h1> 1. &#160; Normative References </h1>
389
+ <h1>1.&#160; Normative References</h1>
403
390
  <p>
404
- The following documents are referred to in the text in such a way
405
- that some or all of their content constitutes requirements of this
391
+ The following documents are referred to in the text in such a way that
392
+ some or all of their content constitutes requirements of this
406
393
  document. For dated references, only the edition cited applies. For
407
394
  undated references, the latest edition of the referenced document
408
395
  (including any amendments) applies.
@@ -413,7 +400,133 @@ RSpec.describe IsoDoc do
413
400
  </p>
414
401
  </div>
415
402
  <div id='clause1'>
416
- <h1> 2. &#160; Clause 1 </h1>
403
+ <h1>2.&#160; Clause 1</h1>
404
+ </div>
405
+ </div>
406
+ </body>
407
+ </html>
408
+ OUTPUT
409
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
410
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
411
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
412
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
413
+ end
414
+
415
+ it "processes concept attributes" do
416
+ input = <<~INPUT
417
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
418
+ <preface><foreword>
419
+ <p>
420
+ <ul>
421
+ <li>
422
+ <concept ital="true"><refterm>term</refterm>
423
+ <renderterm>term</renderterm>
424
+ <xref target='clause1'/>
425
+ </concept></li>
426
+ <li><concept ref="true"><refterm>term</refterm>
427
+ <renderterm>term</renderterm>
428
+ <xref target='clause1'/>
429
+ </concept></li>
430
+ <li><concept ital="true" ref="true"><refterm>term</refterm>
431
+ <renderterm>term</renderterm>
432
+ <xref target='clause1'/>
433
+ </concept></li>
434
+ <li><concept ital="false"><refterm>term</refterm>
435
+ <renderterm>term</renderterm>
436
+ <xref target='clause1'/>
437
+ </concept></li>
438
+ <li><concept ref="false"><refterm>term</refterm>
439
+ <renderterm>term</renderterm>
440
+ <xref target='clause1'/>
441
+ </concept></li>
442
+ <li><concept ital="false" ref="false"><refterm>term</refterm>
443
+ <renderterm>term</renderterm>
444
+ <xref target='clause1'/>
445
+ </concept></li>
446
+ </ul></p>
447
+ </foreword></preface>
448
+ <sections>
449
+ <clause id="clause1"><title>Clause 1</title></clause>
450
+ </sections>
451
+ </iso-standard>
452
+ INPUT
453
+ presxml = <<~OUTPUT
454
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
455
+ <preface><foreword displayorder="1">
456
+ <p>
457
+ <ul>
458
+ <li>
459
+
460
+ <em>term</em>
461
+ [term defined in <xref target="clause1">Clause 1</xref>]
462
+ </li>
463
+ <li>
464
+ <em>term</em>
465
+ [term defined in <xref target="clause1">Clause 1</xref>]
466
+ </li>
467
+ <li>
468
+ <em>term</em>
469
+ [term defined in <xref target="clause1">Clause 1</xref>]
470
+ </li>
471
+ <li>
472
+ term
473
+ [term defined in <xref target="clause1">Clause 1</xref>]
474
+ </li>
475
+ <li>
476
+ <em>term</em>
477
+
478
+ </li>
479
+ <li>
480
+ term
481
+
482
+ </li>
483
+ </ul></p>
484
+ </foreword></preface>
485
+ <sections>
486
+ <clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
487
+ </sections>
488
+ </iso-standard>
489
+ OUTPUT
490
+ output = <<~OUTPUT
491
+ #{HTML_HDR}
492
+ <br/>
493
+ <div>
494
+ <h1 class='ForewordTitle'>Foreword</h1>
495
+ <p>
496
+ <ul>
497
+ <li>
498
+ <i>term</i>
499
+ [term defined in
500
+ <a href='#clause1'>Clause 1</a>
501
+ ]
502
+ </li>
503
+ <li>
504
+ <i>term</i>
505
+ [term defined in
506
+ <a href='#clause1'>Clause 1</a>
507
+ ]
508
+ </li>
509
+ <li>
510
+ <i>term</i>
511
+ [term defined in
512
+ <a href='#clause1'>Clause 1</a>
513
+ ]
514
+ </li>
515
+ <li>
516
+ term [term defined in
517
+ <a href='#clause1'>Clause 1</a>
518
+ ]
519
+ </li>
520
+ <li>
521
+ <i>term</i>
522
+ </li>
523
+ <li> term </li>
524
+ </ul>
525
+ </p>
526
+ </div>
527
+ <p class='zzSTDTitle1'/>
528
+ <div id='clause1'>
529
+ <h1>1.&#160; Clause 1</h1>
417
530
  </div>
418
531
  </div>
419
532
  </body>
@@ -425,6 +538,90 @@ RSpec.describe IsoDoc do
425
538
  .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
426
539
  end
427
540
 
541
+ it "processes concept markup for symbols" do
542
+ input = <<~INPUT
543
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
544
+ <preface><foreword>
545
+ <p>
546
+ <ul>
547
+ <li><concept>
548
+ <refterm>term</refterm>
549
+ <renderterm>ISO</renderterm>
550
+ <xref target='d1'/>
551
+ </concept></li>
552
+ </ul>
553
+ </p>
554
+ </foreword>
555
+ </preface>
556
+ <sections>
557
+ <definitions id="d">
558
+ <dl>
559
+ <dt id="d1">ISO</dt> <dd>xyz</xyz>
560
+ <dt id="d2">IEC</dt> <dd>abc</xyz>
561
+ </dl>
562
+ </definitions>
563
+ </sections>
564
+ </iso-standard>
565
+ INPUT
566
+ presxml = <<~OUTPUT
567
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
568
+ <preface>
569
+ <foreword displayorder='1'>
570
+ <p>
571
+ <ul>
572
+ <li>ISO</li>
573
+ </ul>
574
+ </p>
575
+ </foreword>
576
+ </preface>
577
+ <sections>
578
+ <definitions id='d' displayorder='2'>
579
+ <title>1.</title>
580
+ <dl>
581
+ <dt id='d1'>ISO</dt>
582
+ <dd>xyz</dd>
583
+ <dt id='d2'>IEC</dt>
584
+ <dd>abc</dd>
585
+ </dl>
586
+ </definitions>
587
+ </sections>
588
+ </iso-standard>
589
+ OUTPUT
590
+ output = <<~OUTPUT
591
+ #{HTML_HDR}
592
+ <br/>
593
+ <div>
594
+ <h1 class='ForewordTitle'>Foreword</h1>
595
+ <p>
596
+ <ul>
597
+ <li>ISO</li>
598
+ </ul>
599
+ </p>
600
+ </div>
601
+ <p class='zzSTDTitle1'/>
602
+ <div id='d' class='Symbols'>
603
+ <h1>1.</h1>
604
+ <dl>
605
+ <dt id='d1'>
606
+ <p>ISO</p>
607
+ </dt>
608
+ <dd>xyz</dd>
609
+ <dt id='d2'>
610
+ <p>IEC</p>
611
+ </dt>
612
+ <dd>abc</dd>
613
+ </dl>
614
+ </div>
615
+ </div>
616
+ </body>
617
+ </html>
618
+ OUTPUT
619
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
620
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
621
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
622
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
623
+ end
624
+
428
625
  it "processes embedded inline formatting" do
429
626
  input = <<~INPUT
430
627
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -745,43 +942,43 @@ RSpec.describe IsoDoc do
745
942
  </iso-standard>
746
943
  INPUT
747
944
  presxml = <<~OUTPUT
748
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
749
- <preface><foreword displayorder="1">
750
- <p>
751
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
752
- <eref type="inline" bibitemid="ISO712">ISO 712</eref>
753
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
754
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
755
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
756
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
757
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
758
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
759
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
760
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
761
- <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
762
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
763
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
764
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
765
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
766
- <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
767
- <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
768
- </p>
769
- </foreword></preface>
770
- <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
771
- "2"><title depth='1'>1.<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
- </bibliography>
784
- </iso-standard>
945
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
946
+ <preface><foreword displayorder="1">
947
+ <p>
948
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
949
+ <eref type="inline" bibitemid="ISO712">ISO 712</eref>
950
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
951
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
952
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
953
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
954
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
955
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
956
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
957
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
958
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
959
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
960
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
961
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
962
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
963
+ <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
964
+ <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
965
+ </p>
966
+ </foreword></preface>
967
+ <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
968
+ "2"><title depth='1'>1.<tab/>Normative References</title>
969
+ <bibitem id="ISO712" type="standard">
970
+ <title format="text/plain">Cereals and cereal products</title>
971
+ <docidentifier>ISO 712</docidentifier>
972
+ <contributor>
973
+ <role type="publisher"/>
974
+ <organization>
975
+ <abbreviation>ISO</abbreviation>
976
+ </organization>
977
+ </contributor>
978
+ </bibitem>
979
+ </references>
980
+ </bibliography>
981
+ </iso-standard>
785
982
  OUTPUT
786
983
 
787
984
  html = <<~OUTPUT
@@ -1104,36 +1301,36 @@ RSpec.describe IsoDoc do
1104
1301
  </iso-standard>
1105
1302
  INPUT
1106
1303
  output = <<~OUTPUT
1107
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1108
- <bibdata>
1109
- <language current='true'>en</language>
1110
- <script current='true'>Latn</script>
1111
- </bibdata>
1112
- <preface>
1113
- <clause id='A' displayorder='1'>
1114
- <title depth='1'>ABC</title>
1115
- </clause>
1116
- <clause id='A1' displayorder='2'>
1117
- <title depth='1'>ABC/DEF</title>
1118
- </clause>
1119
- <clause id='A2' displayorder='3'>
1120
- <title depth='1'>ABC</title>
1121
- </clause>
1122
- <clause id='B' displayorder='4'>
1123
- <title depth='1'>GHI/JKL</title>
1124
- </clause>
1125
- <clause id='C' displayorder='5'>
1126
- <title depth='1'>DEF</title>
1127
- </clause>
1128
- <clause id='C1' displayorder='6'>
1129
- <title depth='1'>ABC/DEF</title>
1130
- </clause>
1131
- <clause id='C2' displayorder='7'>
1132
- <title depth='1'>DEF</title>
1133
- </clause>
1134
- <p displayorder='8'>A B D E</p>
1135
- </preface>
1136
- </iso-standard>
1304
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1305
+ <bibdata>
1306
+ <language current='true'>en</language>
1307
+ <script current='true'>Latn</script>
1308
+ </bibdata>
1309
+ <preface>
1310
+ <clause id='A' displayorder='1'>
1311
+ <title depth='1'>ABC</title>
1312
+ </clause>
1313
+ <clause id='A1' displayorder='2'>
1314
+ <title depth='1'>ABC/DEF</title>
1315
+ </clause>
1316
+ <clause id='A2' displayorder='3'>
1317
+ <title depth='1'>ABC</title>
1318
+ </clause>
1319
+ <clause id='B' displayorder='4'>
1320
+ <title depth='1'>GHI/JKL</title>
1321
+ </clause>
1322
+ <clause id='C' displayorder='5'>
1323
+ <title depth='1'>DEF</title>
1324
+ </clause>
1325
+ <clause id='C1' displayorder='6'>
1326
+ <title depth='1'>ABC/DEF</title>
1327
+ </clause>
1328
+ <clause id='C2' displayorder='7'>
1329
+ <title depth='1'>DEF</title>
1330
+ </clause>
1331
+ <p displayorder='8'>A B D E</p>
1332
+ </preface>
1333
+ </iso-standard>
1137
1334
  OUTPUT
1138
1335
  expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1139
1336
  .convert("test", input, true)