metanorma-standoc 1.10.0 → 1.10.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/standoc/base.rb +0 -1
  3. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  4. data/lib/asciidoctor/standoc/cleanup.rb +62 -2
  5. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  6. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
  7. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  8. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  9. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -1
  10. data/lib/asciidoctor/standoc/converter.rb +3 -0
  11. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +22 -21
  12. data/lib/asciidoctor/standoc/front.rb +0 -1
  13. data/lib/asciidoctor/standoc/front_contributor.rb +0 -1
  14. data/lib/asciidoctor/standoc/isodoc.rng +44 -7
  15. data/lib/asciidoctor/standoc/macros.rb +25 -5
  16. data/lib/asciidoctor/standoc/macros_plantuml.rb +3 -3
  17. data/lib/asciidoctor/standoc/macros_terms.rb +34 -7
  18. data/lib/asciidoctor/standoc/ref.rb +60 -56
  19. data/lib/asciidoctor/standoc/section.rb +19 -12
  20. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +59 -18
  21. data/lib/asciidoctor/standoc/utils.rb +0 -1
  22. data/lib/asciidoctor/standoc/validate.rb +4 -3
  23. data/lib/isodoc/html/html_titlepage.html +81 -0
  24. data/lib/isodoc/html/htmlstyle.css +983 -0
  25. data/lib/isodoc/html/htmlstyle.scss +714 -0
  26. data/lib/isodoc/html/scripts.html +71 -0
  27. data/lib/metanorma/standoc/processor.rb +16 -7
  28. data/lib/metanorma/standoc/version.rb +1 -1
  29. data/metanorma-standoc.gemspec +1 -1
  30. data/spec/asciidoctor/blocks_spec.rb +2 -2
  31. data/spec/asciidoctor/cleanup_sections_spec.rb +899 -864
  32. data/spec/asciidoctor/cleanup_spec.rb +64 -14
  33. data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
  34. data/spec/asciidoctor/macros_plantuml_spec.rb +165 -104
  35. data/spec/asciidoctor/macros_spec.rb +396 -75
  36. data/spec/asciidoctor/validate_spec.rb +12 -2
  37. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +34 -34
  38. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  39. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  40. data/spec/vcr_cassettes/isobib_get_123_1.yml +23 -23
  41. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  42. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  43. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  44. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  45. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  46. metadata +8 -4
@@ -174,6 +174,8 @@ RSpec.describe Asciidoctor::Standoc do
174
174
  {{blah,word}}
175
175
  term:[blah,word]
176
176
  {{blah,term,word}}
177
+ {{blah,term,word,xref}}
178
+ {{blah,term,word,xref,option="noital,noref"}}
177
179
 
178
180
  [[clause1]]
179
181
  == Clause
@@ -271,6 +273,26 @@ RSpec.describe Asciidoctor::Standoc do
271
273
  <tt>blah</tt>
272
274
  </strong>
273
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>
274
296
  </p>
275
297
  </foreword>
276
298
  </preface>
@@ -286,6 +308,137 @@ RSpec.describe Asciidoctor::Standoc do
286
308
  .to be_equivalent_to xmlpp(output)
287
309
  end
288
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
+
289
442
  it "processes the concept macros with xrefs" do
290
443
  input = <<~INPUT
291
444
  #{ASCIIDOC_BLANK_HDR}
@@ -510,6 +663,75 @@ RSpec.describe Asciidoctor::Standoc do
510
663
  .to be_equivalent_to xmlpp(output)
511
664
  end
512
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)
733
+ end
734
+
513
735
  it "processes the TODO custom admonition" do
514
736
  input = <<~INPUT
515
737
  #{ASCIIDOC_BLANK_HDR}
@@ -813,7 +1035,7 @@ RSpec.describe Asciidoctor::Standoc do
813
1035
  input = <<~INPUT
814
1036
  #{ASCIIDOC_BLANK_HDR}
815
1037
 
816
- [form,id=N0,name=N1,action="/action_page.php"]
1038
+ [form,id=N0,name=N1,action="/action_page.php",class="checkboxes"]
817
1039
  --
818
1040
  label:fname[First name:] +
819
1041
  input:text[id=fname,name=fname] +
@@ -851,7 +1073,7 @@ RSpec.describe Asciidoctor::Standoc do
851
1073
  output = <<~OUTPUT
852
1074
  #{BLANK_HDR}
853
1075
  <sections>
854
- <form id='_' name='N1' action='/action_page.php'>
1076
+ <form id='_' name='N1' action='/action_page.php' class="checkboxes">
855
1077
  <p id='_'>
856
1078
  <label for='fname'>First name:</label>
857
1079
  <br/>
@@ -909,6 +1131,105 @@ RSpec.describe Asciidoctor::Standoc do
909
1131
  .to be_equivalent_to xmlpp(output)
910
1132
  end
911
1133
 
1134
+ it "processes ToC form macros" do
1135
+ input = <<~INPUT
1136
+ #{ASCIIDOC_BLANK_HDR}
1137
+
1138
+ [[clause1]]
1139
+ == Clause 1
1140
+
1141
+ [[clause1A]]
1142
+ === Clause 1A
1143
+
1144
+ [[clause1Aa]]
1145
+ ==== Clause 1Aa
1146
+
1147
+ [[clause1Ab]]
1148
+ ==== Clause 1Ab
1149
+
1150
+ [[clause1B]]
1151
+ === Clause 1B
1152
+
1153
+ [[clause1Ba]]
1154
+ ==== Clause 1Ba
1155
+
1156
+ [[clause2]]
1157
+ == Clause 2
1158
+
1159
+ And introducing:
1160
+ toc:["//clause[@id = 'clause1'\\]/clause/title","//clause[@id = 'clause1'\\]/clause/clause/title:2"]
1161
+
1162
+ toc:["//clause[@id = 'clause1'\\]/clause/title"]
1163
+ INPUT
1164
+ output = <<~OUTPUT
1165
+ #{BLANK_HDR}
1166
+ <sections>
1167
+ <clause id='clause1' inline-header='false' obligation='normative'>
1168
+ <title>Clause 1</title>
1169
+ <clause id='clause1A' inline-header='false' obligation='normative'>
1170
+ <title>Clause 1A</title>
1171
+ <clause id='clause1Aa' inline-header='false' obligation='normative'>
1172
+ <title>Clause 1Aa</title>
1173
+ </clause>
1174
+ <clause id='clause1Ab' inline-header='false' obligation='normative'>
1175
+ <title>Clause 1Ab</title>
1176
+ </clause>
1177
+ </clause>
1178
+ <clause id='clause1B' inline-header='false' obligation='normative'>
1179
+ <title>Clause 1B</title>
1180
+ <clause id='clause1Ba' inline-header='false' obligation='normative'>
1181
+ <title>Clause 1Ba</title>
1182
+ </clause>
1183
+ </clause>
1184
+ </clause>
1185
+ <clause id='clause2' inline-header='false' obligation='normative'>
1186
+ <title>Clause 2</title>
1187
+ <p id='_'>And introducing: </p>
1188
+ <toc>
1189
+ <ul id='_'>
1190
+ <li>
1191
+ <xref target='clause1A'>Clause 1A</xref>
1192
+ </li>
1193
+ <li>
1194
+ <ul id='_'>
1195
+ <li>
1196
+ <xref target='clause1Aa'>Clause 1Aa</xref>
1197
+ </li>
1198
+ <li>
1199
+ <xref target='clause1Ab'>Clause 1Ab</xref>
1200
+ </li>
1201
+ </ul>
1202
+ </li>
1203
+ <li>
1204
+ <xref target='clause1B'>Clause 1B</xref>
1205
+ </li>
1206
+ <li>
1207
+ <ul id='_'>
1208
+ <li>
1209
+ <xref target='clause1Ba'>Clause 1Ba</xref>
1210
+ </li>
1211
+ </ul>
1212
+ </li>
1213
+ </ul>
1214
+ </toc>
1215
+ <toc>
1216
+ <ul id='_'>
1217
+ <li>
1218
+ <xref target='clause1A'>Clause 1A</xref>
1219
+ </li>
1220
+ <li>
1221
+ <xref target='clause1B'>Clause 1B</xref>
1222
+ </li>
1223
+ </ul>
1224
+ </toc>
1225
+ </clause>
1226
+ </sections>
1227
+ </standard-document>
1228
+ OUTPUT
1229
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
1230
+ .to be_equivalent_to xmlpp(output)
1231
+ end
1232
+
912
1233
  describe "term inline macros" do
913
1234
  subject(:convert) do
914
1235
  xmlpp(
@@ -1139,79 +1460,79 @@ RSpec.describe Asciidoctor::Standoc do
1139
1460
  end
1140
1461
  let(:output) do
1141
1462
  <<~XML
1142
- #{BLANK_HDR}
1143
- <sections>
1144
- <terms id='_' obligation='normative'>
1145
- <title>Terms and definitions</title>
1146
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1147
- <term id='term-name-identity'>
1148
- <preferred>name identity</preferred>
1149
- </term>
1150
- <term id='name-check'>
1151
- <preferred>name check</preferred>
1152
- <definition>
1153
- <p id='_'>paragraph</p>
1154
- <p id='_'>
1155
- <concept>
1156
- <refterm>name check</refterm>
1157
- <renderterm>name check</renderterm>
1158
- <xref target='name-check'/>
1159
- </concept>
1160
- is a term
1161
- </p>
1162
- <p id='_'>
1163
- <concept>
1164
- <refterm>name identity</refterm>
1165
- <renderterm>name identity</renderterm>
1166
- <xref target='term-name-identity'/>
1167
- </concept>
1168
- is a term
1169
- </p>
1170
- <p id='_'>
1171
- Moreover,
1172
- <concept>
1173
- <strong>
1174
- term
1175
- <tt>missing</tt>
1176
- not resolved via ID
1177
- <tt>missing</tt>
1178
- </strong>
1179
- </concept>
1180
- is a term
1181
- </p>
1182
- <p id='_'>
1183
- <concept>
1184
- <refterm>name check</refterm>
1185
- <renderterm>name check</renderterm>
1186
- <xref target='name-check'/>
1187
- </concept>
1188
- is a term
1189
- </p>
1190
- <p id='_'>
1191
- <concept>
1192
- <refterm>name identity</refterm>
1193
- <renderterm>name identity</renderterm>
1194
- <xref target='term-name-identity'/>
1195
- </concept>
1196
- is a term
1197
- </p>
1198
- <p id='_'>
1199
- Moreover,
1200
- <concept>
1201
- <strong>
1202
- term
1203
- <tt>missing</tt>
1204
- not resolved via ID
1205
- <tt>missing</tt>
1206
- </strong>
1207
- </concept>
1208
- is a term
1209
- </p>
1210
- </definition>
1211
- </term>
1212
- </terms>
1213
- </sections>
1214
- </standard-document>
1463
+ #{BLANK_HDR}
1464
+ <sections>
1465
+ <terms id='_' obligation='normative'>
1466
+ <title>Terms and definitions</title>
1467
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
1468
+ <term id='term-name-identity'>
1469
+ <preferred>name identity</preferred>
1470
+ </term>
1471
+ <term id='name-check'>
1472
+ <preferred>name check</preferred>
1473
+ <definition>
1474
+ <p id='_'>paragraph</p>
1475
+ <p id='_'>
1476
+ <concept>
1477
+ <refterm>name check</refterm>
1478
+ <renderterm>name check</renderterm>
1479
+ <xref target='name-check'/>
1480
+ </concept>
1481
+ is a term
1482
+ </p>
1483
+ <p id='_'>
1484
+ <concept>
1485
+ <refterm>name identity</refterm>
1486
+ <renderterm>name identity</renderterm>
1487
+ <xref target='term-name-identity'/>
1488
+ </concept>
1489
+ is a term
1490
+ </p>
1491
+ <p id='_'>
1492
+ Moreover,
1493
+ <concept>
1494
+ <strong>
1495
+ term
1496
+ <tt>missing</tt>
1497
+ not resolved via ID
1498
+ <tt>missing</tt>
1499
+ </strong>
1500
+ </concept>
1501
+ is a term
1502
+ </p>
1503
+ <p id='_'>
1504
+ <concept>
1505
+ <refterm>name check</refterm>
1506
+ <renderterm>name check</renderterm>
1507
+ <xref target='name-check'/>
1508
+ </concept>
1509
+ is a term
1510
+ </p>
1511
+ <p id='_'>
1512
+ <concept>
1513
+ <refterm>name identity</refterm>
1514
+ <renderterm>name identity</renderterm>
1515
+ <xref target='term-name-identity'/>
1516
+ </concept>
1517
+ is a term
1518
+ </p>
1519
+ <p id='_'>
1520
+ Moreover,
1521
+ <concept>
1522
+ <strong>
1523
+ term
1524
+ <tt>missing</tt>
1525
+ not resolved via ID
1526
+ <tt>missing</tt>
1527
+ </strong>
1528
+ </concept>
1529
+ is a term
1530
+ </p>
1531
+ </definition>
1532
+ </term>
1533
+ </terms>
1534
+ </sections>
1535
+ </standard-document>
1215
1536
  XML
1216
1537
  end
1217
1538