metanorma-standoc 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -2
  3. data/lib/asciidoctor/standoc/blocks.rb +18 -3
  4. data/lib/asciidoctor/standoc/blocks_notes.rb +29 -18
  5. data/lib/asciidoctor/standoc/cleanup.rb +1 -0
  6. data/lib/asciidoctor/standoc/cleanup_block.rb +30 -12
  7. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +23 -12
  8. data/lib/asciidoctor/standoc/cleanup_ref.rb +3 -2
  9. data/lib/asciidoctor/standoc/converter.rb +7 -2
  10. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  11. data/lib/asciidoctor/standoc/isodoc.rng +174 -0
  12. data/lib/asciidoctor/standoc/macros.rb +11 -11
  13. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  14. data/lib/asciidoctor/standoc/ref_sect.rb +20 -17
  15. data/lib/asciidoctor/standoc/section.rb +3 -1
  16. data/lib/asciidoctor/standoc/terms.rb +24 -17
  17. data/lib/asciidoctor/standoc/utils.rb +3 -3
  18. data/lib/asciidoctor/standoc/validate.rb +18 -16
  19. data/lib/metanorma-standoc.rb +0 -1
  20. data/lib/metanorma/standoc/version.rb +1 -1
  21. data/metanorma-standoc.gemspec +1 -1
  22. data/spec/asciidoctor/blocks_spec.rb +829 -734
  23. data/spec/asciidoctor/cleanup_sections_spec.rb +38 -1
  24. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  25. data/spec/asciidoctor/macros_spec.rb +537 -441
  26. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  27. data/spec/asciidoctor/section_spec.rb +367 -297
  28. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +50 -50
  29. data/spec/vcr_cassettes/isobib_get_123.yml +12 -12
  30. data/spec/vcr_cassettes/isobib_get_123_1.yml +24 -24
  31. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +33 -33
  32. data/spec/vcr_cassettes/isobib_get_123_2001.yml +12 -12
  33. data/spec/vcr_cassettes/isobib_get_124.yml +12 -12
  34. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  35. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +46 -46
  36. metadata +5 -4
@@ -16,37 +16,37 @@ RSpec.describe Asciidoctor::Standoc do
16
16
  * [[[ref1,XYZ 123]]] _Title_
17
17
  INPUT
18
18
  #{BLANK_HDR}
19
- <preface>
20
- <foreword id='_' obligation='informative'>
21
- <title>Foreword</title>
22
- <admitted>term1</admitted>
23
- <deprecates>term1</deprecates>
24
- <domain>term1</domain>
25
- <inherit>
26
- <eref type='inline' bibitemid='ref1' citeas='XYZ 123'/>
27
- </inherit>
28
- <autonumber type='table'>3</autonumber>
29
- <add>
30
- a
31
- <xref target='clause'/>
32
- </add>
33
- <del>B</del>
34
- </foreword>
35
- </preface>
36
- <sections> </sections>
37
- <bibliography>
38
- <references id='_' obligation='informative' normative="false">
39
- <title>Bibliography</title>
40
- <bibitem id='ref1'>
41
- <formattedref format='application/x-isodoc+xml'>
42
- <em>Title</em>
43
- </formattedref>
44
- <docidentifier>XYZ 123</docidentifier>
45
- <docnumber>123</docnumber>
46
- </bibitem>
47
- </references>
48
- </bibliography>
49
- </standard-document>
19
+ <preface>
20
+ <foreword id='_' obligation='informative'>
21
+ <title>Foreword</title>
22
+ <admitted>term1</admitted>
23
+ <deprecates>term1</deprecates>
24
+ <domain>term1</domain>
25
+ <inherit>
26
+ <eref type='inline' bibitemid='ref1' citeas='XYZ 123'/>
27
+ </inherit>
28
+ <autonumber type='table'>3</autonumber>
29
+ <add>
30
+ a
31
+ <xref target='clause'/>
32
+ </add>
33
+ <del>B</del>
34
+ </foreword>
35
+ </preface>
36
+ <sections> </sections>
37
+ <bibliography>
38
+ <references id='_' obligation='informative' normative="false">
39
+ <title>Bibliography</title>
40
+ <bibitem id='ref1'>
41
+ <formattedref format='application/x-isodoc+xml'>
42
+ <em>Title</em>
43
+ </formattedref>
44
+ <docidentifier>XYZ 123</docidentifier>
45
+ <docnumber>123</docnumber>
46
+ </bibitem>
47
+ </references>
48
+ </bibliography>
49
+ </standard-document>
50
50
  OUTPUT
51
51
  end
52
52
 
@@ -67,55 +67,55 @@ RSpec.describe Asciidoctor::Standoc do
67
67
 
68
68
  Text [[id3]]
69
69
  INPUT
70
- #{BLANK_HDR}
71
- <sections>
72
- <p id='_'>
73
- <index-xref also='true'>
74
- <primary>B</primary>
75
- <target>
76
- C
77
- <sub>x</sub>
78
- </target>
79
- </index-xref>
80
- <index-xref also='false'>
81
- <primary>D</primary>
82
- <secondary>
83
- <em>E</em>
84
- </secondary>
85
- <target>F</target>
86
- </index-xref>
87
- <index-xref also='true'>
88
- <primary>G</primary>
89
- <secondary>H</secondary>
90
- <tertiary>I</tertiary>
91
- <target>J</target>
92
- </index-xref>
93
- P
94
- <index to="id2">
95
- <primary>P</primary>
96
- </index>
97
- <em>P</em>
98
- <index to="id3">
99
- <primary>
100
- <em>P</em>
101
- </primary>
102
- </index>
103
- <index to="id3">
104
- <primary>Q</primary>
105
- <secondary>R</secondary>
106
- <tertiary>S</tertiary>
107
- </index>
108
- </p>
109
- <p id='_'>
110
- Text
111
- <bookmark id='id2'/>
112
- </p>
113
- <p id='_'>
114
- Text
115
- <bookmark id='id3'/>
116
- </p>
117
- </sections>
118
- </standard-document>
70
+ #{BLANK_HDR}
71
+ <sections>
72
+ <p id='_'>
73
+ <index-xref also='true'>
74
+ <primary>B</primary>
75
+ <target>
76
+ C
77
+ <sub>x</sub>
78
+ </target>
79
+ </index-xref>
80
+ <index-xref also='false'>
81
+ <primary>D</primary>
82
+ <secondary>
83
+ <em>E</em>
84
+ </secondary>
85
+ <target>F</target>
86
+ </index-xref>
87
+ <index-xref also='true'>
88
+ <primary>G</primary>
89
+ <secondary>H</secondary>
90
+ <tertiary>I</tertiary>
91
+ <target>J</target>
92
+ </index-xref>
93
+ P
94
+ <index to="id2">
95
+ <primary>P</primary>
96
+ </index>
97
+ <em>P</em>
98
+ <index to="id3">
99
+ <primary>
100
+ <em>P</em>
101
+ </primary>
102
+ </index>
103
+ <index to="id3">
104
+ <primary>Q</primary>
105
+ <secondary>R</secondary>
106
+ <tertiary>S</tertiary>
107
+ </index>
108
+ </p>
109
+ <p id='_'>
110
+ Text
111
+ <bookmark id='id2'/>
112
+ </p>
113
+ <p id='_'>
114
+ Text
115
+ <bookmark id='id3'/>
116
+ </p>
117
+ </sections>
118
+ </standard-document>
119
119
  OUTPUT
120
120
  end
121
121
 
@@ -127,34 +127,33 @@ RSpec.describe Asciidoctor::Standoc do
127
127
  this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
128
128
 
129
129
  INPUT
130
- #{BLANK_HDR}
131
- <sections>
132
- <clause id='_' inline-header='false' obligation='normative'>
133
- <title>
134
- <variant lang='en'>English</variant>
135
- <variant lang='fr' script='Latn'>Français</variant>
136
- </title>
137
- <p id='_'>
138
- this
139
- <variant>
140
- <variant lang='en'>English</variant>
141
- <variant lang='fr' script='Latn'>Français</variant>
142
- </variant>
143
- section is
144
- <variant>
145
- <variant lang='en'>silly</variant>
146
- <variant lang='fr'>fou</variant>
147
- </variant>
148
- </p>
149
- </clause>
150
- </sections>
151
- </standard-document>
130
+ #{BLANK_HDR}
131
+ <sections>
132
+ <clause id='_' inline-header='false' obligation='normative'>
133
+ <title>
134
+ <variant lang='en'>English</variant>
135
+ <variant lang='fr' script='Latn'>Français</variant>
136
+ </title>
137
+ <p id='_'>
138
+ this
139
+ <variant>
140
+ <variant lang='en'>English</variant>
141
+ <variant lang='fr' script='Latn'>Français</variant>
142
+ </variant>
143
+ section is
144
+ <variant>
145
+ <variant lang='en'>silly</variant>
146
+ <variant lang='fr'>fou</variant>
147
+ </variant>
148
+ </p>
149
+ </clause>
150
+ </sections>
151
+ </standard-document>
152
152
  OUTPUT
153
153
  end
154
154
 
155
-
156
- it "processes the Asciidoctor::Standoc concept macros" do
157
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
155
+ it "processes the Asciidoctor::Standoc concept macros" do
156
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
158
157
  #{ASCIIDOC_BLANK_HDR}
159
158
  {{clause1}}
160
159
  {{clause1,w\[o\]rd}}
@@ -179,129 +178,129 @@ RSpec.describe Asciidoctor::Standoc do
179
178
  [bibliography]
180
179
  == Bibliography
181
180
  * [[[blah,blah]]] _Blah_
182
- INPUT
183
- #{BLANK_HDR}
184
- <preface>
185
- <foreword id='_' obligation='informative'>
186
- <title>Foreword</title>
187
- <p id='_'>
188
- <concept>
189
- <xref target='clause1'/>
190
- </concept>
191
- <concept>
192
- <xref target='clause1'>w[o]rd</xref>
193
- </concept>
194
- <concept term='term'>
195
- <xref target='clause1'>w[o]rd</xref>
196
- </concept>
197
- <concept>
198
- <eref/>
199
- </concept>
200
- <concept>
201
- <eref>word</eref>
202
- </concept>
203
- <concept term='term'>
204
- <eref>word</eref>
205
- </concept>
206
- <concept>
207
- <eref>
208
- <localityStack>
209
- <locality type='clause'>
210
- <referenceFrom>3.1</referenceFrom>
211
- </locality>
212
- </localityStack>
213
- </eref>
214
- </concept>
215
- <concept>
216
- <eref>
217
- <localityStack>
218
- <locality type='clause'>
219
- <referenceFrom>3.1</referenceFrom>
220
- </locality>
221
- </localityStack>
222
- word
223
- </eref>
224
- </concept>
225
- <concept term='term'>
226
- <eref>
227
- <localityStack>
228
- <locality type='clause'>
229
- <referenceFrom>3.1</referenceFrom>
230
- </locality>
231
- </localityStack>
232
- word
233
- </eref>
234
- </concept>
235
- <concept>
236
- <eref>
237
- <localityStack>
238
- <locality type='clause'>
239
- <referenceFrom>3.1</referenceFrom>
240
- </locality>
241
- <locality type='figure'>
242
- <referenceFrom>a</referenceFrom>
243
- </locality>
244
- </localityStack>
245
- </eref>
246
- </concept>
247
- <concept>
248
- <eref>
249
- <localityStack>
250
- <locality type='clause'>
251
- <referenceFrom>3.1</referenceFrom>
252
- </locality>
253
- <locality type='figure'>
254
- <referenceFrom>a</referenceFrom>
255
- </locality>
256
- </localityStack>
257
- word
258
- </eref>
259
- </concept>
260
- <concept term='term'>
261
- <eref>
262
- <localityStack>
263
- <locality type='clause'>
264
- <referenceFrom>3.1</referenceFrom>
265
- </locality>
266
- <locality type='figure'>
267
- <referenceFrom>a</referenceFrom>
268
- </locality>
269
- </localityStack>
270
- word
271
- </eref>
272
- </concept>
273
- <concept>
274
- <termref base='IEV' target='135-13-13'/>
275
- </concept>
276
- <concept>
277
- <termref base='IEV' target='135-13-13'>word</termref>
278
- </concept>
279
- <concept term='term'>
280
- <termref base='IEV' target='135-13-13'>word</termref>
281
- </concept>
282
- </p>
283
- </foreword>
284
- </preface>
285
- <sections>
286
- <clause id='clause1' inline-header='false' obligation='normative'>
287
- <title>Clause</title>
288
- <p id='_'>Terms are defined here</p>
289
- </clause>
290
- </sections>
291
- <bibliography>
292
- <references id='_' obligation='informative' normative="false">
293
- <title>Bibliography</title>
294
- <bibitem id='blah'>
295
- <formattedref format='application/x-isodoc+xml'>
296
- <em>Blah</em>
297
- </formattedref>
298
- <docidentifier>blah</docidentifier>
299
- </bibitem>
300
- </references>
301
- </bibliography>
302
- </standard-document>
303
- OUTPUT
304
- end
181
+ INPUT
182
+ #{BLANK_HDR}
183
+ <preface>
184
+ <foreword id='_' obligation='informative'>
185
+ <title>Foreword</title>
186
+ <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>
281
+ </p>
282
+ </foreword>
283
+ </preface>
284
+ <sections>
285
+ <clause id='clause1' inline-header='false' obligation='normative'>
286
+ <title>Clause</title>
287
+ <p id='_'>Terms are defined here</p>
288
+ </clause>
289
+ </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
+ </standard-document>
302
+ OUTPUT
303
+ end
305
304
 
306
305
  it "processes the TODO custom admonition" do
307
306
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -316,141 +315,141 @@ OUTPUT
316
315
  [TODO]
317
316
  Note3
318
317
  INPUT
319
- #{BLANK_HDR}
320
- <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
321
- <p id="_"/>
322
- </review>
323
- <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
324
- <p id="_">Note2</p>
325
- </review>
326
- <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
327
- <p id="_">Note3</p>
328
- </review></sections>
329
- </standard-document>
318
+ #{BLANK_HDR}
319
+ <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
320
+ <p id="_"/>
321
+ </review>
322
+ <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
323
+ <p id="_">Note2</p>
324
+ </review>
325
+ <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
326
+ <p id="_">Note3</p>
327
+ </review></sections>
328
+ </standard-document>
330
329
  OUTPUT
331
330
  end
332
331
 
333
332
  it "generates pseudocode examples, with formatting and initial indentation" do
334
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
335
- #{ASCIIDOC_BLANK_HDR}
333
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
334
+ #{ASCIIDOC_BLANK_HDR}
336
335
 
337
- [pseudocode,subsequence="A",number="3",keep-with-next=true,keep-lines-together=true]
338
- [%unnumbered]
339
- ====
340
- *A* +
341
- [smallcap]#B#
336
+ [pseudocode,subsequence="A",number="3",keep-with-next=true,keep-lines-together=true]
337
+ [%unnumbered]
338
+ ====
339
+ *A* +
340
+ [smallcap]#B#
342
341
 
343
- _C_
344
- ====
345
- INPUT
346
- #{BLANK_HDR}
347
- <sections>
348
- <figure id="_" subsequence='A' class="pseudocode" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true">
349
- <p id="_">  <strong>A</strong><br/>
350
-         <smallcap>B</smallcap></p>
351
- <p id="_">  <em>C</em></p></figure>
352
- </sections>
353
- </standard-document>
354
- OUTPUT
355
- end
342
+ _C_
343
+ ====
344
+ INPUT
345
+ #{BLANK_HDR}
346
+ <sections>
347
+ <figure id="_" subsequence='A' class="pseudocode" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true">
348
+ <p id="_">  <strong>A</strong><br/>
349
+         <smallcap>B</smallcap></p>
350
+ <p id="_">  <em>C</em></p></figure>
351
+ </sections>
352
+ </standard-document>
353
+ OUTPUT
354
+ end
356
355
 
357
- it "supplies line breaks in pseudocode" do
358
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
359
- #{ASCIIDOC_BLANK_HDR}
356
+ it "supplies line breaks in pseudocode" do
357
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
358
+ #{ASCIIDOC_BLANK_HDR}
360
359
 
361
- [pseudocode]
362
- ====
363
- A
364
- B
360
+ [pseudocode]
361
+ ====
362
+ A
363
+ B
365
364
 
366
- D
367
- E
368
- ====
369
- INPUT
370
- #{BLANK_HDR}
371
- <sections>
372
- <figure id='_' class='pseudocode'>
373
- <p id='_'>
374
- A
375
- <br/>
376
- B
377
- </p>
378
- <p id='_'>
379
- D
380
- <br/>
381
- E
382
- </p>
383
- </figure>
384
- </sections>
385
- </standard-document>
386
- OUTPUT
387
- end
365
+ D
366
+ E
367
+ ====
368
+ INPUT
369
+ #{BLANK_HDR}
370
+ <sections>
371
+ <figure id='_' class='pseudocode'>
372
+ <p id='_'>
373
+ A
374
+ <br/>
375
+ B
376
+ </p>
377
+ <p id='_'>
378
+ D
379
+ <br/>
380
+ E
381
+ </p>
382
+ </figure>
383
+ </sections>
384
+ </standard-document>
385
+ OUTPUT
386
+ end
388
387
 
389
- it "skips embedded blocks when supplying line breaks in pseudocode" do
390
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
391
- #{ASCIIDOC_BLANK_HDR}
388
+ it "skips embedded blocks when supplying line breaks in pseudocode" do
389
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
390
+ #{ASCIIDOC_BLANK_HDR}
392
391
 
393
- [pseudocode]
394
- ====
395
- [stem]
396
- ++++
397
- bar X' = (1)/(v) sum_(i = 1)^(v) t_(i)
398
- ++++
399
- ====
400
- INPUT
401
- #{BLANK_HDR}
402
- <sections>
403
- <figure id='_' class='pseudocode'>
404
- <formula id='_'>
405
- <stem type='MathML'>
406
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
407
- <mover accent="true">
408
- <mrow>
409
- <mi>X</mi>
410
- </mrow>
411
- <mo>¯</mo>
412
- </mover>
413
- <mo>′</mo>
414
- <mo>=</mo>
415
- <mfrac>
416
- <mrow>
417
- <mn>1</mn>
418
- </mrow>
419
- <mrow>
420
- <mi>v</mi>
421
- </mrow>
422
- </mfrac>
423
- <munderover>
424
- <mrow>
425
- <mo>∑</mo>
426
- </mrow>
427
- <mrow>
428
- <mrow>
429
- <mi>i</mi>
392
+ [pseudocode]
393
+ ====
394
+ [stem]
395
+ ++++
396
+ bar X' = (1)/(v) sum_(i = 1)^(v) t_(i)
397
+ ++++
398
+ ====
399
+ INPUT
400
+ #{BLANK_HDR}
401
+ <sections>
402
+ <figure id='_' class='pseudocode'>
403
+ <formula id='_'>
404
+ <stem type='MathML'>
405
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
406
+ <mover accent="true">
407
+ <mrow>
408
+ <mi>X</mi>
409
+ </mrow>
410
+ <mo>¯</mo>
411
+ </mover>
412
+ <mo>′</mo>
430
413
  <mo>=</mo>
431
- <mn>1</mn>
432
- </mrow>
433
- </mrow>
434
- <mrow>
435
- <mi>v</mi>
436
- </mrow>
437
- </munderover>
438
- <msub>
439
- <mrow>
440
- <mi>t</mi>
441
- </mrow>
442
- <mrow>
443
- <mi>i</mi>
444
- </mrow>
445
- </msub>
446
- </math>
447
- </stem>
448
- </formula>
449
- </figure>
450
- </sections>
451
- </standard-document>
452
- OUTPUT
453
- end
414
+ <mfrac>
415
+ <mrow>
416
+ <mn>1</mn>
417
+ </mrow>
418
+ <mrow>
419
+ <mi>v</mi>
420
+ </mrow>
421
+ </mfrac>
422
+ <munderover>
423
+ <mrow>
424
+ <mo>∑</mo>
425
+ </mrow>
426
+ <mrow>
427
+ <mrow>
428
+ <mi>i</mi>
429
+ <mo>=</mo>
430
+ <mn>1</mn>
431
+ </mrow>
432
+ </mrow>
433
+ <mrow>
434
+ <mi>v</mi>
435
+ </mrow>
436
+ </munderover>
437
+ <msub>
438
+ <mrow>
439
+ <mi>t</mi>
440
+ </mrow>
441
+ <mrow>
442
+ <mi>i</mi>
443
+ </mrow>
444
+ </msub>
445
+ </math>
446
+ </stem>
447
+ </formula>
448
+ </figure>
449
+ </sections>
450
+ </standard-document>
451
+ OUTPUT
452
+ end
454
453
 
455
454
  it "processes the Ruby markups" do
456
455
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -458,13 +457,13 @@ OUTPUT
458
457
 
459
458
  ruby:楽聖少女[がくせいしょうじょ]
460
459
  INPUT
461
- #{BLANK_HDR}
462
- <sections>
463
- <p id="_">
464
- <ruby>楽聖少女<rp>(</rp><rt>がくせいしょうじょ</rt><rp>)</rp></ruby>
465
- </p>
466
- </sections>
467
- </standard-document>
460
+ #{BLANK_HDR}
461
+ <sections>
462
+ <p id="_">
463
+ <ruby>楽聖少女<rp>(</rp><rt>がくせいしょうじょ</rt><rp>)</rp></ruby>
464
+ </p>
465
+ </sections>
466
+ </standard-document>
468
467
  OUTPUT
469
468
  end
470
469
 
@@ -488,43 +487,43 @@ OUTPUT
488
487
  * C
489
488
  --
490
489
  INPUT
491
- #{BLANK_HDR}
492
- <sections>
493
- <p id="_">
494
- <fn reference='1'>
495
- <table id='_'>
496
- <thead>
497
- <tr>
498
- <th valign='top' align='left'>a</th>
499
- <th valign='top' align='left'>b</th>
500
- </tr>
501
- </thead>
502
- <tbody>
503
- <tr>
504
- <td valign='top' align='left'>c</td>
505
- <td valign='top' align='left'>d</td>
506
- </tr>
507
- </tbody>
508
- </table>
509
- <ul id='_'>
510
- <li>
511
- <p id='_'>A</p>
512
- </li>
513
- <li>
514
- <p id='_'>B</p>
515
- </li>
516
- <li>
517
- <p id='_'>C</p>
518
- </li>
519
- </ul>
520
- </fn>
521
- </p>
522
- </sections>
523
- </standard-document>
490
+ #{BLANK_HDR}
491
+ <sections>
492
+ <p id="_">
493
+ <fn reference='1'>
494
+ <table id='_'>
495
+ <thead>
496
+ <tr>
497
+ <th valign='top' align='left'>a</th>
498
+ <th valign='top' align='left'>b</th>
499
+ </tr>
500
+ </thead>
501
+ <tbody>
502
+ <tr>
503
+ <td valign='top' align='left'>c</td>
504
+ <td valign='top' align='left'>d</td>
505
+ </tr>
506
+ </tbody>
507
+ </table>
508
+ <ul id='_'>
509
+ <li>
510
+ <p id='_'>A</p>
511
+ </li>
512
+ <li>
513
+ <p id='_'>B</p>
514
+ </li>
515
+ <li>
516
+ <p id='_'>C</p>
517
+ </li>
518
+ </ul>
519
+ </fn>
520
+ </p>
521
+ </sections>
522
+ </standard-document>
524
523
  OUTPUT
525
524
  end
526
525
 
527
- it "processes the footnoteblock macro with failed reference" do
526
+ it "processes the footnoteblock macro with failed reference" do
528
527
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
529
528
  #{ASCIIDOC_BLANK_HDR}
530
529
 
@@ -544,49 +543,149 @@ OUTPUT
544
543
  * C
545
544
  --
546
545
  INPUT
547
- #{BLANK_HDR}
546
+ #{BLANK_HDR}
547
+ <sections>
548
+ <p id='_'>
549
+ <fn reference='1'>[ERROR]</fn>
550
+ </p>
551
+ <note id='id2'>
552
+ <table id='_'>
553
+ <thead>
554
+ <tr>
555
+ <th valign='top' align='left'>a</th>
556
+ <th valign='top' align='left'>b</th>
557
+ </tr>
558
+ </thead>
559
+ <tbody>
560
+ <tr>
561
+ <td valign='top' align='left'>c</td>
562
+ <td valign='top' align='left'>d</td>
563
+ </tr>
564
+ </tbody>
565
+ </table>
566
+ <ul id='_'>
567
+ <li>
568
+ <p id='_'>A</p>
569
+ </li>
570
+ <li>
571
+ <p id='_'>B</p>
572
+ </li>
573
+ <li>
574
+ <p id='_'>C</p>
575
+ </li>
576
+ </ul>
577
+ </note>
578
+ </sections>
579
+ </standard-document>
580
+ OUTPUT
581
+ end
582
+
583
+ it "processes input form macros" do
584
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
585
+ #{ASCIIDOC_BLANK_HDR}
586
+
587
+ [form,id=N0,name=N1,action="/action_page.php"]
588
+ --
589
+ label:fname[First name:] +
590
+ input:text[id=fname,name=fname] +
591
+ label:lname[Last name:] +
592
+ input:text[id=lname,name=lname] +
593
+ label:pwd[Password:] +
594
+ input:password[id=pwd,name=pwd] +
595
+ input:radio[id=male,name=gender,value=male]
596
+ label:male[Male] +
597
+ input:radio[id=female,name=gender,value=female]
598
+ label:female[Female] +
599
+ input:radio[id=other,name=gender,value=other]
600
+ label:other[Other] +
601
+ input:checkbox[id=vehicle1,name=vehicle1,value=Bike,checked=true]
602
+ label:vehicle1[I have a bike] +
603
+ input:checkbox[id=vehicle2,name=vehicle2,value=Car]
604
+ label:vehicle2[I have a car] +
605
+ input:checkbox[id=vehicle3,name=vehicle3,value=Boat]
606
+ label:vehicle3[I have a boat] +
607
+ input:date[id=birthday,name=birthday] +
608
+ label:myfile[Select a file:]
609
+ input:file[id=myfile,name=myfile] +
610
+ label:cars[Select a car:] +
611
+ select:[id=cars,name=cars,value=fiat,size=4,disabled=true,multiple=true]
612
+ option:[Volvo,value=volvo,disabled=true]
613
+ option:[Saab,value=saab]
614
+ option:[Fiat,value=fiat]
615
+ option:[Audi,value=audi]
616
+ textarea:[id=t1,name=message,rows=10,cols=30,value="The cat was playing in the garden."]
617
+ input:button[value="Click Me!"]
618
+ input:button[]
619
+ input:submit[value="Submit"]
620
+ --
621
+ INPUT
622
+ #{BLANK_HDR}
548
623
  <sections>
549
- <p id='_'>
550
- <fn reference='1'>[ERROR]</fn>
551
- </p>
552
- <note id='id2'>
553
- <table id='_'>
554
- <thead>
555
- <tr>
556
- <th valign='top' align='left'>a</th>
557
- <th valign='top' align='left'>b</th>
558
- </tr>
559
- </thead>
560
- <tbody>
561
- <tr>
562
- <td valign='top' align='left'>c</td>
563
- <td valign='top' align='left'>d</td>
564
- </tr>
565
- </tbody>
566
- </table>
567
- <ul id='_'>
568
- <li>
569
- <p id='_'>A</p>
570
- </li>
571
- <li>
572
- <p id='_'>B</p>
573
- </li>
574
- <li>
575
- <p id='_'>C</p>
576
- </li>
577
- </ul>
578
- </note>
579
- </sections>
580
- </standard-document>
624
+ <form id='_' name='N1' action='/action_page.php'>
625
+ <p id='_'>
626
+ <label for='fname'>First name:</label>
627
+ <br/>
628
+ <input type='text' id='fname' name='fname'/>
629
+ <br/>
630
+ <label for='lname'>Last name:</label>
631
+ <br/>
632
+ <input type='text' id='lname' name='lname'/>
633
+ <br/>
634
+ <label for='pwd'>Password:</label>
635
+ <br/>
636
+ <input type='password' id='pwd' name='pwd'/>
637
+ <br/>
638
+ <input type='radio' id='male' name='gender' value='male'/>
639
+ <label for='male'>Male</label>
640
+ <br/>
641
+ <input type='radio' id='female' name='gender' value='female'/>
642
+ <label for='female'>Female</label>
643
+ <br/>
644
+ <input type='radio' id='other' name='gender' value='other'/>
645
+ <label for='other'>Other</label>
646
+ <br/>
647
+ <input type='checkbox' id='vehicle1' name='vehicle1' value='Bike' checked='true'/>
648
+ <label for='vehicle1'>I have a bike</label>
649
+ <br/>
650
+ <input type='checkbox' id='vehicle2' name='vehicle2' value='Car'/>
651
+ <label for='vehicle2'>I have a car</label>
652
+ <br/>
653
+ <input type='checkbox' id='vehicle3' name='vehicle3' value='Boat'/>
654
+ <label for='vehicle3'>I have a boat</label>
655
+ <br/>
656
+ <input type='date' id='birthday' name='birthday'/>
657
+ <br/>
658
+ <label for='myfile'>Select a file:</label>
659
+ <input type='file' id='myfile' name='myfile'/>
660
+ <br/>
661
+ <label for='cars'>Select a car:</label>
662
+ <br/>
663
+ <select id='cars' name='cars' size='4' disabled='true' multiple='true' value='fiat'>
664
+ <option disabled='true' value='volvo'/>
665
+ <option value='saab'/>
666
+ <option value='fiat'/>
667
+ <option value='audi'/>
668
+ </select>
669
+ <textarea id='t1' name='message' rows='10' cols='30' value='The cat was playing in the garden.'/>
670
+ <input type='button' value='Click Me!'/>
671
+ <input type='button'/>
672
+ <input type='submit' value='Submit'/>
673
+ </p>
674
+ </form>
675
+ </sections>
676
+ </standard-document>
581
677
  OUTPUT
582
678
  end
583
679
 
584
- describe 'term inline macros' do
680
+ describe "term inline macros" do
585
681
  subject(:convert) do
586
682
  xmlpp(
587
683
  strip_guid(
588
684
  Asciidoctor.convert(
589
- input, backend: :standoc, header_footer: true)))
685
+ input, backend: :standoc, header_footer: true
686
+ )
687
+ )
688
+ )
590
689
  end
591
690
  let(:input) do
592
691
  <<~XML
@@ -625,11 +724,11 @@ OUTPUT
625
724
  XML
626
725
  end
627
726
 
628
- it 'converts macro into the correct xml' do
727
+ it "converts macro into the correct xml" do
629
728
  expect(convert).to(be_equivalent_to(xmlpp(output)))
630
729
  end
631
730
 
632
- context 'default params' do
731
+ context "default params" do
633
732
  let(:input) do
634
733
  <<~XML
635
734
  #{ASCIIDOC_BLANK_HDR}
@@ -668,12 +767,12 @@ OUTPUT
668
767
  XML
669
768
  end
670
769
 
671
- it 'uses `name` as termref name' do
770
+ it "uses `name` as termref name" do
672
771
  expect(convert).to(be_equivalent_to(xmlpp(output)))
673
772
  end
674
773
  end
675
774
 
676
- context 'multiply exising ids in document' do
775
+ context "multiply exising ids in document" do
677
776
  let(:input) do
678
777
  <<~XML
679
778
  #{ASCIIDOC_BLANK_HDR}
@@ -731,12 +830,12 @@ OUTPUT
731
830
  XML
732
831
  end
733
832
 
734
- it 'generates unique ids which do not match existing ids' do
833
+ it "generates unique ids which do not match existing ids" do
735
834
  expect(convert).to(be_equivalent_to(xmlpp(output)))
736
835
  end
737
836
  end
738
837
 
739
- context 'when missing actual ref' do
838
+ context "when missing actual ref" do
740
839
  let(:input) do
741
840
  <<~XML
742
841
  #{ASCIIDOC_BLANK_HDR}
@@ -765,8 +864,8 @@ OUTPUT
765
864
  <title>Terms and definitions</title>
766
865
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
767
866
  <term id='term-name-identity'>
768
- <preferred>name identity</preferred>
769
- </term>
867
+ <preferred>name identity</preferred>
868
+ </term>
770
869
  <term id='name-check'>
771
870
  <preferred>name check</preferred>
772
871
  <definition>
@@ -783,8 +882,7 @@ OUTPUT
783
882
  <xref target='term-name-identity'/>
784
883
  ) is a term
785
884
  </p>
786
- <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
787
- </p>
885
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term</p>
788
886
  </definition>
789
887
  </term>
790
888
  </terms>
@@ -793,11 +891,9 @@ OUTPUT
793
891
  XML
794
892
  end
795
893
 
796
- it 'generates unique ids which do not match existing ids' do
894
+ it "generates unique ids which do not match existing ids" do
797
895
  expect(convert).to(be_equivalent_to(xmlpp(output)))
798
896
  end
799
897
  end
800
-
801
- end
802
-
898
+ end
803
899
  end