metanorma-standoc 1.9.4 → 1.10.3

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 (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +1 -1
  4. data/lib/asciidoctor/standoc/base.rb +0 -1
  5. data/lib/asciidoctor/standoc/blocks.rb +1 -1
  6. data/lib/asciidoctor/standoc/cleanup.rb +61 -2
  7. data/lib/asciidoctor/standoc/cleanup_block.rb +0 -1
  8. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +2 -2
  9. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +0 -1
  10. data/lib/asciidoctor/standoc/cleanup_inline.rb +117 -77
  11. data/lib/asciidoctor/standoc/cleanup_maths.rb +0 -1
  12. data/lib/asciidoctor/standoc/cleanup_ref.rb +7 -0
  13. data/lib/asciidoctor/standoc/cleanup_section.rb +0 -1
  14. data/lib/asciidoctor/standoc/cleanup_terms.rb +19 -18
  15. data/lib/asciidoctor/standoc/converter.rb +3 -0
  16. data/lib/asciidoctor/standoc/datamodel/diagram_preprocessor.rb +22 -21
  17. data/lib/asciidoctor/standoc/front.rb +0 -1
  18. data/lib/asciidoctor/standoc/front_contributor.rb +0 -1
  19. data/lib/asciidoctor/standoc/inline.rb +20 -17
  20. data/lib/asciidoctor/standoc/isodoc.rng +56 -8
  21. data/lib/asciidoctor/standoc/macros.rb +25 -5
  22. data/lib/asciidoctor/standoc/macros_plantuml.rb +21 -23
  23. data/lib/asciidoctor/standoc/macros_terms.rb +60 -23
  24. data/lib/asciidoctor/standoc/ref.rb +60 -56
  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 +3 -3
  37. data/spec/asciidoctor/blocks_spec.rb +8 -8
  38. data/spec/asciidoctor/cleanup_sections_spec.rb +899 -864
  39. data/spec/asciidoctor/cleanup_spec.rb +85 -20
  40. data/spec/asciidoctor/isobib_cache_spec.rb +4 -6
  41. data/spec/asciidoctor/lists_spec.rb +147 -135
  42. data/spec/asciidoctor/macros_json2text_spec.rb +1 -1
  43. data/spec/asciidoctor/macros_plantuml_spec.rb +165 -104
  44. data/spec/asciidoctor/macros_spec.rb +813 -168
  45. data/spec/asciidoctor/refs_spec.rb +12 -12
  46. data/spec/asciidoctor/validate_spec.rb +76 -20
  47. data/spec/support/shared_examples/structured_data_2_text_preprocessor.rb +34 -34
  48. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  49. data/spec/vcr_cassettes/isobib_get_123.yml +13 -13
  50. data/spec/vcr_cassettes/isobib_get_123_1.yml +26 -26
  51. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +34 -34
  52. data/spec/vcr_cassettes/isobib_get_123_2001.yml +14 -14
  53. data/spec/vcr_cassettes/isobib_get_124.yml +11 -11
  54. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  55. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +51 -61
  56. metadata +11 -7
@@ -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 PlantUML macro" do
5
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)).gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
6
6
  #{ASCIIDOC_BLANK_HDR}
7
7
 
8
8
  [plantuml]
@@ -36,24 +36,27 @@ RSpec.describe Asciidoctor::Standoc do
36
36
  @enduml
37
37
  ....
38
38
  INPUT
39
- #{BLANK_HDR}
40
- <sections><figure id="_">
41
- <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
42
- </figure>
43
- <figure id="_">
44
- <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
45
- </figure>
46
- <figure id="_">
47
- <image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
48
- </figure>
49
- </sections>
50
-
51
- </standard-document>
39
+ output = <<~OUTPUT
40
+ #{BLANK_HDR}
41
+ <sections><figure id="_">
42
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
43
+ </figure>
44
+ <figure id="_">
45
+ <image src="plantuml/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
46
+ </figure>
47
+ <figure id="_">
48
+ <image src="plantuml/filename.png" id="_" mimetype="image/png" height="auto" width="auto"/>
49
+ </figure>
50
+ </sections>
51
+ </standard-document>
52
52
  OUTPUT
53
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
54
+ .gsub(%r{plantuml/plantuml[^./]+\.}, "plantuml/_.")))
55
+ .to be_equivalent_to xmlpp(output)
53
56
  end
54
57
 
55
58
  it "processes the PlantUML macro with imagesdir" do
56
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)).gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_."))).to be_equivalent_to xmlpp(<<~"OUTPUT")
59
+ input = <<~INPUT
57
60
  = Document title
58
61
  Author
59
62
  :docfile: test.adoc
@@ -72,18 +75,22 @@ RSpec.describe Asciidoctor::Standoc do
72
75
  Alice <-- Bob: another authentication Response
73
76
  @enduml
74
77
  ....
75
- INPUT
76
- #{BLANK_HDR}
77
- <sections>
78
- <figure id="_">
79
- <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
80
- </figure>
81
- </sections>
82
- </standard-document>
83
- OUTPUT
84
- end
78
+ INPUT
79
+ output = <<~OUTPUT
80
+ #{BLANK_HDR}
81
+ <sections>
82
+ <figure id="_">
83
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
84
+ </figure>
85
+ </sections>
86
+ </standard-document>
87
+ OUTPUT
88
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))
89
+ .gsub(%r{spec/assets/[^./]+\.}, "spec/assets/_.")))
90
+ .to be_equivalent_to xmlpp(output)
91
+ end
85
92
 
86
- context 'when lutaml_diagram' do
93
+ context "when lutaml_diagram" do
87
94
  let(:input) do
88
95
  <<~"OUTPUT"
89
96
  = Document title
@@ -106,13 +113,13 @@ OUTPUT
106
113
  end
107
114
  let(:output) do
108
115
  <<~"OUTPUT"
109
- #{BLANK_HDR}
110
- <sections>
111
- <figure id="_">
112
- <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
113
- </figure>
114
- </sections>
115
- </standard-document>
116
+ #{BLANK_HDR}
117
+ <sections>
118
+ <figure id="_">
119
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
120
+ </figure>
121
+ </sections>
122
+ </standard-document>
116
123
  OUTPUT
117
124
  end
118
125
 
@@ -120,12 +127,54 @@ OUTPUT
120
127
  expect(
121
128
  xmlpp(
122
129
  strip_guid(Asciidoctor.convert(input, *OPTIONS))
123
- .gsub(%r{".+spec\/assets\/lutaml\/[^.\/]+\.}, %q("spec/assets/_.))))
124
- .to(be_equivalent_to xmlpp(output))
130
+ .gsub(%r{".+spec/assets/lutaml/[^./]+\.},
131
+ '"spec/assets/_.'),
132
+ ),
133
+ )
134
+ .to(be_equivalent_to(xmlpp(output)))
135
+ end
136
+
137
+ context "when inline macro, path supplied as the second arg" do
138
+ let(:example_file) { fixtures_path('diagram_definitions.lutaml') }
139
+ let(:input) do
140
+ <<~TEXT
141
+ = Document title
142
+ Author
143
+ :docfile: test.adoc
144
+ :nodoc:
145
+ :novalid:
146
+ :no-isobib:
147
+ :imagesdir: spec/assets
148
+
149
+ lutaml_diagram::#{example_file}[]
150
+
151
+ TEXT
152
+ end
153
+ let(:output) do
154
+ <<~TEXT
155
+ #{BLANK_HDR}
156
+ <sections>
157
+ <figure id="_">
158
+ <image src="spec/assets/_.png" id="_" mimetype="image/png" height="auto" width="auto"/>
159
+ </figure>
160
+ </sections>
161
+ </standard-document>
162
+ TEXT
163
+ end
164
+
165
+ it "correctly renders input" do
166
+ expect(
167
+ xmlpp(
168
+ strip_guid(Asciidoctor.convert(input, *OPTIONS))
169
+ .gsub(%r{".+spec/assets/lutaml/[^./]+\.},
170
+ '"spec/assets/_.'),
171
+ ),
172
+ ).to(be_equivalent_to(xmlpp(output)))
173
+ end
125
174
  end
126
175
  end
127
176
 
128
- context 'when lutaml_uml_attributes_table' do
177
+ context "when lutaml_uml_attributes_table" do
129
178
  let(:example_file) { fixtures_path("diagram_definitions.lutaml") }
130
179
  let(:input) do
131
180
  <<~"OUTPUT"
@@ -142,59 +191,61 @@ OUTPUT
142
191
  end
143
192
  let(:output) do
144
193
  <<~"OUTPUT"
145
- #{BLANK_HDR}
146
- <sections>
147
- <clause id='_' inline-header='false' obligation='normative'>
148
- <title>AttributeProfile</title>
149
- <table id='_'>
150
- <name>AttributeProfile attributes</name>
151
- <thead>
152
- <tr>
153
- <th valign='top' align='left'>Name</th>
154
- <th valign='top' align='left'>Definition</th>
155
- <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
156
- <th valign='top' align='left'>Max Occur</th>
157
- <th valign='top' align='left'>Data Type</th>
158
- </tr>
159
- </thead>
160
- <tbody>
161
- <tr>
162
- <td valign='top' align='left'>addressClassProfile</td>
163
- <td valign='top' align='left'>TODO: enum ‘s definition</td>
164
- <td valign='top' align='left'>O</td>
165
- <td valign='top' align='left'>1</td>
166
- <td valign='top' align='left'>
167
- <tt>CharacterString</tt>
168
- </td>
169
- </tr>
170
- <tr>
171
- <td valign='top' align='left'>imlicistAttributeProfile</td>
172
- <td valign='top' align='left'>this is attribute definition with multiply lines</td>
173
- <td valign='top' align='left'>O</td>
174
- <td valign='top' align='left'>1</td>
175
- <td valign='top' align='left'>
176
- <tt>CharacterString</tt>
177
- </td>
178
- </tr>
179
- </tbody>
180
- </table>
181
- </clause>
182
- </sections>
183
- </standard-document>
194
+ #{BLANK_HDR}
195
+ <sections>
196
+ <clause id='_' inline-header='false' obligation='normative'>
197
+ <title>AttributeProfile</title>
198
+ <table id='_'>
199
+ <name>AttributeProfile attributes</name>
200
+ <thead>
201
+ <tr>
202
+ <th valign='top' align='left'>Name</th>
203
+ <th valign='top' align='left'>Definition</th>
204
+ <th valign='top' align='left'>Mandatory/ Optional/ Conditional</th>
205
+ <th valign='top' align='left'>Max Occur</th>
206
+ <th valign='top' align='left'>Data Type</th>
207
+ </tr>
208
+ </thead>
209
+ <tbody>
210
+ <tr>
211
+ <td valign='top' align='left'>addressClassProfile</td>
212
+ <td valign='top' align='left'></td>
213
+ <td valign='top' align='left'>O</td>
214
+ <td valign='top' align='left'>1</td>
215
+ <td valign='top' align='left'>
216
+ <tt>CharacterString</tt>
217
+ </td>
218
+ </tr>
219
+ <tr>
220
+ <td valign='top' align='left'>imlicistAttributeProfile</td>
221
+ <td valign='top' align='left'>this is attribute definition with multiply lines</td>
222
+ <td valign='top' align='left'>O</td>
223
+ <td valign='top' align='left'>1</td>
224
+ <td valign='top' align='left'>
225
+ <tt>CharacterString</tt>
226
+ </td>
227
+ </tr>
228
+ </tbody>
229
+ </table>
230
+ </clause>
231
+ </sections>
232
+ </standard-document>
184
233
  OUTPUT
185
234
  end
186
235
 
187
236
  it "processes the lutaml_uml_attributes_table macro" do
188
237
  expect(
189
238
  xmlpp(
190
- strip_guid(Asciidoctor.convert(input, *OPTIONS))))
239
+ strip_guid(Asciidoctor.convert(input, *OPTIONS)),
240
+ ),
241
+ )
191
242
  .to(be_equivalent_to(xmlpp(output)))
192
243
  end
193
244
  end
194
245
 
195
246
  it "processes the PlantUML macro with PlantUML disabled" do
196
247
  mock_plantuml_disabled
197
- expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(%r{PlantUML not installed}).to_stderr
248
+ input = <<~INPUT
198
249
  #{ASCIIDOC_BLANK_HDR}
199
250
 
200
251
  [plantuml]
@@ -208,9 +259,11 @@ OUTPUT
208
259
  @enduml
209
260
  ....
210
261
  INPUT
262
+ expect { Asciidoctor.convert(input, *OPTIONS) }
263
+ .to output(%r{PlantUML not installed}).to_stderr
211
264
 
212
265
  mock_plantuml_disabled
213
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
266
+ input = <<~INPUT
214
267
  #{ASCIIDOC_BLANK_HDR}
215
268
 
216
269
  [plantuml]
@@ -224,23 +277,26 @@ OUTPUT
224
277
  @enduml
225
278
  ....
226
279
  INPUT
227
- #{BLANK_HDR}
228
- <sections>
229
- <sourcecode id="_" lang="plantuml">@startuml
230
- Alice -&gt; Bob: Authentication Request
231
- Bob --&gt; Alice: Authentication Response
232
-
233
- Alice -&gt; Bob: Another authentication Request
234
- Alice &lt;-- Bob: another authentication Response
235
- @enduml</sourcecode>
236
- </sections>
237
- </standard-document>
280
+ output = <<~OUTPUT
281
+ #{BLANK_HDR}
282
+ <sections>
283
+ <sourcecode id="_" lang="plantuml">@startuml
284
+ Alice -&gt; Bob: Authentication Request
285
+ Bob --&gt; Alice: Authentication Response
286
+
287
+ Alice -&gt; Bob: Another authentication Request
288
+ Alice &lt;-- Bob: another authentication Response
289
+ @enduml</sourcecode>
290
+ </sections>
291
+ </standard-document>
238
292
  OUTPUT
293
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
294
+ .to be_equivalent_to xmlpp(output)
239
295
  end
240
296
 
241
297
  it "processes the PlantUML macro with localdir unwritable" do
242
298
  mock_localdir_unwritable
243
- expect { Asciidoctor.convert(<<~"INPUT", *OPTIONS) }.to output(%r{not writable for PlantUML}).to_stderr
299
+ input = <<~INPUT
244
300
  #{ASCIIDOC_BLANK_HDR}
245
301
 
246
302
  [plantuml]
@@ -254,9 +310,11 @@ Alice &lt;-- Bob: another authentication Response
254
310
  @enduml
255
311
  ....
256
312
  INPUT
313
+ expect { Asciidoctor.convert(input, *OPTIONS) }
314
+ .to output(%r{not writable for PlantUML}).to_stderr
257
315
 
258
316
  mock_localdir_unwritable
259
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
317
+ input = <<~INPUT
260
318
  #{ASCIIDOC_BLANK_HDR}
261
319
 
262
320
  [plantuml]
@@ -270,26 +328,29 @@ Alice &lt;-- Bob: another authentication Response
270
328
  @enduml
271
329
  ....
272
330
  INPUT
273
- #{BLANK_HDR}
274
- <sections>
275
- <sourcecode id="_" lang="plantuml">@startuml
276
- Alice -&gt; Bob: Authentication Request
277
- Bob --&gt; Alice: Authentication Response
278
-
279
- Alice -&gt; Bob: Another authentication Request
280
- Alice &lt;-- Bob: another authentication Response
281
- @enduml</sourcecode>
282
- </sections>
283
- </standard-document>
331
+ output = <<~OUTPUT
332
+ #{BLANK_HDR}
333
+ <sections>
334
+ <sourcecode id="_" lang="plantuml">@startuml
335
+ Alice -&gt; Bob: Authentication Request
336
+ Bob --&gt; Alice: Authentication Response
337
+
338
+ Alice -&gt; Bob: Another authentication Request
339
+ Alice &lt;-- Bob: another authentication Response
340
+ @enduml</sourcecode>
341
+ </sections>
342
+ </standard-document>
284
343
  OUTPUT
344
+ expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
345
+ .to be_equivalent_to xmlpp(output)
285
346
  end
286
347
 
287
348
  private
288
349
 
289
350
  def mock_plantuml_disabled
290
- expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do
351
+ expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend)
352
+ .to receive(:plantuml_installed?) do
291
353
  raise "PlantUML not installed"
292
- false
293
354
  end
294
355
  end
295
356
 
@@ -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,107 @@ 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)
1132
+ end
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)
678
1231
  end
679
1232
 
680
1233
  describe "term inline macros" do
@@ -683,8 +1236,8 @@ RSpec.describe Asciidoctor::Standoc do
683
1236
  strip_guid(
684
1237
  Asciidoctor.convert(
685
1238
  input, *OPTIONS
686
- )
687
- )
1239
+ ),
1240
+ ),
688
1241
  )
689
1242
  end
690
1243
  let(:input) do
@@ -692,11 +1245,13 @@ RSpec.describe Asciidoctor::Standoc do
692
1245
  #{ASCIIDOC_BLANK_HDR}
693
1246
  == Terms and Definitions
694
1247
 
695
- === name2
1248
+ === name
696
1249
 
697
1250
  == Main
698
1251
 
699
1252
  term:[name,name2] is a term
1253
+
1254
+ {{name,name2}} is a term
700
1255
  XML
701
1256
  end
702
1257
  let(:output) do
@@ -706,17 +1261,27 @@ RSpec.describe Asciidoctor::Standoc do
706
1261
  <terms id='_' obligation='normative'>
707
1262
  <title>Terms and definitions</title>
708
1263
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
709
- <term id='term-name2'>
710
- <preferred>name2</preferred>
1264
+ <term id='term-name'>
1265
+ <preferred>name</preferred>
711
1266
  </term>
712
1267
  </terms>
713
1268
  <clause id='_' inline-header='false' obligation='normative'>
714
1269
  <title>Main</title>
715
1270
  <p id='_'>
716
- <em>name</em>
717
- (
718
- <xref target='term-name2'/>
719
- ) is a term
1271
+ <concept>
1272
+ <refterm>name</refterm>
1273
+ <renderterm>name2</renderterm>
1274
+ <xref target='term-name'/>
1275
+ </concept>
1276
+ is a term
1277
+ </p>
1278
+ <p id='_'>
1279
+ <concept>
1280
+ <refterm>name</refterm>
1281
+ <renderterm>name2</renderterm>
1282
+ <xref target='term-name'/>
1283
+ </concept>
1284
+ is a term
720
1285
  </p>
721
1286
  </clause>
722
1287
  </sections>
@@ -740,6 +1305,8 @@ RSpec.describe Asciidoctor::Standoc do
740
1305
  == Main
741
1306
 
742
1307
  term:[name] is a term
1308
+
1309
+ {{name}} is a term
743
1310
  XML
744
1311
  end
745
1312
  let(:output) do
@@ -756,10 +1323,20 @@ RSpec.describe Asciidoctor::Standoc do
756
1323
  <clause id='_' inline-header='false' obligation='normative'>
757
1324
  <title>Main</title>
758
1325
  <p id='_'>
759
- <em>name</em>
760
- (
761
- <xref target='term-name' />
762
- ) is a term
1326
+ <concept>
1327
+ <refterm>name</refterm>
1328
+ <renderterm>name</renderterm>
1329
+ <xref target='term-name'/>
1330
+ </concept>
1331
+ is a term
1332
+ </p>
1333
+ <p id='_'>
1334
+ <concept>
1335
+ <refterm>name</refterm>
1336
+ <renderterm>name</renderterm>
1337
+ <xref target='term-name'/>
1338
+ </concept>
1339
+ is a term
763
1340
  </p>
764
1341
  </clause>
765
1342
  </sections>
@@ -792,6 +1369,8 @@ RSpec.describe Asciidoctor::Standoc do
792
1369
 
793
1370
  term:[name] is a term
794
1371
  term:[name2] is a term
1372
+ {{name}} is a term
1373
+ {{name2}} is a term
795
1374
  XML
796
1375
  end
797
1376
  let(:output) do
@@ -815,14 +1394,30 @@ RSpec.describe Asciidoctor::Standoc do
815
1394
  <clause id='term-name2' inline-header='false' obligation='normative'>
816
1395
  <title>Second</title>
817
1396
  <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
1397
+ <concept>
1398
+ <refterm>name</refterm>
1399
+ <renderterm>name</renderterm>
1400
+ <xref target='term-name-1'/>
1401
+ </concept>
1402
+ is a term
1403
+ <concept>
1404
+ <refterm>name2</refterm>
1405
+ <renderterm>name2</renderterm>
1406
+ <xref target='term-name2-1'/>
1407
+ </concept>
1408
+ is a term
1409
+ <concept>
1410
+ <refterm>name</refterm>
1411
+ <renderterm>name</renderterm>
1412
+ <xref target='term-name-1'/>
1413
+ </concept>
1414
+ is a term
1415
+ <concept>
1416
+ <refterm>name2</refterm>
1417
+ <renderterm>name2</renderterm>
1418
+ <xref target='term-name2-1'/>
1419
+ </concept>
1420
+ is a term
826
1421
  </p>
827
1422
  </clause>
828
1423
  </sections>
@@ -854,12 +1449,19 @@ RSpec.describe Asciidoctor::Standoc do
854
1449
  term:[name identity] is a term
855
1450
 
856
1451
  Moreover, term:[missing] is a term
1452
+
1453
+
1454
+ {{name check}} is a term
1455
+
1456
+ {{name identity}} is a term
1457
+
1458
+ Moreover, {{missing}} is a term
857
1459
  XML
858
1460
  end
859
1461
  let(:output) do
860
1462
  <<~XML
861
- #{BLANK_HDR}
862
- <sections>
1463
+ #{BLANK_HDR}
1464
+ <sections>
863
1465
  <terms id='_' obligation='normative'>
864
1466
  <title>Terms and definitions</title>
865
1467
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
@@ -871,18 +1473,61 @@ RSpec.describe Asciidoctor::Standoc do
871
1473
  <definition>
872
1474
  <p id='_'>paragraph</p>
873
1475
  <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>
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>
886
1531
  </definition>
887
1532
  </term>
888
1533
  </terms>