metanorma-standoc 1.10.6 → 1.11.0.1

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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +19 -23
  3. data/Rakefile +1 -1
  4. data/lib/asciidoctor/standoc/base.rb +10 -17
  5. data/lib/asciidoctor/standoc/basicdoc.rng +21 -4
  6. data/lib/asciidoctor/standoc/blocks.rb +23 -23
  7. data/lib/asciidoctor/standoc/blocks_notes.rb +17 -22
  8. data/lib/asciidoctor/standoc/cleanup.rb +46 -12
  9. data/lib/asciidoctor/standoc/cleanup_block.rb +3 -71
  10. data/lib/asciidoctor/standoc/cleanup_image.rb +6 -7
  11. data/lib/asciidoctor/standoc/cleanup_inline.rb +42 -106
  12. data/lib/asciidoctor/standoc/cleanup_maths.rb +5 -6
  13. data/lib/asciidoctor/standoc/cleanup_ref.rb +5 -0
  14. data/lib/asciidoctor/standoc/cleanup_reqt.rb +5 -24
  15. data/lib/asciidoctor/standoc/cleanup_section_names.rb +5 -5
  16. data/lib/asciidoctor/standoc/cleanup_symbols.rb +48 -0
  17. data/lib/asciidoctor/standoc/cleanup_table.rb +68 -0
  18. data/lib/asciidoctor/standoc/cleanup_terms.rb +37 -77
  19. data/lib/asciidoctor/standoc/cleanup_terms_designations.rb +162 -0
  20. data/lib/asciidoctor/standoc/cleanup_text.rb +5 -2
  21. data/lib/asciidoctor/standoc/cleanup_xref.rb +107 -0
  22. data/lib/asciidoctor/standoc/converter.rb +14 -0
  23. data/lib/asciidoctor/standoc/inline.rb +7 -5
  24. data/lib/asciidoctor/standoc/isodoc.rng +419 -77
  25. data/lib/asciidoctor/standoc/lists.rb +15 -15
  26. data/lib/asciidoctor/standoc/macros.rb +14 -43
  27. data/lib/asciidoctor/standoc/macros_note.rb +45 -0
  28. data/lib/asciidoctor/standoc/macros_plantuml.rb +29 -14
  29. data/lib/asciidoctor/standoc/macros_terms.rb +55 -8
  30. data/lib/asciidoctor/standoc/ref_sect.rb +26 -18
  31. data/lib/asciidoctor/standoc/reqt.rng +23 -2
  32. data/lib/asciidoctor/standoc/term_lookup_cleanup.rb +50 -11
  33. data/lib/asciidoctor/standoc/terms.rb +12 -2
  34. data/lib/asciidoctor/standoc/utils.rb +36 -23
  35. data/lib/asciidoctor/standoc/validate.rb +45 -27
  36. data/lib/asciidoctor/standoc/validate_section.rb +5 -2
  37. data/lib/metanorma/standoc/version.rb +1 -1
  38. data/metanorma-standoc.gemspec +1 -1
  39. data/spec/asciidoctor/base_spec.rb +4 -36
  40. data/spec/asciidoctor/blank_spec.rb +37 -0
  41. data/spec/asciidoctor/blocks_spec.rb +208 -49
  42. data/spec/asciidoctor/cleanup_sections_spec.rb +153 -12
  43. data/spec/asciidoctor/cleanup_spec.rb +104 -285
  44. data/spec/asciidoctor/cleanup_terms_spec.rb +990 -0
  45. data/spec/asciidoctor/inline_spec.rb +38 -2
  46. data/spec/asciidoctor/lists_spec.rb +6 -6
  47. data/spec/asciidoctor/macros_plantuml_spec.rb +37 -2
  48. data/spec/asciidoctor/macros_spec.rb +191 -114
  49. data/spec/asciidoctor/refs_spec.rb +12 -30
  50. data/spec/asciidoctor/section_spec.rb +18 -18
  51. data/spec/asciidoctor/validate_spec.rb +87 -2
  52. data/spec/fixtures/datamodel_description_sections_tree.xml +3 -2
  53. data/spec/spec_helper.rb +6 -7
  54. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +51 -51
  55. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec1.yml +13 -13
  56. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  57. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  58. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  59. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  60. data/spec/vcr_cassettes/isobib_get_124.yml +13 -13
  61. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +16 -16
  62. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -49
  63. metadata +12 -5
@@ -73,8 +73,8 @@ RSpec.describe Asciidoctor::Standoc do
73
73
  sub<sub><em>scr</em>ipt</sub>
74
74
  <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><msub> <mrow> <mrow> <mi mathvariant="bold-italic">F</mi> </mrow> </mrow> <mrow> <mrow> <mi mathvariant="bold-italic">Α</mi> </mrow> </mrow> </msub> </math></stem>
75
75
  mark
76
- <admitted>alt</admitted>
77
- <deprecates>deprecated</deprecates>
76
+ <admitted><expression><name>alt</name></expression></admitted>
77
+ <deprecates><expression><name>deprecated</name></expression></deprecates>
78
78
  <domain>domain</domain>
79
79
  <strike>strike</strike>
80
80
  <underline>underline</underline>
@@ -480,4 +480,40 @@ RSpec.describe Asciidoctor::Standoc do
480
480
  expect((strip_guid(Asciidoctor.convert(input, *OPTIONS))))
481
481
  .to be_equivalent_to(output)
482
482
  end
483
+
484
+ it "processes format-specific inline pass" do
485
+ input = <<~INPUT
486
+ #{ASCIIDOC_BLANK_HDR}
487
+
488
+ pass-format:rfc,html[<abc>X &gt; Y</abc>]
489
+ INPUT
490
+ output = <<~OUTPUT
491
+ #{BLANK_HDR}
492
+ <sections>
493
+ <p id='_'>
494
+ <passthrough formats='rfc,html'>&lt;abc&gt;X &gt; Y&lt;/abc&gt;</passthrough>
495
+ </p>
496
+ </sections>
497
+ </standard-document>
498
+ OUTPUT
499
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
500
+ .to be_equivalent_to xmlpp(output)
501
+ end
502
+
503
+ it "processes Metanorma XML inline pass" do
504
+ input = <<~INPUT
505
+ #{ASCIIDOC_BLANK_HDR}
506
+
507
+ +<abc>X &gt;+ +++Y+++ pass:c[</abc>]
508
+ INPUT
509
+ output = <<~OUTPUT
510
+ #{BLANK_HDR}
511
+ <sections>
512
+ <p id='_'>&lt;abc&gt;X &gt; Y &lt;/abc&gt;</p>
513
+ </sections>
514
+ </standard-document>
515
+ OUTPUT
516
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
517
+ .to be_equivalent_to xmlpp(output)
518
+ end
483
519
  end
@@ -73,7 +73,7 @@ RSpec.describe Asciidoctor::Standoc do
73
73
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
74
74
  #{ASCIIDOC_BLANK_HDR}
75
75
  [[id]]
76
- [keep-with-next=true,keep-lines-together=true]
76
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
77
77
  * First
78
78
  * Second
79
79
  +
@@ -84,7 +84,7 @@ RSpec.describe Asciidoctor::Standoc do
84
84
  --
85
85
 
86
86
  [[id1]]
87
- [keep-with-next=true,keep-lines-together=true]
87
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
88
88
  [loweralpha]
89
89
  . First
90
90
  . Second
@@ -103,7 +103,7 @@ RSpec.describe Asciidoctor::Standoc do
103
103
  [arabic]
104
104
  ... E
105
105
  ... F
106
- [keep-with-next=true,keep-lines-together=true]
106
+ [keep-with-next=true,keep-lines-together=true,tag=X,multilingual-rendering=common]
107
107
  Notes1::
108
108
  Notes:: Note 1.
109
109
  +
@@ -117,14 +117,14 @@ RSpec.describe Asciidoctor::Standoc do
117
117
  INPUT
118
118
  expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
119
119
  #{BLANK_HDR}
120
- <sections><ul id="id" keep-with-next="true" keep-lines-together="true">
120
+ <sections><ul id="id" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
121
121
  <li>
122
122
  <p id="_">First</p>
123
123
  </li>
124
124
  <li><p id="_">Second</p><p id="_">entry1</p>
125
125
  <p id="_">entry2</p></li>
126
126
  </ul>
127
- <ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true">
127
+ <ol id="id1" type="alphabet" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common' >
128
128
  <li>
129
129
  <p id="_">First</p>
130
130
  </li>
@@ -164,7 +164,7 @@ RSpec.describe Asciidoctor::Standoc do
164
164
  </li>
165
165
  <li>
166
166
  <p id="_">F</p>
167
- <dl id="_" keep-with-next="true" keep-lines-together="true">
167
+ <dl id="_" keep-with-next="true" keep-lines-together="true" tag='X' multilingual-rendering='common'>
168
168
  <dt>Notes1</dt>
169
169
  <dd/>
170
170
  <dt>Notes</dt>
@@ -64,6 +64,7 @@ RSpec.describe Asciidoctor::Standoc do
64
64
  :novalid:
65
65
  :no-isobib:
66
66
  :imagesdir: spec/assets
67
+ :data-uri-image: false
67
68
 
68
69
  [plantuml]
69
70
  ....
@@ -100,6 +101,7 @@ RSpec.describe Asciidoctor::Standoc do
100
101
  :novalid:
101
102
  :no-isobib:
102
103
  :imagesdir: spec/assets
104
+ :data-uri-image: false
103
105
 
104
106
  [lutaml_diagram]
105
107
  ....
@@ -135,7 +137,7 @@ RSpec.describe Asciidoctor::Standoc do
135
137
  end
136
138
 
137
139
  context "when inline macro, path supplied as the second arg" do
138
- let(:example_file) { fixtures_path('diagram_definitions.lutaml') }
140
+ let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
139
141
  let(:input) do
140
142
  <<~TEXT
141
143
  = Document title
@@ -145,6 +147,7 @@ RSpec.describe Asciidoctor::Standoc do
145
147
  :novalid:
146
148
  :no-isobib:
147
149
  :imagesdir: spec/assets
150
+ :data-uri-image: false
148
151
 
149
152
  lutaml_diagram::#{example_file}[]
150
153
 
@@ -201,7 +204,7 @@ RSpec.describe Asciidoctor::Standoc do
201
204
  <tr>
202
205
  <th valign='top' align='left'>Name</th>
203
206
  <th valign='top' align='left'>Definition</th>
204
- <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
207
+ <th valign='top' align='left'>Mandatory / Optional / Conditional</th>
205
208
  <th valign='top' align='left'>Max Occur</th>
206
209
  <th valign='top' align='left'>Data Type</th>
207
210
  </tr>
@@ -345,6 +348,38 @@ RSpec.describe Asciidoctor::Standoc do
345
348
  .to be_equivalent_to xmlpp(output)
346
349
  end
347
350
 
351
+ it "processes the PlantUML macro with mismatched delimiters" do
352
+ input = <<~INPUT
353
+ #{ASCIIDOC_BLANK_HDR}
354
+
355
+ [plantuml]
356
+ ....
357
+ @startuml
358
+ Alice -> Bob: Authentication Request
359
+ Bob --> Alice: Authentication Response
360
+
361
+ Alice -> Bob: Another authentication Request
362
+ Alice <-- Bob: another authentication Response
363
+ ....
364
+ INPUT
365
+ expect { Asciidoctor.convert(input, *OPTIONS) }
366
+ .to output(%r{@startuml without matching @enduml in PlantUML!}).to_stderr
367
+ output = <<~OUTPUT
368
+ #{BLANK_HDR}
369
+ <sections>
370
+ <sourcecode id="_" lang="plantuml">@startuml
371
+ Alice -&gt; Bob: Authentication Request
372
+ Bob --&gt; Alice: Authentication Response
373
+
374
+ Alice -&gt; Bob: Another authentication Request
375
+ Alice &lt;-- Bob: another authentication Response</sourcecode>
376
+ </sections>
377
+ </standard-document>
378
+ OUTPUT
379
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
380
+ .to be_equivalent_to xmlpp(output)
381
+ end
382
+
348
383
  private
349
384
 
350
385
  def mock_plantuml_disabled