metanorma-standoc 1.8.6 → 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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +5 -3
  4. data/Gemfile.devel +0 -0
  5. data/lib/asciidoctor/standoc/base.rb +41 -36
  6. data/lib/asciidoctor/standoc/biblio.rng +4 -6
  7. data/lib/asciidoctor/standoc/blocks.rb +44 -14
  8. data/lib/asciidoctor/standoc/blocks_notes.rb +41 -24
  9. data/lib/asciidoctor/standoc/cleanup.rb +33 -78
  10. data/lib/asciidoctor/standoc/cleanup_block.rb +77 -62
  11. data/lib/asciidoctor/standoc/cleanup_boilerplate.rb +51 -29
  12. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +1 -0
  13. data/lib/asciidoctor/standoc/cleanup_image.rb +71 -0
  14. data/lib/asciidoctor/standoc/cleanup_maths.rb +37 -28
  15. data/lib/asciidoctor/standoc/cleanup_ref.rb +24 -15
  16. data/lib/asciidoctor/standoc/cleanup_ref_dl.rb +1 -1
  17. data/lib/asciidoctor/standoc/cleanup_reqt.rb +47 -0
  18. data/lib/asciidoctor/standoc/cleanup_section.rb +21 -15
  19. data/lib/asciidoctor/standoc/converter.rb +10 -3
  20. data/lib/asciidoctor/standoc/datamodel/plantuml_renderer.rb +67 -66
  21. data/lib/asciidoctor/standoc/front.rb +35 -18
  22. data/lib/asciidoctor/standoc/front_contributor.rb +5 -5
  23. data/lib/asciidoctor/standoc/inline.rb +1 -1
  24. data/lib/asciidoctor/standoc/isodoc.rng +304 -1
  25. data/lib/asciidoctor/standoc/lists.rb +4 -2
  26. data/lib/asciidoctor/standoc/macros.rb +50 -23
  27. data/lib/asciidoctor/standoc/macros_form.rb +63 -0
  28. data/lib/asciidoctor/standoc/ref.rb +87 -112
  29. data/lib/asciidoctor/standoc/ref_date_id.rb +62 -0
  30. data/lib/asciidoctor/standoc/ref_sect.rb +22 -19
  31. data/lib/asciidoctor/standoc/section.rb +3 -1
  32. data/lib/asciidoctor/standoc/terms.rb +27 -16
  33. data/lib/asciidoctor/standoc/utils.rb +35 -9
  34. data/lib/asciidoctor/standoc/validate.rb +30 -28
  35. data/lib/metanorma-standoc.rb +0 -1
  36. data/lib/metanorma/standoc/version.rb +5 -5
  37. data/metanorma-standoc.gemspec +11 -11
  38. data/spec/asciidoctor/base_spec.rb +78 -8
  39. data/spec/asciidoctor/blocks_spec.rb +832 -727
  40. data/spec/asciidoctor/cleanup_sections_spec.rb +52 -15
  41. data/spec/asciidoctor/cleanup_spec.rb +1860 -1874
  42. data/spec/asciidoctor/inline_spec.rb +272 -273
  43. data/spec/asciidoctor/isobib_cache_spec.rb +406 -358
  44. data/spec/asciidoctor/macros_spec.rb +539 -437
  45. data/spec/asciidoctor/macros_yaml2text_spec.rb +1 -1
  46. data/spec/asciidoctor/refs_spec.rb +135 -7
  47. data/spec/asciidoctor/section_spec.rb +743 -690
  48. data/spec/assets/html-override.css +1 -0
  49. data/spec/assets/word-override.css +1 -0
  50. data/spec/spec_helper.rb +11 -9
  51. data/spec/vcr_cassettes/dated_iso_ref_joint_iso_iec.yml +60 -60
  52. data/spec/vcr_cassettes/isobib_get_123.yml +14 -14
  53. data/spec/vcr_cassettes/isobib_get_123_1.yml +30 -30
  54. data/spec/vcr_cassettes/isobib_get_123_1_fr.yml +42 -42
  55. data/spec/vcr_cassettes/isobib_get_123_2001.yml +15 -15
  56. data/spec/vcr_cassettes/isobib_get_124.yml +15 -15
  57. data/spec/vcr_cassettes/rfcbib_get_rfc8341.yml +14 -14
  58. data/spec/vcr_cassettes/separates_iev_citations_by_top_level_clause.yml +53 -49
  59. metadata +72 -68
  60. data/.rubocop.ribose.yml +0 -66
  61. data/.rubocop.tb.yml +0 -650
  62. data/spec/asciidoctor/macros_lutaml_spec.rb +0 -80
@@ -9,38 +9,44 @@ RSpec.describe Asciidoctor::Standoc do
9
9
  domain:[term1]
10
10
  inherit:[<<ref1>>]
11
11
  autonumber:table[3]
12
+ add:[a <<clause>>] del:[B]
12
13
 
13
14
  [bibliography]
14
15
  == Bibliography
15
16
  * [[[ref1,XYZ 123]]] _Title_
16
17
  INPUT
17
- #{BLANK_HDR}
18
- <preface>
19
- <foreword id='_' obligation='informative'>
20
- <title>Foreword</title>
21
- <admitted>term1</admitted>
22
- <deprecates>term1</deprecates>
23
- <domain>term1</domain>
24
- <inherit>
25
- <eref type='inline' bibitemid='ref1' citeas='XYZ 123'/>
26
- </inherit>
27
- <autonumber type='table'>3</autonumber>
28
- </foreword>
29
- </preface>
30
- <sections> </sections>
31
- <bibliography>
32
- <references id='_' obligation='informative' normative="false">
33
- <title>Bibliography</title>
34
- <bibitem id='ref1'>
35
- <formattedref format='application/x-isodoc+xml'>
36
- <em>Title</em>
37
- </formattedref>
38
- <docidentifier>XYZ 123</docidentifier>
39
- <docnumber>123</docnumber>
40
- </bibitem>
41
- </references>
42
- </bibliography>
43
- </standard-document>
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>
44
50
  OUTPUT
45
51
  end
46
52
 
@@ -61,55 +67,55 @@ RSpec.describe Asciidoctor::Standoc do
61
67
 
62
68
  Text [[id3]]
63
69
  INPUT
64
- #{BLANK_HDR}
65
- <sections>
66
- <p id='_'>
67
- <index-xref also='true'>
68
- <primary>B</primary>
69
- <target>
70
- C
71
- <sub>x</sub>
72
- </target>
73
- </index-xref>
74
- <index-xref also='false'>
75
- <primary>D</primary>
76
- <secondary>
77
- <em>E</em>
78
- </secondary>
79
- <target>F</target>
80
- </index-xref>
81
- <index-xref also='true'>
82
- <primary>G</primary>
83
- <secondary>H</secondary>
84
- <tertiary>I</tertiary>
85
- <target>J</target>
86
- </index-xref>
87
- P
88
- <index to="id2">
89
- <primary>P</primary>
90
- </index>
91
- <em>P</em>
92
- <index to="id3">
93
- <primary>
94
- <em>P</em>
95
- </primary>
96
- </index>
97
- <index to="id3">
98
- <primary>Q</primary>
99
- <secondary>R</secondary>
100
- <tertiary>S</tertiary>
101
- </index>
102
- </p>
103
- <p id='_'>
104
- Text
105
- <bookmark id='id2'/>
106
- </p>
107
- <p id='_'>
108
- Text
109
- <bookmark id='id3'/>
110
- </p>
111
- </sections>
112
- </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>
113
119
  OUTPUT
114
120
  end
115
121
 
@@ -121,34 +127,33 @@ RSpec.describe Asciidoctor::Standoc do
121
127
  this lang:en[English] lang:fr-Latn[Français] section is lang:en[silly] lang:fr[fou]
122
128
 
123
129
  INPUT
124
- #{BLANK_HDR}
125
- <sections>
126
- <clause id='_' inline-header='false' obligation='normative'>
127
- <title>
128
- <variant lang='en'>English</variant>
129
- <variant lang='fr' script='Latn'>Français</variant>
130
- </title>
131
- <p id='_'>
132
- this
133
- <variant>
134
- <variant lang='en'>English</variant>
135
- <variant lang='fr' script='Latn'>Français</variant>
136
- </variant>
137
- section is
138
- <variant>
139
- <variant lang='en'>silly</variant>
140
- <variant lang='fr'>fou</variant>
141
- </variant>
142
- </p>
143
- </clause>
144
- </sections>
145
- </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>
146
152
  OUTPUT
147
153
  end
148
154
 
149
-
150
- it "processes the Asciidoctor::Standoc concept macros" do
151
- 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")
152
157
  #{ASCIIDOC_BLANK_HDR}
153
158
  {{clause1}}
154
159
  {{clause1,w\[o\]rd}}
@@ -173,129 +178,129 @@ RSpec.describe Asciidoctor::Standoc do
173
178
  [bibliography]
174
179
  == Bibliography
175
180
  * [[[blah,blah]]] _Blah_
176
- INPUT
177
- #{BLANK_HDR}
178
- <preface>
179
- <foreword id='_' obligation='informative'>
180
- <title>Foreword</title>
181
- <p id='_'>
182
- <concept>
183
- <xref target='clause1'/>
184
- </concept>
185
- <concept>
186
- <xref target='clause1'>w[o]rd</xref>
187
- </concept>
188
- <concept term='term'>
189
- <xref target='clause1'>w[o]rd</xref>
190
- </concept>
191
- <concept>
192
- <eref/>
193
- </concept>
194
- <concept>
195
- <eref>word</eref>
196
- </concept>
197
- <concept term='term'>
198
- <eref>word</eref>
199
- </concept>
200
- <concept>
201
- <eref>
202
- <localityStack>
203
- <locality type='clause'>
204
- <referenceFrom>3.1</referenceFrom>
205
- </locality>
206
- </localityStack>
207
- </eref>
208
- </concept>
209
- <concept>
210
- <eref>
211
- <localityStack>
212
- <locality type='clause'>
213
- <referenceFrom>3.1</referenceFrom>
214
- </locality>
215
- </localityStack>
216
- word
217
- </eref>
218
- </concept>
219
- <concept term='term'>
220
- <eref>
221
- <localityStack>
222
- <locality type='clause'>
223
- <referenceFrom>3.1</referenceFrom>
224
- </locality>
225
- </localityStack>
226
- word
227
- </eref>
228
- </concept>
229
- <concept>
230
- <eref>
231
- <localityStack>
232
- <locality type='clause'>
233
- <referenceFrom>3.1</referenceFrom>
234
- </locality>
235
- <locality type='figure'>
236
- <referenceFrom>a</referenceFrom>
237
- </locality>
238
- </localityStack>
239
- </eref>
240
- </concept>
241
- <concept>
242
- <eref>
243
- <localityStack>
244
- <locality type='clause'>
245
- <referenceFrom>3.1</referenceFrom>
246
- </locality>
247
- <locality type='figure'>
248
- <referenceFrom>a</referenceFrom>
249
- </locality>
250
- </localityStack>
251
- word
252
- </eref>
253
- </concept>
254
- <concept term='term'>
255
- <eref>
256
- <localityStack>
257
- <locality type='clause'>
258
- <referenceFrom>3.1</referenceFrom>
259
- </locality>
260
- <locality type='figure'>
261
- <referenceFrom>a</referenceFrom>
262
- </locality>
263
- </localityStack>
264
- word
265
- </eref>
266
- </concept>
267
- <concept>
268
- <termref base='IEV' target='135-13-13'/>
269
- </concept>
270
- <concept>
271
- <termref base='IEV' target='135-13-13'>word</termref>
272
- </concept>
273
- <concept term='term'>
274
- <termref base='IEV' target='135-13-13'>word</termref>
275
- </concept>
276
- </p>
277
- </foreword>
278
- </preface>
279
- <sections>
280
- <clause id='clause1' inline-header='false' obligation='normative'>
281
- <title>Clause</title>
282
- <p id='_'>Terms are defined here</p>
283
- </clause>
284
- </sections>
285
- <bibliography>
286
- <references id='_' obligation='informative' normative="false">
287
- <title>Bibliography</title>
288
- <bibitem id='blah'>
289
- <formattedref format='application/x-isodoc+xml'>
290
- <em>Blah</em>
291
- </formattedref>
292
- <docidentifier>blah</docidentifier>
293
- </bibitem>
294
- </references>
295
- </bibliography>
296
- </standard-document>
297
- OUTPUT
298
- 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
299
304
 
300
305
  it "processes the TODO custom admonition" do
301
306
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -310,141 +315,141 @@ OUTPUT
310
315
  [TODO]
311
316
  Note3
312
317
  INPUT
313
- #{BLANK_HDR}
314
- <sections><review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
315
- <p id="_"/>
316
- </review>
317
- <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
318
- <p id="_">Note2</p>
319
- </review>
320
- <review reviewer="(Unknown)" id="_" date="#{Date.today}T00:00:00Z">
321
- <p id="_">Note3</p>
322
- </review></sections>
323
- </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>
324
329
  OUTPUT
325
330
  end
326
331
 
327
332
  it "generates pseudocode examples, with formatting and initial indentation" do
328
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
329
- #{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}
330
335
 
331
- [pseudocode,subsequence="A",number="3",keep-with-next=true,keep-lines-together=true]
332
- [%unnumbered]
333
- ====
334
- *A* +
335
- [smallcap]#B#
336
+ [pseudocode,subsequence="A",number="3",keep-with-next=true,keep-lines-together=true]
337
+ [%unnumbered]
338
+ ====
339
+ *A* +
340
+ [smallcap]#B#
336
341
 
337
- _C_
338
- ====
339
- INPUT
340
- #{BLANK_HDR}
341
- <sections>
342
- <figure id="_" subsequence='A' class="pseudocode" unnumbered="true" number="3" keep-with-next="true" keep-lines-together="true">
343
- <p id="_">  <strong>A</strong><br/>
344
-         <smallcap>B</smallcap></p>
345
- <p id="_">  <em>C</em></p></figure>
346
- </sections>
347
- </standard-document>
348
- OUTPUT
349
- 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
350
355
 
351
- it "supplies line breaks in pseudocode" do
352
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
353
- #{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}
354
359
 
355
- [pseudocode]
356
- ====
357
- A
358
- B
360
+ [pseudocode]
361
+ ====
362
+ A
363
+ B
359
364
 
360
- D
361
- E
362
- ====
363
- INPUT
364
- #{BLANK_HDR}
365
- <sections>
366
- <figure id='_' class='pseudocode'>
367
- <p id='_'>
368
- A
369
- <br/>
370
- B
371
- </p>
372
- <p id='_'>
373
- D
374
- <br/>
375
- E
376
- </p>
377
- </figure>
378
- </sections>
379
- </standard-document>
380
- OUTPUT
381
- 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
382
387
 
383
- it "skips embedded blocks when supplying line breaks in pseudocode" do
384
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
385
- #{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}
386
391
 
387
- [pseudocode]
388
- ====
389
- [stem]
390
- ++++
391
- bar X' = (1)/(v) sum_(i = 1)^(v) t_(i)
392
- ++++
393
- ====
394
- INPUT
395
- #{BLANK_HDR}
396
- <sections>
397
- <figure id='_' class='pseudocode'>
398
- <formula id='_'>
399
- <stem type='MathML'>
400
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
401
- <mover accent="true">
402
- <mrow>
403
- <mi>X</mi>
404
- </mrow>
405
- <mo>¯</mo>
406
- </mover>
407
- <mo>′</mo>
408
- <mo>=</mo>
409
- <mfrac>
410
- <mrow>
411
- <mn>1</mn>
412
- </mrow>
413
- <mrow>
414
- <mi>v</mi>
415
- </mrow>
416
- </mfrac>
417
- <munderover>
418
- <mrow>
419
- <mo>∑</mo>
420
- </mrow>
421
- <mrow>
422
- <mrow>
423
- <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>
424
413
  <mo>=</mo>
425
- <mn>1</mn>
426
- </mrow>
427
- </mrow>
428
- <mrow>
429
- <mi>v</mi>
430
- </mrow>
431
- </munderover>
432
- <msub>
433
- <mrow>
434
- <mi>t</mi>
435
- </mrow>
436
- <mrow>
437
- <mi>i</mi>
438
- </mrow>
439
- </msub>
440
- </math>
441
- </stem>
442
- </formula>
443
- </figure>
444
- </sections>
445
- </standard-document>
446
- OUTPUT
447
- 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
448
453
 
449
454
  it "processes the Ruby markups" do
450
455
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
@@ -452,13 +457,13 @@ OUTPUT
452
457
 
453
458
  ruby:楽聖少女[がくせいしょうじょ]
454
459
  INPUT
455
- #{BLANK_HDR}
456
- <sections>
457
- <p id="_">
458
- <ruby>楽聖少女<rp>(</rp><rt>がくせいしょうじょ</rt><rp>)</rp></ruby>
459
- </p>
460
- </sections>
461
- </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>
462
467
  OUTPUT
463
468
  end
464
469
 
@@ -482,43 +487,43 @@ OUTPUT
482
487
  * C
483
488
  --
484
489
  INPUT
485
- #{BLANK_HDR}
486
- <sections>
487
- <p id="_">
488
- <fn reference='1'>
489
- <table id='_'>
490
- <thead>
491
- <tr>
492
- <th valign='top' align='left'>a</th>
493
- <th valign='top' align='left'>b</th>
494
- </tr>
495
- </thead>
496
- <tbody>
497
- <tr>
498
- <td valign='top' align='left'>c</td>
499
- <td valign='top' align='left'>d</td>
500
- </tr>
501
- </tbody>
502
- </table>
503
- <ul id='_'>
504
- <li>
505
- <p id='_'>A</p>
506
- </li>
507
- <li>
508
- <p id='_'>B</p>
509
- </li>
510
- <li>
511
- <p id='_'>C</p>
512
- </li>
513
- </ul>
514
- </fn>
515
- </p>
516
- </sections>
517
- </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>
518
523
  OUTPUT
519
524
  end
520
525
 
521
- it "processes the footnoteblock macro with failed reference" do
526
+ it "processes the footnoteblock macro with failed reference" do
522
527
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :standoc, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
523
528
  #{ASCIIDOC_BLANK_HDR}
524
529
 
@@ -538,49 +543,149 @@ OUTPUT
538
543
  * C
539
544
  --
540
545
  INPUT
541
- #{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}
542
623
  <sections>
543
- <p id='_'>
544
- <fn reference='1'>[ERROR]</fn>
545
- </p>
546
- <note id='id2'>
547
- <table id='_'>
548
- <thead>
549
- <tr>
550
- <th valign='top' align='left'>a</th>
551
- <th valign='top' align='left'>b</th>
552
- </tr>
553
- </thead>
554
- <tbody>
555
- <tr>
556
- <td valign='top' align='left'>c</td>
557
- <td valign='top' align='left'>d</td>
558
- </tr>
559
- </tbody>
560
- </table>
561
- <ul id='_'>
562
- <li>
563
- <p id='_'>A</p>
564
- </li>
565
- <li>
566
- <p id='_'>B</p>
567
- </li>
568
- <li>
569
- <p id='_'>C</p>
570
- </li>
571
- </ul>
572
- </note>
573
- </sections>
574
- </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>
575
677
  OUTPUT
576
678
  end
577
679
 
578
- describe 'term inline macros' do
680
+ describe "term inline macros" do
579
681
  subject(:convert) do
580
682
  xmlpp(
581
683
  strip_guid(
582
684
  Asciidoctor.convert(
583
- input, backend: :standoc, header_footer: true)))
685
+ input, backend: :standoc, header_footer: true
686
+ )
687
+ )
688
+ )
584
689
  end
585
690
  let(:input) do
586
691
  <<~XML
@@ -619,11 +724,11 @@ OUTPUT
619
724
  XML
620
725
  end
621
726
 
622
- it 'converts macro into the correct xml' do
727
+ it "converts macro into the correct xml" do
623
728
  expect(convert).to(be_equivalent_to(xmlpp(output)))
624
729
  end
625
730
 
626
- context 'default params' do
731
+ context "default params" do
627
732
  let(:input) do
628
733
  <<~XML
629
734
  #{ASCIIDOC_BLANK_HDR}
@@ -662,12 +767,12 @@ OUTPUT
662
767
  XML
663
768
  end
664
769
 
665
- it 'uses `name` as termref name' do
770
+ it "uses `name` as termref name" do
666
771
  expect(convert).to(be_equivalent_to(xmlpp(output)))
667
772
  end
668
773
  end
669
774
 
670
- context 'multiply exising ids in document' do
775
+ context "multiply exising ids in document" do
671
776
  let(:input) do
672
777
  <<~XML
673
778
  #{ASCIIDOC_BLANK_HDR}
@@ -725,12 +830,12 @@ OUTPUT
725
830
  XML
726
831
  end
727
832
 
728
- it 'generates unique ids which do not match existing ids' do
833
+ it "generates unique ids which do not match existing ids" do
729
834
  expect(convert).to(be_equivalent_to(xmlpp(output)))
730
835
  end
731
836
  end
732
837
 
733
- context 'when missing actual ref' do
838
+ context "when missing actual ref" do
734
839
  let(:input) do
735
840
  <<~XML
736
841
  #{ASCIIDOC_BLANK_HDR}
@@ -759,8 +864,8 @@ OUTPUT
759
864
  <title>Terms and definitions</title>
760
865
  <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
761
866
  <term id='term-name-identity'>
762
- <preferred>name identity</preferred>
763
- </term>
867
+ <preferred>name identity</preferred>
868
+ </term>
764
869
  <term id='name-check'>
765
870
  <preferred>name check</preferred>
766
871
  <definition>
@@ -777,8 +882,7 @@ OUTPUT
777
882
  <xref target='term-name-identity'/>
778
883
  ) is a term
779
884
  </p>
780
- <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
781
- </p>
885
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term</p>
782
886
  </definition>
783
887
  </term>
784
888
  </terms>
@@ -787,11 +891,9 @@ OUTPUT
787
891
  XML
788
892
  end
789
893
 
790
- it 'generates unique ids which do not match existing ids' do
894
+ it "generates unique ids which do not match existing ids" do
791
895
  expect(convert).to(be_equivalent_to(xmlpp(output)))
792
896
  end
793
897
  end
794
-
795
- end
796
-
898
+ end
797
899
  end