metanorma-standoc 1.9.3 → 1.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -13
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -6
  5. data/lib/asciidoctor/standoc/base.rb +3 -1
  6. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  7. data/lib/asciidoctor/standoc/cleanup.rb +1 -2
  8. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  9. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
  10. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +117 -77
  12. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  13. data/lib/asciidoctor/standoc/cleanup_ref.rb +7 -0
  14. data/lib/asciidoctor/standoc/cleanup_section.rb +13 -81
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +75 -0
  16. data/lib/asciidoctor/standoc/cleanup_terms.rb +19 -18
  17. data/lib/asciidoctor/standoc/converter.rb +1 -0
  18. data/lib/asciidoctor/standoc/front.rb +0 -1
  19. data/lib/asciidoctor/standoc/front_contributor.rb +66 -42
  20. data/lib/asciidoctor/standoc/inline.rb +45 -34
  21. data/lib/asciidoctor/standoc/isodoc.rng +65 -7
  22. data/lib/asciidoctor/standoc/macros.rb +7 -5
  23. data/lib/asciidoctor/standoc/macros_plantuml.rb +21 -23
  24. data/lib/asciidoctor/standoc/macros_terms.rb +60 -23
  25. data/lib/asciidoctor/standoc/section.rb +19 -12
  26. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +69 -30
  27. data/lib/asciidoctor/standoc/terms.rb +1 -1
  28. data/lib/asciidoctor/standoc/utils.rb +0 -1
  29. data/lib/asciidoctor/standoc/validate.rb +22 -8
  30. data/lib/isodoc/html/html_titlepage.html +81 -0
  31. data/lib/isodoc/html/htmlstyle.css +983 -0
  32. data/lib/isodoc/html/htmlstyle.scss +714 -0
  33. data/lib/isodoc/html/scripts.html +71 -0
  34. data/lib/metanorma/standoc/processor.rb +16 -7
  35. data/lib/metanorma/standoc/version.rb +1 -1
  36. data/metanorma-standoc.gemspec +2 -2
  37. data/spec/asciidoctor/base_spec.rb +693 -553
  38. data/spec/asciidoctor/blocks_spec.rb +6 -6
  39. data/spec/asciidoctor/cleanup_spec.rb +899 -688
  40. data/spec/asciidoctor/inline_spec.rb +62 -14
  41. data/spec/asciidoctor/isobib_cache_spec.rb +4 -6
  42. data/spec/asciidoctor/lists_spec.rb +147 -135
  43. data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
  44. data/spec/asciidoctor/macros_spec.rb +714 -168
  45. data/spec/asciidoctor/refs_spec.rb +1527 -1532
  46. data/spec/asciidoctor/validate_spec.rb +352 -304
  47. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
  48. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  49. data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
  50. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +36 -36
  51. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  52. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  53. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  54. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  55. metadata +10 -5
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- RSpec.describe 'Json2Text macros' do
3
+ RSpec.describe "Json2Text macros" do
4
4
  it_behaves_like "structured data 2 text preprocessor" do
5
5
  let(:extention) { "json" }
6
6
  def transform_to_type(data)
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe Asciidoctor::Standoc do
4
4
  it "processes the Asciidoctor::Standoc inline macros" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
  alt:[term1]
8
8
  deprecated:[term1]
@@ -15,6 +15,7 @@ RSpec.describe Asciidoctor::Standoc do
15
15
  == Bibliography
16
16
  * [[[ref1,XYZ 123]]] _Title_
17
17
  INPUT
18
+ output = <<~OUTPUT
18
19
  #{BLANK_HDR}
19
20
  <preface>
20
21
  <foreword id='_' obligation='informative'>
@@ -48,10 +49,12 @@ RSpec.describe Asciidoctor::Standoc do
48
49
  </bibliography>
49
50
  </standard-document>
50
51
  OUTPUT
52
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
53
+ .to be_equivalent_to xmlpp(output)
51
54
  end
52
55
 
53
56
  it "processes the Asciidoctor::Standoc index macros" do
54
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
57
+ input = <<~INPUT
55
58
  #{ASCIIDOC_BLANK_HDR}
56
59
  index:also[]
57
60
  index:see[A]
@@ -67,6 +70,7 @@ RSpec.describe Asciidoctor::Standoc do
67
70
 
68
71
  Text [[id3]]
69
72
  INPUT
73
+ output = <<~OUTPUT
70
74
  #{BLANK_HDR}
71
75
  <sections>
72
76
  <p id='_'>
@@ -117,16 +121,19 @@ RSpec.describe Asciidoctor::Standoc do
117
121
  </sections>
118
122
  </standard-document>
119
123
  OUTPUT
124
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
125
+ .to be_equivalent_to xmlpp(output)
120
126
  end
121
127
 
122
128
  it "processes the Asciidoctor::Standoc variant macros" do
123
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
129
+ input = <<~INPUT
124
130
  #{ASCIIDOC_BLANK_HDR}
125
131
  == lang:en[English] lang:fr-Latn[Français]
126
132
 
127
133
  this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
128
134
 
129
135
  INPUT
136
+ output = <<~OUTPUT
130
137
  #{BLANK_HDR}
131
138
  <sections>
132
139
  <clause id='_' inline-header='false' obligation='normative'>
@@ -150,134 +157,142 @@ RSpec.describe Asciidoctor::Standoc do
150
157
  </sections>
151
158
  </standard-document>
152
159
  OUTPUT
160
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
161
+ .to be_equivalent_to xmlpp(output)
153
162
  end
154
163
 
155
164
  it "processes the Asciidoctor::Standoc concept macros" do
156
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
165
+ input = <<~INPUT
157
166
  #{ASCIIDOC_BLANK_HDR}
158
167
  {{clause1}}
168
+ term:[clause1]
159
169
  {{clause1,w\[o\]rd}}
170
+ term:[clause1,w[o&#93;rd]
160
171
  {{clause1,w\[o\]rd,term}}
161
172
  {{blah}}
173
+ term:[blah]
162
174
  {{blah,word}}
163
- {{blah,word,term}}
164
- {{blah,clause=3.1}}
165
- {{blah,clause=3.1,word}}
166
- {{blah,clause=3.1,word,term}}
167
- {{blah,clause=3.1,figure=a}}
168
- {{blah,clause=3.1,figure=a,word}}
169
- {{blah,clause=3.1,figure=a,word,term}}
170
- {{IEV:135-13-13}}
171
- {{IEV:135-13-13,word}}
172
- {{IEV:135-13-13,word,term}}
175
+ term:[blah,word]
176
+ {{blah,term,word}}
177
+ {{blah,term,word,xref}}
178
+ {{blah,term,word,xref,option="noital,noref"}}
173
179
 
174
180
  [[clause1]]
175
181
  == Clause
176
182
  Terms are defined here
177
-
178
- [bibliography]
179
- == Bibliography
180
- * [[[blah,blah]]] _Blah_
181
183
  INPUT
184
+ output = <<~OUTPUT
182
185
  #{BLANK_HDR}
183
186
  <preface>
184
187
  <foreword id='_' obligation='informative'>
185
188
  <title>Foreword</title>
186
189
  <p id='_'>
187
- <concept>
188
- <xref target='clause1'/>
189
- </concept>
190
- <concept>
191
- <xref target='clause1'>w[o]rd</xref>
192
- </concept>
193
- <concept term='term'>
194
- <xref target='clause1'>w[o]rd</xref>
195
- </concept>
196
- <concept>
197
- <eref/>
198
- </concept>
199
- <concept>
200
- <eref>word</eref>
201
- </concept>
202
- <concept term='term'>
203
- <eref>word</eref>
204
- </concept>
205
- <concept>
206
- <eref>
207
- <localityStack>
208
- <locality type='clause'>
209
- <referenceFrom>3.1</referenceFrom>
210
- </locality>
211
- </localityStack>
212
- </eref>
213
- </concept>
214
- <concept>
215
- <eref>
216
- <localityStack>
217
- <locality type='clause'>
218
- <referenceFrom>3.1</referenceFrom>
219
- </locality>
220
- </localityStack>
221
- word
222
- </eref>
223
- </concept>
224
- <concept term='term'>
225
- <eref>
226
- <localityStack>
227
- <locality type='clause'>
228
- <referenceFrom>3.1</referenceFrom>
229
- </locality>
230
- </localityStack>
231
- word
232
- </eref>
233
- </concept>
234
- <concept>
235
- <eref>
236
- <localityStack>
237
- <locality type='clause'>
238
- <referenceFrom>3.1</referenceFrom>
239
- </locality>
240
- <locality type='figure'>
241
- <referenceFrom>a</referenceFrom>
242
- </locality>
243
- </localityStack>
244
- </eref>
245
- </concept>
246
- <concept>
247
- <eref>
248
- <localityStack>
249
- <locality type='clause'>
250
- <referenceFrom>3.1</referenceFrom>
251
- </locality>
252
- <locality type='figure'>
253
- <referenceFrom>a</referenceFrom>
254
- </locality>
255
- </localityStack>
256
- word
257
- </eref>
258
- </concept>
259
- <concept term='term'>
260
- <eref>
261
- <localityStack>
262
- <locality type='clause'>
263
- <referenceFrom>3.1</referenceFrom>
264
- </locality>
265
- <locality type='figure'>
266
- <referenceFrom>a</referenceFrom>
267
- </locality>
268
- </localityStack>
269
- word
270
- </eref>
271
- </concept>
272
- <concept>
273
- <termref base='IEV' target='135-13-13'/>
274
- </concept>
275
- <concept>
276
- <termref base='IEV' target='135-13-13'>word</termref>
277
- </concept>
278
- <concept term='term'>
279
- <termref base='IEV' target='135-13-13'>word</termref>
280
- </concept>
190
+ <concept>
191
+ <strong>
192
+ term
193
+ <tt>clause1</tt>
194
+ not resolved via ID
195
+ <tt>clause1</tt>
196
+ </strong>
197
+ </concept>
198
+ <concept>
199
+ <strong>
200
+ term
201
+ <tt>clause1</tt>
202
+ not resolved via ID
203
+ <tt>clause1</tt>
204
+ </strong>
205
+ </concept>
206
+ <concept>
207
+ <strong>
208
+ term
209
+ <tt>clause1</tt>, display <tt>w[o]rd</tt>
210
+ not resolved via ID
211
+ <tt>clause1</tt>
212
+ </strong>
213
+ </concept>
214
+ <concept>
215
+ <strong>
216
+ term
217
+ <tt>clause1</tt>, display <tt>w[o]rd</tt>
218
+ not resolved via ID
219
+ <tt>clause1</tt>
220
+ </strong>
221
+ </concept>
222
+ <concept>
223
+ <strong>
224
+ term
225
+ <tt>clause1</tt>, display <tt>w[o]rd</tt>
226
+ not resolved via ID
227
+ <tt>clause1</tt>
228
+ </strong>
229
+ </concept>
230
+ <concept>
231
+ <strong>
232
+ term
233
+ <tt>blah</tt>
234
+ not resolved via ID
235
+ <tt>blah</tt>
236
+ </strong>
237
+ </concept>
238
+ <concept>
239
+ <strong>
240
+ term
241
+ <tt>blah</tt>
242
+ not resolved via ID
243
+ <tt>blah</tt>
244
+ </strong>
245
+ </concept>
246
+ <concept>
247
+ <strong>
248
+ term
249
+ <tt>blah</tt>
250
+ , display
251
+ <tt>word</tt>
252
+ not resolved via ID
253
+ <tt>blah</tt>
254
+ </strong>
255
+ </concept>
256
+ <concept>
257
+ <strong>
258
+ term
259
+ <tt>blah</tt>
260
+ , display
261
+ <tt>word</tt>
262
+ not resolved via ID
263
+ <tt>blah</tt>
264
+ </strong>
265
+ </concept>
266
+ <concept>
267
+ <strong>
268
+ term
269
+ <tt>blah</tt>
270
+ , display
271
+ <tt>term</tt>
272
+ not resolved via ID
273
+ <tt>blah</tt>
274
+ </strong>
275
+ </concept>
276
+ <concept>
277
+ <strong>
278
+ term
279
+ <tt>blah</tt>
280
+ , display
281
+ <tt>term</tt>
282
+ not resolved via ID
283
+ <tt>blah</tt>
284
+ </strong>
285
+ </concept>
286
+ <concept ital='false' ref='false'>
287
+ <strong>
288
+ term
289
+ <tt>blah</tt>
290
+ , display
291
+ <tt>term</tt>
292
+ not resolved via ID
293
+ <tt>blah</tt>
294
+ </strong>
295
+ </concept>
281
296
  </p>
282
297
  </foreword>
283
298
  </preface>
@@ -287,23 +302,438 @@ RSpec.describe Asciidoctor::Standoc do
287
302
  <p id='_'>Terms are defined here</p>
288
303
  </clause>
289
304
  </sections>
290
- <bibliography>
291
- <references id='_' obligation='informative' normative="false">
292
- <title>Bibliography</title>
293
- <bibitem id='blah'>
294
- <formattedref format='application/x-isodoc+xml'>
295
- <em>Blah</em>
296
- </formattedref>
297
- <docidentifier>blah</docidentifier>
298
- </bibitem>
299
- </references>
300
- </bibliography>
301
305
  </standard-document>
302
306
  OUTPUT
307
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
308
+ .to be_equivalent_to xmlpp(output)
309
+ end
310
+
311
+ it "processes the Asciidoctor::Standoc concept macros for acronyms" do
312
+ input = <<~INPUT
313
+ #{ASCIIDOC_BLANK_HDR}
314
+ {{Clause1}}
315
+ {{Clause1,Clause 1}}
316
+ {{Clause 2}}
317
+ {{Clause 2,Clause 1}}
318
+ {{<<Clause2>>,Clause 2}}
319
+ symbol:[Clause1]
320
+ symbol:[Clause1,word]
321
+ symbol:[Clause 2]
322
+ symbol:[Clause 2,word]
323
+ {{<<Clause2>>,word}}
324
+ {{<<Clause2>>,word,term}}
325
+ {{<<Clause2>>,word,term,xref}}
326
+ {{<<Clause2>>,word,term,xref,option="noital,noref"}}
327
+ {{<<Clause2>>,word,term,xref,option="ital,ref"}}
328
+
329
+ == Terms and definitions
330
+ === Clause1
331
+ == Symbols and Abbreviated Terms
332
+ Clause1:: A
333
+ [[Clause2]]Clause 2:: C
334
+ INPUT
335
+ output = <<~OUTPUT
336
+ #{BLANK_HDR}
337
+ <preface>
338
+ <foreword id='_' obligation='informative'>
339
+ <title>Foreword</title>
340
+ <p id='_'>
341
+ <concept>
342
+ <refterm>Clause1</refterm>
343
+ <renderterm>Clause1</renderterm>
344
+ <xref target='term-clause1'/>
345
+ </concept>
346
+ <concept>
347
+ <refterm>Clause1</refterm>
348
+ <renderterm>Clause 1</renderterm>
349
+ <xref target='term-clause1'/>
350
+ </concept>
351
+ <concept>
352
+ <refterm>Clause 2</refterm>
353
+ <renderterm>Clause 2</renderterm>
354
+ <xref target='Clause2'/>
355
+ </concept>
356
+ <concept>
357
+ <refterm>Clause 2</refterm>
358
+ <renderterm>Clause 1</renderterm>
359
+ <xref target='Clause2'/>
360
+ </concept>
361
+ <concept>
362
+ <refterm>Clause 2</refterm>
363
+ <renderterm>Clause 2</renderterm>
364
+ <xref target='Clause2'/>
365
+ </concept>
366
+ <concept>
367
+ <refterm>Clause1</refterm>
368
+ <renderterm>Clause1</renderterm>
369
+ <xref target='symbol-clause1'/>
370
+ </concept>
371
+ <concept>
372
+ <refterm>Clause1</refterm>
373
+ <renderterm>word</renderterm>
374
+ <xref target='symbol-clause1'/>
375
+ </concept>
376
+ <concept>
377
+ <refterm>Clause 2</refterm>
378
+ <renderterm>Clause 2</renderterm>
379
+ <xref target='Clause2'/>
380
+ </concept>
381
+ <concept>
382
+ <refterm>Clause 2</refterm>
383
+ <renderterm>word</renderterm>
384
+ <xref target='Clause2'/>
385
+ </concept>
386
+ <concept>
387
+ <refterm>word</refterm>
388
+ <renderterm>word</renderterm>
389
+ <xref target='Clause2'/>
390
+ </concept>
391
+ <concept>
392
+ <refterm>word</refterm>
393
+ <renderterm>term</renderterm>
394
+ <xref target='Clause2'/>
395
+ </concept>
396
+ <concept>
397
+ <refterm>word</refterm>
398
+ <renderterm>term</renderterm>
399
+ <xref target='Clause2'>xref</xref>
400
+ </concept>
401
+ <concept ital='false' ref='false'>
402
+ <refterm>word</refterm>
403
+ <renderterm>term</renderterm>
404
+ <xref target='Clause2'>xref</xref>
405
+ </concept>
406
+ <concept ital='true' ref='true'>
407
+ <refterm>word</refterm>
408
+ <renderterm>term</renderterm>
409
+ <xref target='Clause2'>xref</xref>
410
+ </concept>
411
+ </p>
412
+ </foreword>
413
+ </preface>
414
+ <sections>
415
+ <terms id='_' obligation='normative'>
416
+ <title>Terms and definitions</title>
417
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
418
+ <term id='term-clause1'>
419
+ <preferred>Clause1</preferred>
420
+ </term>
421
+ </terms>
422
+ <definitions id='_' obligation='normative'>
423
+ <title>Symbols and abbreviated terms</title>
424
+ <dl id='_'>
425
+ <dt id="symbol-clause1">Clause1</dt>
426
+ <dd>
427
+ <p id='_'>A</p>
428
+ </dd>
429
+ <dt id='Clause2'>Clause 2</dt>
430
+ <dd>
431
+ <p id='_'>C</p>
432
+ </dd>
433
+ </dl>
434
+ </definitions>
435
+ </sections>
436
+ </standard-document>
437
+ OUTPUT
438
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
439
+ .to be_equivalent_to xmlpp(output)
440
+ end
441
+
442
+ it "processes the concept macros with xrefs" do
443
+ input = <<~INPUT
444
+ #{ASCIIDOC_BLANK_HDR}
445
+ {{<<clause1>>}}
446
+ {{<<clause1>>,w\[o\]rd}}
447
+ {{<<clause1>>,term,w\[o\]rd}}
448
+ {{<<clause1>>,term,w\[o\]rd,Clause #1}}
449
+
450
+ [[clause1]]
451
+ == Clause
452
+ Terms are defined here
453
+ INPUT
454
+ output = <<~OUTPUT
455
+ #{BLANK_HDR}
456
+ <preface>
457
+ <foreword id='_' obligation='informative'>
458
+ <title>Foreword</title>
459
+ <p id='_'>
460
+ <concept>
461
+ <xref target='clause1'/>
462
+ </concept>
463
+ <concept>
464
+ <refterm>w[o]rd</refterm>
465
+ <renderterm>w[o]rd</renderterm>
466
+ <xref target='clause1'/>
467
+ </concept>
468
+ <concept>
469
+ <refterm>term</refterm>
470
+ <renderterm>w[o]rd</renderterm>
471
+ <xref target='clause1'/>
472
+ </concept>
473
+ <concept>
474
+ <refterm>term</refterm>
475
+ <renderterm>w[o]rd</renderterm>
476
+ <xref target='clause1'>Clause #1</xref>
477
+ </concept>
478
+ </p>
479
+ </foreword>
480
+ </preface>
481
+ <sections>
482
+ <clause id='clause1' inline-header='false' obligation='normative'>
483
+ <title>Clause</title>
484
+ <p id='_'>Terms are defined here</p>
485
+ </clause>
486
+ </sections>
487
+ </standard-document>
488
+ OUTPUT
489
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
490
+ .to be_equivalent_to xmlpp(output)
491
+ end
492
+
493
+ it "processes the concept macros with erefs" do
494
+ input = <<~INPUT
495
+ #{ASCIIDOC_BLANK_HDR}
496
+ {{<<blah>>}}
497
+ {{<<blah>>,word}}
498
+ {{<<blah>>,term,word}}
499
+ {{<<blah>>,term,word,Clause #1}}
500
+ {{<<blah,clause=3.1>>}}
501
+ {{<<blah,clause=3.1>>,word}}
502
+ {{<<blah,clause=3.1>>,term,word}}
503
+ {{<<blah,clause=3.1,figure=a>>}}
504
+ {{<<blah,clause=3.1,figure=a>>,word}}
505
+ {{<<blah,clause=3.1,figure=a>>,term,word,Clause #1}}
506
+
507
+ [bibliography]
508
+ == Bibliography
509
+ * [[[blah,blah]]] _Blah_
510
+ INPUT
511
+ output = <<~OUTPUT
512
+ #{BLANK_HDR}
513
+ <preface>
514
+ <foreword id='_' obligation='informative'>
515
+ <title>Foreword</title>
516
+ <p id='_'>
517
+ <concept>
518
+ <eref bibitemid='blah'/>
519
+ </concept>
520
+ <concept>
521
+ <refterm>word</refterm>
522
+ <renderterm>word</renderterm>
523
+ <eref bibitemid='blah'/>
524
+ </concept>
525
+ <concept>
526
+ <refterm>term</refterm>
527
+ <renderterm>word</renderterm>
528
+ <eref bibitemid='blah'/>
529
+ </concept>
530
+ <concept>
531
+ <refterm>term</refterm>
532
+ <renderterm>word</renderterm>
533
+ <eref bibitemid='blah'>Clause #1</eref>
534
+ </concept>
535
+ <concept>
536
+ <eref bibitemid='blah'>
537
+ <localityStack>
538
+ <locality type='clause'>
539
+ <referenceFrom>3.1</referenceFrom>
540
+ </locality>
541
+ </localityStack>
542
+ </eref>
543
+ </concept>
544
+ <concept>
545
+ <refterm>word</refterm>
546
+ <renderterm>word</renderterm>
547
+ <eref bibitemid='blah'>
548
+ <localityStack>
549
+ <locality type='clause'>
550
+ <referenceFrom>3.1</referenceFrom>
551
+ </locality>
552
+ </localityStack>
553
+ </eref>
554
+ </concept>
555
+ <concept>
556
+ <refterm>term</refterm>
557
+ <renderterm>word</renderterm>
558
+ <eref bibitemid='blah'>
559
+ <localityStack>
560
+ <locality type='clause'>
561
+ <referenceFrom>3.1</referenceFrom>
562
+ </locality>
563
+ </localityStack>
564
+ </eref>
565
+ </concept>
566
+ <concept>
567
+ <eref bibitemid='blah'>
568
+ <localityStack>
569
+ <locality type='clause'>
570
+ <referenceFrom>3.1</referenceFrom>
571
+ </locality>
572
+ <locality type='figure'>
573
+ <referenceFrom>a</referenceFrom>
574
+ </locality>
575
+ </localityStack>
576
+ </eref>
577
+ </concept>
578
+ <concept>
579
+ <refterm>word</refterm>
580
+ <renderterm>word</renderterm>
581
+ <eref bibitemid='blah'>
582
+ <localityStack>
583
+ <locality type='clause'>
584
+ <referenceFrom>3.1</referenceFrom>
585
+ </locality>
586
+ <locality type='figure'>
587
+ <referenceFrom>a</referenceFrom>
588
+ </locality>
589
+ </localityStack>
590
+ </eref>
591
+ </concept>
592
+ <concept>
593
+ <refterm>term</refterm>
594
+ <renderterm>word</renderterm>
595
+ <eref bibitemid='blah'>
596
+ <localityStack>
597
+ <locality type='clause'>
598
+ <referenceFrom>3.1</referenceFrom>
599
+ </locality>
600
+ <locality type='figure'>
601
+ <referenceFrom>a</referenceFrom>
602
+ </locality>
603
+ </localityStack>
604
+ Clause #1
605
+ </eref>
606
+ </concept>
607
+ </p>
608
+ </foreword>
609
+ </preface>
610
+ <sections> </sections>
611
+ <bibliography>
612
+ <references id='_' normative='false' obligation='informative'>
613
+ <title>Bibliography</title>
614
+ <bibitem id='blah'>
615
+ <formattedref format='application/x-isodoc+xml'>
616
+ <em>Blah</em>
617
+ </formattedref>
618
+ <docidentifier>blah</docidentifier>
619
+ </bibitem>
620
+ </references>
621
+ </bibliography>
622
+ </standard-document>
623
+ OUTPUT
624
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
625
+ .to be_equivalent_to xmlpp(output)
626
+ end
627
+
628
+ it "processes the concept macros with termbase" do
629
+ input = <<~INPUT
630
+ #{ASCIIDOC_BLANK_HDR}
631
+ {{<<IEV:135-13-13>>}}
632
+ {{<<IEV:135-13-13>>,word}}
633
+ {{<<IEV:135-13-13>>,term,word}}
634
+ {{<<IEV:135-13-13>>,term,word,Clause #1}}
635
+ INPUT
636
+ output = <<~OUTPUT
637
+ #{BLANK_HDR}
638
+ <sections>
639
+ <p id='_'>
640
+ <concept>
641
+ <termref base='IEV' target='135-13-13'/>
642
+ </concept>
643
+ <concept>
644
+ <refterm>word</refterm>
645
+ <renderterm>word</renderterm>
646
+ <termref base='IEV' target='135-13-13'/>
647
+ </concept>
648
+ <concept>
649
+ <refterm>term</refterm>
650
+ <renderterm>word</renderterm>
651
+ <termref base='IEV' target='135-13-13'/>
652
+ </concept>
653
+ <concept>
654
+ <refterm>term</refterm>
655
+ <renderterm>word</renderterm>
656
+ <termref base='IEV' target='135-13-13'>Clause #1</termref>
657
+ </concept>
658
+ </p>
659
+ </sections>
660
+ </standard-document>
661
+ OUTPUT
662
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
663
+ .to be_equivalent_to xmlpp(output)
664
+ end
665
+
666
+ it "processes the concept macros with disambiguation for math symbols" do
667
+ input = <<~INPUT
668
+ #{ASCIIDOC_BLANK_HDR}
669
+ [[clause1]]
670
+
671
+ == Symbols and Abbreviated Terms
672
+ stem:[|~ x ~|]:: A function that returns the smallest integer greater than or equal to stem:[x]; also known as the _ceiling_ function.
673
+ stem:[|__ x __|]:: A function that returns the largest integer less than or equal to stem:[x]; also known as the _floor_ function.
674
+ INPUT
675
+ output = <<~OUTPUT
676
+ #{BLANK_HDR}
677
+ <sections>
678
+ <definitions id='clause1' obligation='normative'>
679
+ <title>Symbols and abbreviated terms</title>
680
+ <dl id='_'>
681
+ <dt id='symbol-_-_x_-'>
682
+ <stem type='MathML'>
683
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
684
+ <mo>&#8970;</mo>
685
+ <mi>x</mi>
686
+ <mo>&#8971;</mo>
687
+ </math>
688
+ </stem>
689
+ </dt>
690
+ <dd>
691
+ <p id='_'>
692
+ A function that returns the largest integer less than or equal to
693
+ <stem type='MathML'>
694
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
695
+ <mi>x</mi>
696
+ </math>
697
+ </stem>
698
+ ; also known as the
699
+ <em>floor</em>
700
+ function.
701
+ </p>
702
+ </dd>
703
+ <dt id='symbol-_-_x_--1'>
704
+ <stem type='MathML'>
705
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
706
+ <mo>&#8968;</mo>
707
+ <mi>x</mi>
708
+ <mo>&#8969;</mo>
709
+ </math>
710
+ </stem>
711
+ </dt>
712
+ <dd>
713
+ <p id='_'>
714
+ A function that returns the smallest integer greater than or equal
715
+ to
716
+ <stem type='MathML'>
717
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
718
+ <mi>x</mi>
719
+ </math>
720
+ </stem>
721
+ ; also known as the
722
+ <em>ceiling</em>
723
+ function.
724
+ </p>
725
+ </dd>
726
+ </dl>
727
+ </definitions>
728
+ </sections>
729
+ </standard-document>
730
+ OUTPUT
731
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
732
+ .to be_equivalent_to xmlpp(output)
303
733
  end
304
734
 
305
735
  it "processes the TODO custom admonition" do
306
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
736
+ input = <<~INPUT
307
737
  #{ASCIIDOC_BLANK_HDR}
308
738
  TODO: Note1
309
739
 
@@ -315,6 +745,7 @@ RSpec.describe Asciidoctor::Standoc do
315
745
  [TODO]
316
746
  Note3
317
747
  INPUT
748
+ output = <<~OUTPUT
318
749
  #{BLANK_HDR}
319
750
  <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
320
751
  <p id="_"/>
@@ -327,10 +758,12 @@ RSpec.describe Asciidoctor::Standoc do
327
758
  </review></sections>
328
759
  </standard-document>
329
760
  OUTPUT
761
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
762
+ .to be_equivalent_to xmlpp(output)
330
763
  end
331
764
 
332
765
  it "generates pseudocode examples, with formatting and initial indentation" do
333
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
766
+ input = <<~INPUT
334
767
  #{ASCIIDOC_BLANK_HDR}
335
768
 
336
769
  [pseudocode,subsequence="A",number="3",keep-with-next=true,keep-lines-together=true]
@@ -342,6 +775,7 @@ RSpec.describe Asciidoctor::Standoc do
342
775
  _C_
343
776
  ====
344
777
  INPUT
778
+ output = <<~OUTPUT
345
779
  #{BLANK_HDR}
346
780
  <sections>
347
781
  <figure id="_" subsequence='A' class="pseudocode" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true">
@@ -351,10 +785,12 @@ RSpec.describe Asciidoctor::Standoc do
351
785
  </sections>
352
786
  </standard-document>
353
787
  OUTPUT
788
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
789
+ .to be_equivalent_to xmlpp(output)
354
790
  end
355
791
 
356
792
  it "supplies line breaks in pseudocode" do
357
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
793
+ input = <<~INPUT
358
794
  #{ASCIIDOC_BLANK_HDR}
359
795
 
360
796
  [pseudocode]
@@ -366,6 +802,7 @@ RSpec.describe Asciidoctor::Standoc do
366
802
  E
367
803
  ====
368
804
  INPUT
805
+ output = <<~OUTPUT
369
806
  #{BLANK_HDR}
370
807
  <sections>
371
808
  <figure id='_' class='pseudocode'>
@@ -383,10 +820,12 @@ RSpec.describe Asciidoctor::Standoc do
383
820
  </sections>
384
821
  </standard-document>
385
822
  OUTPUT
823
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
824
+ .to be_equivalent_to xmlpp(output)
386
825
  end
387
826
 
388
827
  it "skips embedded blocks when supplying line breaks in pseudocode" do
389
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
828
+ input = <<~INPUT
390
829
  #{ASCIIDOC_BLANK_HDR}
391
830
 
392
831
  [pseudocode]
@@ -397,6 +836,7 @@ RSpec.describe Asciidoctor::Standoc do
397
836
  ++++
398
837
  ====
399
838
  INPUT
839
+ output = <<~OUTPUT
400
840
  #{BLANK_HDR}
401
841
  <sections>
402
842
  <figure id='_' class='pseudocode'>
@@ -449,14 +889,17 @@ RSpec.describe Asciidoctor::Standoc do
449
889
  </sections>
450
890
  </standard-document>
451
891
  OUTPUT
892
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
893
+ .to be_equivalent_to xmlpp(output)
452
894
  end
453
895
 
454
896
  it "processes the Ruby markups" do
455
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
897
+ input = <<~INPUT
456
898
  #{ASCIIDOC_BLANK_HDR}
457
899
 
458
900
  ruby:楽聖少女[がくせいしょうじょ]
459
901
  INPUT
902
+ output = <<~OUTPUT
460
903
  #{BLANK_HDR}
461
904
  <sections>
462
905
  <p id="_">
@@ -465,10 +908,12 @@ RSpec.describe Asciidoctor::Standoc do
465
908
  </sections>
466
909
  </standard-document>
467
910
  OUTPUT
911
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
912
+ .to be_equivalent_to xmlpp(output)
468
913
  end
469
914
 
470
915
  it "processes the footnoteblock macro" do
471
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
916
+ input = <<~INPUT
472
917
  #{ASCIIDOC_BLANK_HDR}
473
918
 
474
919
  footnoteblock:[id1]
@@ -487,6 +932,7 @@ RSpec.describe Asciidoctor::Standoc do
487
932
  * C
488
933
  --
489
934
  INPUT
935
+ output = <<~OUTPUT
490
936
  #{BLANK_HDR}
491
937
  <sections>
492
938
  <p id="_">
@@ -521,10 +967,12 @@ RSpec.describe Asciidoctor::Standoc do
521
967
  </sections>
522
968
  </standard-document>
523
969
  OUTPUT
970
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
971
+ .to be_equivalent_to xmlpp(output)
524
972
  end
525
973
 
526
974
  it "processes the footnoteblock macro with failed reference" do
527
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
975
+ input = <<~INPUT
528
976
  #{ASCIIDOC_BLANK_HDR}
529
977
 
530
978
  footnoteblock:[id1]
@@ -543,6 +991,7 @@ RSpec.describe Asciidoctor::Standoc do
543
991
  * C
544
992
  --
545
993
  INPUT
994
+ output = <<~OUTPUT
546
995
  #{BLANK_HDR}
547
996
  <sections>
548
997
  <p id='_'>
@@ -578,13 +1027,15 @@ RSpec.describe Asciidoctor::Standoc do
578
1027
  </sections>
579
1028
  </standard-document>
580
1029
  OUTPUT
1030
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1031
+ .to be_equivalent_to xmlpp(output)
581
1032
  end
582
1033
 
583
1034
  it "processes input form macros" do
584
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1035
+ input = <<~INPUT
585
1036
  #{ASCIIDOC_BLANK_HDR}
586
1037
 
587
- [form,id=N0,name=N1,action="/action_page.php"]
1038
+ [form,id=N0,name=N1,action="/action_page.php",class="checkboxes"]
588
1039
  --
589
1040
  label:fname[First name:] +
590
1041
  input:text[id=fname,name=fname] +
@@ -619,9 +1070,10 @@ RSpec.describe Asciidoctor::Standoc do
619
1070
  input:submit[value="Submit"]
620
1071
  --
621
1072
  INPUT
1073
+ output = <<~OUTPUT
622
1074
  #{BLANK_HDR}
623
1075
  <sections>
624
- <form id='_' name='N1' action='/action_page.php'>
1076
+ <form id='_' name='N1' action='/action_page.php' class="checkboxes">
625
1077
  <p id='_'>
626
1078
  <label for='fname'>First name:</label>
627
1079
  <br/>
@@ -675,6 +1127,8 @@ RSpec.describe Asciidoctor::Standoc do
675
1127
  </sections>
676
1128
  </standard-document>
677
1129
  OUTPUT
1130
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1131
+ .to be_equivalent_to xmlpp(output)
678
1132
  end
679
1133
 
680
1134
  describe "term inline macros" do
@@ -683,8 +1137,8 @@ RSpec.describe Asciidoctor::Standoc do
683
1137
  strip_guid(
684
1138
  Asciidoctor.convert(
685
1139
  input, *OPTIONS
686
- )
687
- )
1140
+ ),
1141
+ ),
688
1142
  )
689
1143
  end
690
1144
  let(:input) do
@@ -692,11 +1146,13 @@ RSpec.describe Asciidoctor::Standoc do
692
1146
  #{ASCIIDOC_BLANK_HDR}
693
1147
  == Terms and Definitions
694
1148
 
695
- === name2
1149
+ === name
696
1150
 
697
1151
  == Main
698
1152
 
699
1153
  term:[name,name2] is a term
1154
+
1155
+ {{name,name2}} is a term
700
1156
  XML
701
1157
  end
702
1158
  let(:output) do
@@ -706,17 +1162,27 @@ RSpec.describe Asciidoctor::Standoc do
706
1162
  <terms id='_' obligation='normative'>
707
1163
  <title>Terms and definitions</title>
708
1164
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
709
- <term id='term-name2'>
710
- <preferred>name2</preferred>
1165
+ <term id='term-name'>
1166
+ <preferred>name</preferred>
711
1167
  </term>
712
1168
  </terms>
713
1169
  <clause id='_' inline-header='false' obligation='normative'>
714
1170
  <title>Main</title>
715
1171
  <p id='_'>
716
- <em>name</em>
717
- (
718
- <xref target='term-name2'/>
719
- ) is a term
1172
+ <concept>
1173
+ <refterm>name</refterm>
1174
+ <renderterm>name2</renderterm>
1175
+ <xref target='term-name'/>
1176
+ </concept>
1177
+ is a term
1178
+ </p>
1179
+ <p id='_'>
1180
+ <concept>
1181
+ <refterm>name</refterm>
1182
+ <renderterm>name2</renderterm>
1183
+ <xref target='term-name'/>
1184
+ </concept>
1185
+ is a term
720
1186
  </p>
721
1187
  </clause>
722
1188
  </sections>
@@ -740,6 +1206,8 @@ RSpec.describe Asciidoctor::Standoc do
740
1206
  == Main
741
1207
 
742
1208
  term:[name] is a term
1209
+
1210
+ {{name}} is a term
743
1211
  XML
744
1212
  end
745
1213
  let(:output) do
@@ -756,10 +1224,20 @@ RSpec.describe Asciidoctor::Standoc do
756
1224
  <clause id='_' inline-header='false' obligation='normative'>
757
1225
  <title>Main</title>
758
1226
  <p id='_'>
759
- <em>name</em>
760
- (
761
- <xref target='term-name' />
762
- ) is a term
1227
+ <concept>
1228
+ <refterm>name</refterm>
1229
+ <renderterm>name</renderterm>
1230
+ <xref target='term-name'/>
1231
+ </concept>
1232
+ is a term
1233
+ </p>
1234
+ <p id='_'>
1235
+ <concept>
1236
+ <refterm>name</refterm>
1237
+ <renderterm>name</renderterm>
1238
+ <xref target='term-name'/>
1239
+ </concept>
1240
+ is a term
763
1241
  </p>
764
1242
  </clause>
765
1243
  </sections>
@@ -792,6 +1270,8 @@ RSpec.describe Asciidoctor::Standoc do
792
1270
 
793
1271
  term:[name] is a term
794
1272
  term:[name2] is a term
1273
+ {{name}} is a term
1274
+ {{name2}} is a term
795
1275
  XML
796
1276
  end
797
1277
  let(:output) do
@@ -815,14 +1295,30 @@ RSpec.describe Asciidoctor::Standoc do
815
1295
  <clause id='term-name2' inline-header='false' obligation='normative'>
816
1296
  <title>Second</title>
817
1297
  <p id='_'>
818
- <em>name</em>
819
- (
820
- <xref target='term-name-1' />
821
- ) is a term
822
- <em>name2</em>
823
- (
824
- <xref target='term-name2-1' />
825
- ) is a term
1298
+ <concept>
1299
+ <refterm>name</refterm>
1300
+ <renderterm>name</renderterm>
1301
+ <xref target='term-name-1'/>
1302
+ </concept>
1303
+ is a term
1304
+ <concept>
1305
+ <refterm>name2</refterm>
1306
+ <renderterm>name2</renderterm>
1307
+ <xref target='term-name2-1'/>
1308
+ </concept>
1309
+ is a term
1310
+ <concept>
1311
+ <refterm>name</refterm>
1312
+ <renderterm>name</renderterm>
1313
+ <xref target='term-name-1'/>
1314
+ </concept>
1315
+ is a term
1316
+ <concept>
1317
+ <refterm>name2</refterm>
1318
+ <renderterm>name2</renderterm>
1319
+ <xref target='term-name2-1'/>
1320
+ </concept>
1321
+ is a term
826
1322
  </p>
827
1323
  </clause>
828
1324
  </sections>
@@ -854,12 +1350,19 @@ RSpec.describe Asciidoctor::Standoc do
854
1350
  term:[name identity] is a term
855
1351
 
856
1352
  Moreover, term:[missing] is a term
1353
+
1354
+
1355
+ {{name check}} is a term
1356
+
1357
+ {{name identity}} is a term
1358
+
1359
+ Moreover, {{missing}} is a term
857
1360
  XML
858
1361
  end
859
1362
  let(:output) do
860
1363
  <<~XML
861
- #{BLANK_HDR}
862
- <sections>
1364
+ #{BLANK_HDR}
1365
+ <sections>
863
1366
  <terms id='_' obligation='normative'>
864
1367
  <title>Terms and definitions</title>
865
1368
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
@@ -871,18 +1374,61 @@ RSpec.describe Asciidoctor::Standoc do
871
1374
  <definition>
872
1375
  <p id='_'>paragraph</p>
873
1376
  <p id='_'>
874
- <em>name check</em>
875
- (
876
- <xref target='name-check'/>
877
- ) is a term
878
- </p>
879
- <p id='_'>
880
- <em>name identity</em>
881
- (
882
- <xref target='term-name-identity'/>
883
- ) is a term
884
- </p>
885
- <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term</p>
1377
+ <concept>
1378
+ <refterm>name check</refterm>
1379
+ <renderterm>name check</renderterm>
1380
+ <xref target='name-check'/>
1381
+ </concept>
1382
+ is a term
1383
+ </p>
1384
+ <p id='_'>
1385
+ <concept>
1386
+ <refterm>name identity</refterm>
1387
+ <renderterm>name identity</renderterm>
1388
+ <xref target='term-name-identity'/>
1389
+ </concept>
1390
+ is a term
1391
+ </p>
1392
+ <p id='_'>
1393
+ Moreover,
1394
+ <concept>
1395
+ <strong>
1396
+ term
1397
+ <tt>missing</tt>
1398
+ not resolved via ID
1399
+ <tt>missing</tt>
1400
+ </strong>
1401
+ </concept>
1402
+ is a term
1403
+ </p>
1404
+ <p id='_'>
1405
+ <concept>
1406
+ <refterm>name check</refterm>
1407
+ <renderterm>name check</renderterm>
1408
+ <xref target='name-check'/>
1409
+ </concept>
1410
+ is a term
1411
+ </p>
1412
+ <p id='_'>
1413
+ <concept>
1414
+ <refterm>name identity</refterm>
1415
+ <renderterm>name identity</renderterm>
1416
+ <xref target='term-name-identity'/>
1417
+ </concept>
1418
+ is a term
1419
+ </p>
1420
+ <p id='_'>
1421
+ Moreover,
1422
+ <concept>
1423
+ <strong>
1424
+ term
1425
+ <tt>missing</tt>
1426
+ not resolved via ID
1427
+ <tt>missing</tt>
1428
+ </strong>
1429
+ </concept>
1430
+ is a term
1431
+ </p>
886
1432
  </definition>
887
1433
  </term>
888
1434
  </terms>