metanorma-standoc 1.10.8 → 1.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/asciidoctor/standoc/base.rb +5 -4
  4. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  5. data/lib/asciidoctor/standoc/cleanup.rb +20 -11
  6. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +28 -20
  7. data/lib/asciidoctor/standoc/cleanup_inline.rb +20 -7
  8. data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
  9. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +25 -15
  10. data/lib/asciidoctor/standoc/cleanup_reqt.rb +2 -21
  11. data/lib/asciidoctor/standoc/cleanup_section_names.rb +2 -2
  12. data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
  13. data/lib/asciidoctor/standoc/cleanup_terms.rb +54 -79
  14. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +179 -0
  15. data/lib/asciidoctor/standoc/cleanup_text.rb +23 -0
  16. data/lib/asciidoctor/standoc/converter.rb +2 -0
  17. data/lib/asciidoctor/standoc/datamodel/attributes_table_preprocessor.rb +6 -6
  18. data/lib/asciidoctor/standoc/inline.rb +20 -16
  19. data/lib/asciidoctor/standoc/isodoc.rng +254 -27
  20. data/lib/asciidoctor/standoc/lists.rb +1 -3
  21. data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
  22. data/lib/asciidoctor/standoc/macros_terms.rb +49 -5
  23. data/lib/asciidoctor/standoc/ref.rb +101 -75
  24. data/lib/asciidoctor/standoc/ref_date_id.rb +30 -1
  25. data/lib/asciidoctor/standoc/ref_sect.rb +42 -24
  26. data/lib/asciidoctor/standoc/reqt.rb +1 -1
  27. data/lib/asciidoctor/standoc/section.rb +14 -13
  28. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
  29. data/lib/asciidoctor/standoc/terms.rb +12 -2
  30. data/lib/asciidoctor/standoc/utils.rb +36 -23
  31. data/lib/asciidoctor/standoc/validate.rb +25 -16
  32. data/lib/isodoc/html/htmlstyle.css +1 -1
  33. data/lib/isodoc/html/htmlstyle.scss +1 -1
  34. data/lib/metanorma/standoc/version.rb +1 -1
  35. data/metanorma-standoc.gemspec +3 -3
  36. data/spec/asciidoctor/base_spec.rb +4 -3
  37. data/spec/asciidoctor/blocks_spec.rb +202 -21
  38. data/spec/asciidoctor/cleanup_sections_spec.rb +7 -7
  39. data/spec/asciidoctor/cleanup_spec.rb +23 -197
  40. data/spec/asciidoctor/cleanup_terms_spec.rb +1205 -0
  41. data/spec/asciidoctor/datamodel/attributes_table_preprocessor_spec.rb +21 -21
  42. data/spec/asciidoctor/datamodel/diagram_preprocessor_spec.rb +16 -16
  43. data/spec/asciidoctor/inline_spec.rb +7 -7
  44. data/spec/asciidoctor/isobib_cache_spec.rb +4 -8
  45. data/spec/asciidoctor/macros_plantuml_spec.rb +36 -1
  46. data/spec/asciidoctor/macros_spec.rb +189 -112
  47. data/spec/asciidoctor/refs_dl_spec.rb +4 -4
  48. data/spec/asciidoctor/refs_spec.rb +860 -522
  49. data/spec/asciidoctor/section_spec.rb +18 -18
  50. data/spec/asciidoctor/validate_spec.rb +59 -2
  51. data/spec/spec_helper.rb +3 -2
  52. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +180 -180
  53. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +12 -12
  54. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  55. data/spec/vcr_cassettes/isobib_get_123_1.yml +27 -27
  56. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +35 -35
  57. data/spec/vcr_cassettes/isobib_get_123_2001.yml +13 -13
  58. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  59. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  60. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +45 -65
  61. metadata +11 -8
@@ -213,141 +213,6 @@ RSpec.describe Asciidoctor::Standoc do
213
213
  .to be_equivalent_to xmlpp(output)
214
214
  end
215
215
 
216
- it "processes stem-only terms as admitted" do
217
- input = <<~INPUT
218
- #{ASCIIDOC_BLANK_HDR}
219
- == Terms and Definitions
220
-
221
- === stem:[t_90]
222
-
223
- stem:[t_91]
224
-
225
- Time
226
- INPUT
227
- output = <<~OUTPUT
228
- #{BLANK_HDR}
229
- <sections>
230
- <terms id="_" obligation="normative">
231
- <title>Terms and definitions</title>
232
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
233
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
234
- <mrow>
235
- <mi>t</mi>
236
- </mrow>
237
- <mrow>
238
- <mn>90</mn>
239
- </mrow>
240
- </msub></math></stem></preferred><admitted><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
241
- <mrow>
242
- <mi>t</mi>
243
- </mrow>
244
- <mrow>
245
- <mn>91</mn>
246
- </mrow>
247
- </msub></math></stem></admitted>
248
- <definition><p id="_">Time</p></definition></term>
249
- </terms>
250
- </sections>
251
- </standard-document>
252
- OUTPUT
253
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
254
- .to be_equivalent_to xmlpp(output)
255
- end
256
-
257
- it "moves term domains out of the term definition paragraph" do
258
- input = <<~INPUT
259
- #{ASCIIDOC_BLANK_HDR}
260
- == Terms and Definitions
261
-
262
- === Tempus
263
-
264
- domain:[relativity] Time
265
-
266
- === Tempus1
267
-
268
- Time2
269
-
270
- domain:[relativity2]
271
- INPUT
272
- output = <<~OUTPUT
273
- #{BLANK_HDR}
274
- <sections>
275
- <terms id="_" obligation="normative">
276
- <title>Terms and definitions</title>
277
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
278
- <term id="term-tempus">
279
- <preferred>Tempus</preferred>
280
- <domain>relativity</domain><definition><p id="_"> Time</p></definition>
281
- </term>
282
- <term id='term-tempus1'>
283
- <preferred>Tempus1</preferred>
284
- <domain>relativity2</domain>
285
- <definition>
286
- <p id='_'>Time2</p>
287
- <p id='_'> </p>
288
- </definition>
289
- </term>
290
- </terms>
291
- </sections>
292
- </standard-document>
293
- OUTPUT
294
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
295
- .to be_equivalent_to xmlpp(output)
296
- end
297
-
298
- it "permits multiple blocks in term definition paragraph" do
299
- input = <<~INPUT
300
- = Document title
301
- Author
302
- :docfile: test.adoc
303
- :nodoc:
304
- :novalid:
305
- :stem:
306
-
307
- == Terms and Definitions
308
-
309
- === stem:[t_90]
310
-
311
- [stem]
312
- ++++
313
- t_A
314
- ++++
315
-
316
- This paragraph is extraneous
317
- INPUT
318
- output = <<~OUTPUT
319
- #{BLANK_HDR}
320
- <sections>
321
- <terms id="_" obligation="normative">
322
- <title>Terms and definitions</title>
323
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
324
- <term id="term-t90"><preferred><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
325
- <mrow>
326
- <mi>t</mi>
327
- </mrow>
328
- <mrow>
329
- <mn>90</mn>
330
- </mrow>
331
- </msub></math></stem></preferred><definition><formula id="_">
332
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub>
333
- <mrow>
334
- <mi>t</mi>
335
- </mrow>
336
- <mrow>
337
- <mi>A</mi>
338
- </mrow>
339
- </msub></math></stem>
340
- </formula>
341
- <p id="_">This paragraph is extraneous</p></definition>
342
- </term>
343
- </terms>
344
- </sections>
345
- </standard-document>
346
- OUTPUT
347
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
348
- .to be_equivalent_to xmlpp(output)
349
- end
350
-
351
216
  it "converts xrefs to references into erefs" do
352
217
  input = <<~INPUT
353
218
  #{ASCIIDOC_BLANK_HDR}
@@ -548,6 +413,8 @@ RSpec.describe Asciidoctor::Standoc do
548
413
 
549
414
  === Term1
550
415
 
416
+ Definition 0
417
+
551
418
  [.source]
552
419
  <<ISO2191,section=1>>
553
420
  INPUT
@@ -558,8 +425,9 @@ RSpec.describe Asciidoctor::Standoc do
558
425
  <title>Terms and definitions</title>
559
426
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
560
427
  <term id="term-term1">
561
- <preferred>Term1</preferred>
562
- <termsource status="identical">
428
+ <preferred><expression><name>Term1</name></expression></preferred>
429
+ <definition><verbal-definition><p id='_'>Definition 0</p></verbal-definition></definition>
430
+ <termsource status="identical" type="authoritative">
563
431
  <origin bibitemid="ISO2191" type="inline" citeas="">
564
432
  <localityStack>
565
433
  <locality type="section"><referenceFrom>1</referenceFrom></locality>
@@ -630,57 +498,6 @@ RSpec.describe Asciidoctor::Standoc do
630
498
  .to be_equivalent_to xmlpp(output)
631
499
  end
632
500
 
633
- it "rearranges term note, term example, term source" do
634
- input = <<~INPUT
635
- #{ASCIIDOC_BLANK_HDR}
636
-
637
- == Terms and definitions
638
-
639
- === Term
640
-
641
- [.source]
642
- <<ISO2191,section=1>>
643
-
644
- NOTE: Note
645
-
646
- [example]
647
- Example 1
648
-
649
- NOTE: Note 2
650
-
651
- [example]
652
- Example 2
653
- INPUT
654
- output = <<~OUTPUT
655
- #{BLANK_HDR}
656
- <sections>
657
- <terms id="_" obligation="normative">
658
- <title>Terms and definitions</title>
659
- <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
660
- <term id="term-term"><preferred>Term</preferred>
661
- <termnote id="_">
662
- <p id="_">Note</p>
663
- </termnote><termnote id="_">
664
- <p id="_">Note 2</p>
665
- </termnote><termexample id="_">
666
- <p id="_">Example 1</p>
667
- </termexample><termexample id="_">
668
- <p id="_">Example 2</p>
669
- </termexample><termsource status="identical">
670
- <origin bibitemid="ISO2191" type="inline" citeas="">
671
- <localityStack>
672
- <locality type="section"><referenceFrom>1</referenceFrom></locality>
673
- </localityStack>
674
- </origin>
675
- </termsource></term>
676
- </terms>
677
- </sections>
678
- </standard-document>
679
- OUTPUT
680
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
681
- .to be_equivalent_to xmlpp(output)
682
- end
683
-
684
501
  it "separates IEV citations by top-level clause" do
685
502
  FileUtils.rm_rf File.expand_path("~/.relaton-bib.pstore1")
686
503
  FileUtils.mv File.expand_path("~/.relaton/cache"),
@@ -702,16 +519,22 @@ RSpec.describe Asciidoctor::Standoc do
702
519
  == Terms and definitions
703
520
  === Automation1
704
521
 
522
+ Definition 1
523
+
705
524
  [.source]
706
525
  <<iev,clause="103-01-02">>
707
526
 
708
527
  === Automation2
709
528
 
529
+ Definition 2
530
+
710
531
  [.source]
711
532
  <<iev,clause="102-01-02">>
712
533
 
713
534
  === Automation3
714
535
 
536
+ Definition 3
537
+
715
538
  [.source]
716
539
  <<iev,clause="103-01-02">>
717
540
  INPUT
@@ -721,8 +544,9 @@ RSpec.describe Asciidoctor::Standoc do
721
544
  <terms id="_" obligation="normative"><title>Terms and definitions</title>
722
545
  <p id="_">For the purposes of this document, the following terms and definitions apply.</p>
723
546
  <term id="term-automation1">
724
- <preferred>Automation1</preferred>
725
- <termsource status="identical">
547
+ <preferred><expression><name>Automation1</name></expression></preferred>
548
+ <definition><verbal-definition><p id='_'>Definition 1</p></verbal-definition></definition>
549
+ <termsource status="identical" type="authoritative">
726
550
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
727
551
  <localityStack>
728
552
  <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
@@ -731,8 +555,9 @@ RSpec.describe Asciidoctor::Standoc do
731
555
  </termsource>
732
556
  </term>
733
557
  <term id="term-automation2">
734
- <preferred>Automation2</preferred>
735
- <termsource status="identical">
558
+ <preferred><expression><name>Automation2</name></expression></preferred>
559
+ <definition><verbal-definition><p id='_'>Definition 2</p></verbal-definition></definition>
560
+ <termsource status="identical" type="authoritative">
736
561
  <origin bibitemid="IEC60050-102" type="inline" citeas="IEC 60050-102:2007">
737
562
  <localityStack>
738
563
  <locality type="clause"><referenceFrom>102-01-02</referenceFrom></locality>
@@ -741,8 +566,9 @@ RSpec.describe Asciidoctor::Standoc do
741
566
  </termsource>
742
567
  </term>
743
568
  <term id="term-automation3">
744
- <preferred>Automation3</preferred>
745
- <termsource status="identical">
569
+ <preferred><expression><name>Automation3</name></expression></preferred>
570
+ <definition><verbal-definition><p id='_'>Definition 3</p></verbal-definition></definition>
571
+ <termsource status="identical" type="authoritative">
746
572
  <origin bibitemid="IEC60050-103" type="inline" citeas="IEC 60050-103:2009">
747
573
  <localityStack>
748
574
  <locality type="clause"><referenceFrom>103-01-02</referenceFrom></locality>
@@ -753,7 +579,7 @@ RSpec.describe Asciidoctor::Standoc do
753
579
  <title>Normative references</title>
754
580
  #{NORM_REF_BOILERPLATE}
755
581
  <bibitem type="standard" id="IEC60050-102">
756
- <fetched>#{Date.today}</fetched>
582
+ <fetched/>
757
583
  <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
758
584
  <title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics — General concepts and linear algebra</title>
759
585
  <title type='main' format='text/plain' language='en' script='Latn'>International Electrotechnical Vocabulary (IEV) — Part 102: Mathematics — General concepts and linear algebra</title>
@@ -792,7 +618,7 @@ RSpec.describe Asciidoctor::Standoc do
792
618
  </copyright>
793
619
  <place>Geneva</place>
794
620
  </bibitem><bibitem type="standard" id="IEC60050-103">
795
- <fetched>#{Date.today}</fetched>
621
+ <fetched/>
796
622
  <title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
797
623
  <title type="title-part" format="text/plain" language="en" script="Latn">Part 103: Mathematics — Functions</title>
798
624
  <title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) — Part 103: Mathematics — Functions</title>
@@ -1987,7 +1813,7 @@ RSpec.describe Asciidoctor::Standoc do
1987
1813
  ====
1988
1814
  INPUT
1989
1815
  output = <<~OUTPUT
1990
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='1.10.7'>
1816
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version="#{Metanorma::Standoc::VERSION}">
1991
1817
  <bibdata type='standard'>
1992
1818
  <title language='en' format='text/plain'>Document title</title>
1993
1819
  <language>en</language>