asciidoctor-rfc 0.2.0 → 0.8.0

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +116 -6
  3. data/asciidoctor-rfc.gemspec +15 -1
  4. data/lib/asciidoctor/rfc/common/base.rb +74 -7
  5. data/lib/asciidoctor/rfc/common/front.rb +1 -1
  6. data/lib/asciidoctor/rfc/v2/base.rb +87 -38
  7. data/lib/asciidoctor/rfc/v2/blocks.rb +29 -2
  8. data/lib/asciidoctor/rfc/v2/converter.rb +0 -1
  9. data/lib/asciidoctor/rfc/v2/inline_anchor.rb +2 -8
  10. data/lib/asciidoctor/rfc/v2/lists.rb +7 -4
  11. data/lib/asciidoctor/rfc/v2/table.rb +1 -1
  12. data/lib/asciidoctor/rfc/v3/base.rb +41 -43
  13. data/lib/asciidoctor/rfc/v3/blocks.rb +29 -2
  14. data/lib/asciidoctor/rfc/v3/converter.rb +0 -2
  15. data/lib/asciidoctor/rfc/v3/inline_anchor.rb +2 -6
  16. data/lib/asciidoctor/rfc/version.rb +1 -1
  17. data/spec/asciidoctor/rfc/v2/comments_spec.rb +7 -3
  18. data/spec/asciidoctor/rfc/v2/date_spec.rb +23 -0
  19. data/spec/asciidoctor/rfc/v2/dlist_spec.rb +107 -9
  20. data/spec/asciidoctor/rfc/v2/image_spec.rb +17 -0
  21. data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +12 -0
  22. data/spec/asciidoctor/rfc/v2/listing_spec.rb +22 -0
  23. data/spec/asciidoctor/rfc/v2/literal_spec.rb +22 -2
  24. data/spec/asciidoctor/rfc/v2/preamble_spec.rb +72 -0
  25. data/spec/asciidoctor/rfc/v2/references_spec.rb +3 -1
  26. data/spec/asciidoctor/rfc/v2/table_spec.rb +104 -4
  27. data/spec/asciidoctor/rfc/v2/text_spec.rb +89 -0
  28. data/spec/asciidoctor/rfc/v2/ulist_spec.rb +40 -0
  29. data/spec/asciidoctor/rfc/v3/dlist_spec.rb +103 -1
  30. data/spec/asciidoctor/rfc/v3/image_spec.rb +18 -0
  31. data/spec/asciidoctor/rfc/v3/listing_spec.rb +26 -0
  32. data/spec/asciidoctor/rfc/v3/literal_spec.rb +20 -1
  33. data/spec/asciidoctor/rfc/v3/preamble_spec.rb +150 -0
  34. data/spec/asciidoctor/rfc/v3/references_spec.rb +35 -34
  35. data/spec/asciidoctor/rfc/v3/series_info_spec.rb +39 -0
  36. data/spec/examples/README.adoc +162 -0
  37. data/spec/examples/davies-template-bare-06.adoc +3 -0
  38. data/spec/examples/draft-ietf-core-block-xx.mkd +935 -0
  39. data/spec/examples/draft-ietf-core-block-xx.mkd.adoc +1013 -0
  40. data/spec/examples/draft-ietf-core-block-xx.xml.orig +1251 -0
  41. data/spec/examples/example-v2.adoc +6 -2
  42. data/spec/examples/example-v3.adoc +5 -1
  43. data/spec/examples/hoffmanv2.xml.adoc +247 -0
  44. data/spec/examples/hoffmanv2.xml.orig +339 -0
  45. data/spec/examples/hoffmanv3.xml.orig +346 -0
  46. data/spec/examples/mib-doc-template-xml-06.adoc +5 -1
  47. data/spec/examples/rfc2100.md.adoc +2 -3
  48. data/spec/examples/rfc3514.md.adoc +3 -2
  49. data/spec/examples/rfc5841.md.adoc +1 -1
  50. data/spec/examples/rfc748.md.adoc +7 -6
  51. data/spec/examples/rfc7511.md.adoc +15 -15
  52. data/spec/examples/skel.mkd +32 -0
  53. data/spec/examples/skel.mkd.adoc +50 -0
  54. data/spec/examples/skel.xml.orig +105 -0
  55. data/spec/examples/stupid-s.mkd +569 -0
  56. data/spec/examples/stupid-s.mkd.adoc +771 -0
  57. data/spec/examples/stupid-s.xml.orig +880 -0
  58. data/spec/spec_helper.rb +1 -1
  59. metadata +32 -4
@@ -1,3 +1,5 @@
1
+ require "htmlentities"
2
+
1
3
  module Asciidoctor
2
4
  module RFC::V2
3
5
  module Blocks
@@ -42,6 +44,31 @@ module Asciidoctor
42
44
  ret
43
45
  end
44
46
 
47
+ # stem is treated as literal, but with center alignment
48
+ def stem(node)
49
+ artwork_attributes = {
50
+ align: node.attr("align") || "center",
51
+ type: node.attr("type"),
52
+ name: node.title,
53
+ alt: node.attr("alt"),
54
+ }
55
+
56
+ # NOTE: html escaping is performed by Nokogiri
57
+ artwork_content = node.lines.join("\n")
58
+
59
+ ret = noko do |xml|
60
+ if node.parent.context != :example
61
+ xml.figure do |xml_figure|
62
+ xml_figure.artwork artwork_content, **attr_code(artwork_attributes)
63
+ end
64
+ else
65
+ xml.artwork artwork_content, **attr_code(artwork_attributes)
66
+ end
67
+ end
68
+ ret
69
+ end
70
+
71
+
45
72
  # Syntax:
46
73
  # = Title
47
74
  # Author
@@ -78,7 +105,7 @@ module Asciidoctor
78
105
  title: (node.title.nil? ? "NOTE" : node.title),
79
106
  }
80
107
 
81
- note_contents = [paragraph1(node)].flatten.join("\n")
108
+ note_contents = HTMLEntities.new.decode([paragraph1(node)].flatten.join("\n"))
82
109
 
83
110
  result << noko do |xml|
84
111
  xml.note **attr_code(note_attributes) do |xml_note|
@@ -137,7 +164,7 @@ module Asciidoctor
137
164
  xml.figure **attr_code(figure_attributes) do |xml_figure|
138
165
  node.blocks.each do |b|
139
166
  case b.context
140
- when :listing, :image, :literal
167
+ when :listing, :image, :literal, :stem
141
168
  xml_figure << send(b.context, b).join("\n")
142
169
  seen_artwork = true
143
170
  else
@@ -57,7 +57,6 @@ module Asciidoctor
57
57
  alias_method :inline_menu, :skip
58
58
  alias_method :inline_image, :skip
59
59
 
60
- alias_method :stem, :literal
61
60
  alias_method :quote, :paragraph
62
61
  end
63
62
  end
@@ -37,8 +37,6 @@ module Asciidoctor
37
37
  "[#{target}] (Section #{matched[:section]})"
38
38
  when "bare"
39
39
  matched[:section]
40
- else
41
- "Section #{matched[:section]} of #{target}"
42
40
  end
43
41
  unless matched[:text].empty?
44
42
  xref_contents = "#{xref_contents}: #{matched[:text]}"
@@ -86,16 +84,12 @@ module Asciidoctor
86
84
  end
87
85
  end
88
86
  # NOTE technically node.text should be node.reftext, but subs have already been applied to text
89
- %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
87
+ # %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
88
+ nil
90
89
  end
91
90
 
92
91
  def inline_anchor_ref(node)
93
- # If this is within referencegroup, output as bibanchor anyway
94
- if $processing_reflist
95
- %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
96
- else
97
92
  warn %(asciidoctor: WARNING: anchor "#{node.id}" is not in a place where XML RFC will recognise it as an anchor attribute)
98
- end
99
93
  end
100
94
  end
101
95
  end
@@ -106,7 +106,7 @@ module Asciidoctor
106
106
  # all but last term have empty dd
107
107
  terms.each_with_index do |term, idx|
108
108
  t_attributes = {
109
- hangText: term.text,
109
+ hangText: flatten_rawtext(term.text).join(' '),
110
110
  }
111
111
 
112
112
  if idx < terms.size - 1
@@ -114,13 +114,16 @@ module Asciidoctor
114
114
  else
115
115
  xml_list.t **attr_code(t_attributes) do |xml_t|
116
116
  if !dd.nil?
117
+ if dd.text?
118
+ # This vspace element is extraneous to the RFC XML spec,
119
+ # but is required by IDNITS
120
+ xml_t.vspace({blankLines: "1"}) unless $inline_definition_lists
121
+ xml_t << dd.text
122
+ end
117
123
  if dd.blocks?
118
- xml_t << dd.text if dd.text?
119
124
  # v2 does not support multi paragraph list items;
120
125
  # vspace is used to emulate them
121
126
  xml_t << para_to_vspace(dd.content)
122
- else
123
- xml_t << dd.text
124
127
  end
125
128
  end
126
129
  end
@@ -20,7 +20,7 @@ module Asciidoctor
20
20
  when "none"
21
21
  "none"
22
22
  else
23
- "all"
23
+ "full"
24
24
  end
25
25
 
26
26
  warn "asciidoctor: WARNING: grid=rows attribute is not supported on tables" if node.attr("grid") == "rows"
@@ -33,6 +33,7 @@ module Asciidoctor
33
33
  # If this is present, then BCP14 keywords in boldface are not assumed to be <bcp14> tags. By default they are.
34
34
  $bcp_bold = !(node.attr? "no-rfc-bold-bcp14")
35
35
  $smart_quotes = (node.attr("smart-quotes") != "false")
36
+ $xreftext = {}
36
37
  result = []
37
38
  result << '<?xml version="1.0" encoding="UTF-8"?>'
38
39
 
@@ -89,34 +90,7 @@ module Asciidoctor
89
90
  # Below are generally applicable Processing Instructions (PIs)
90
91
  # that most I-Ds might want to use. (Here they are set differently than
91
92
  # their defaults in xml2rfc v1.32)
92
- rfc_pis = {
93
- # give errors regarding ID-nits and DTD validation
94
- strict: "yes",
95
-
96
- # TOC control
97
- # generate a ToC
98
- toc: node.attr("toc-include") == "false" ? "no" : "yes",
99
-
100
- # the number of levels of subsections in ToC. default: 3
101
- tocdepth: node.attr("toc-depth") || "4",
102
-
103
- # References control
104
-
105
- # use symbolic references tags, i.e, [RFC2119] instead of [1]
106
- symrefs: node.attr("sym-refs"),
107
-
108
- # sort the reference entries alphabetically
109
- sortrefs: node.attr("sort-refs"),
110
-
111
- # Vertical whitespace control
112
- # (using these PIs as follows is recommended by the RFC Editor)
113
-
114
- # do not start each main section on a new page
115
- compact: "yes",
116
-
117
- # keep one blank line between list items
118
- subcompact: "no",
119
- }
93
+ rfc_pis = common_rfc_pis(node)
120
94
 
121
95
  doc.create_internal_subset("rfc", nil, "rfc2629.dtd")
122
96
  rfc_pis.each_pair do |k, v|
@@ -157,12 +131,16 @@ module Asciidoctor
157
131
  end.join
158
132
  end
159
133
 
134
+ BCP_KEYWORDS = [
135
+ 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT',
136
+ 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', 'OPTIONAL'
137
+ ]
160
138
  def inline_quoted(node)
161
139
  noko do |xml|
162
140
  case node.type
163
141
  when :emphasis then xml.em node.text
164
142
  when :strong
165
- if $bcp_bold && node.text =~ /^(MUST|MUST NOT|REQUIRED|SHALL|SHALL NOT|SHOULD|SHOULD NOT|RECOMMENDED|MAY|OPTIONAL)$/
143
+ if $bcp_bold && BCP_KEYWORDS.exist?(node.text)
166
144
  xml.bcp14 node.text
167
145
  else
168
146
  xml.strong node.text
@@ -227,20 +205,20 @@ module Asciidoctor
227
205
  # * [[[ref2]]] Ref
228
206
  def section(node)
229
207
  result = []
230
- if node.attr("style") == "bibliography"
231
- $xreftext = {}
208
+ if node.attr("style") == "bibliography" ||
209
+ node.parent.context == :section && node.parent.attr("style") == "bibliography"
232
210
  $processing_reflist = true
233
211
 
234
- # references_attributes = {
235
- # anchor: node.id,
236
- # }.reject { |_, value| value.nil? }
237
-
238
- # result << noko do |xml|
239
- # xml.references **references_attributes do |references_xml|
240
- # references_xml.name node.title unless node.title.nil?
241
- # node.blocks.each { |b| references_xml << reflist(b).join }
242
- # end
243
- # end
212
+ references_attributes = {
213
+ anchor: node.id,
214
+ }
215
+ =begin
216
+ result << noko do |xml|
217
+ xml.references **attr_code(references_attributes) do |references_xml|
218
+ references_xml.name node.title unless node.title.nil?
219
+ node.blocks.each { |b| references_xml << reflist(b).join }
220
+ end
221
+ end
244
222
 
245
223
  anchor_attribute = node.id.nil? ? nil : " anchor=\"#{node.id}\""
246
224
  result << "<references#{anchor_attribute}>"
@@ -250,6 +228,8 @@ module Asciidoctor
250
228
  node.blocks.each do |b|
251
229
  if b.context == :pass
252
230
  result << reflist(b)
231
+ elsif b.context == :section
232
+ result << node.content
253
233
  elsif b.context == :ulist
254
234
  b.items.each do |i|
255
235
  i.text # we only process the item for its displayreferences
@@ -257,9 +237,27 @@ module Asciidoctor
257
237
  end
258
238
  end
259
239
  result << "</references>"
240
+ =end
241
+ node.blocks.each do |block|
242
+ if block.context == :section
243
+ result << section(block)
244
+ elsif block.context == :pass
245
+ # we are assuming a single contiguous :pass block of XML
246
+ result << noko do |xml|
247
+ xml.references **attr_code(references_attributes) do |xml_references|
248
+ xml_references.name node.title unless node.title.nil?
249
+ xml_references << reflist(block).join
250
+ end
251
+ end
252
+ elsif block.context == :ulist
253
+ block.items.each do |i|
254
+ i.text # we only process the item for its displayreferences
255
+ end
256
+ end
257
+ end
260
258
 
261
- unless $xreftext.empty?
262
- result.unshift($xreftext.keys.map { |k| %(<displayreference target="#{k}" to="#{$xreftext[k]}"/>) })
259
+ unless $xreftext.empty? || $seen_back_matter
260
+ result = result.unshift($xreftext.keys.map { |k| %(<displayreference target="#{k}" to="#{$xreftext[k]}"/>) })
263
261
  end
264
262
  result = result.unshift("</middle><back>") unless $seen_back_matter
265
263
  $processing_reflist = false
@@ -1,3 +1,5 @@
1
+ require "htmlentities"
2
+
1
3
  module Asciidoctor
2
4
  module RFC::V3
3
5
  module Blocks
@@ -40,6 +42,31 @@ module Asciidoctor
40
42
  end
41
43
  end
42
44
 
45
+ # stem is treated as literal, but with center alignment
46
+ def stem(node)
47
+ artwork_attributes = {
48
+ anchor: node.id,
49
+ align: node.attr("align") || "center",
50
+ type: "ascii-art",
51
+ name: node.title,
52
+ alt: node.attr("alt"),
53
+ }
54
+
55
+ # NOTE: html escaping is performed by Nokogiri
56
+ artwork_content = node.lines.join("\n")
57
+
58
+ noko do |xml|
59
+ if node.parent.context != :example
60
+ xml.figure do |xml_figure|
61
+ xml_figure.artwork artwork_content, **attr_code(artwork_attributes)
62
+ end
63
+ else
64
+ xml.artwork artwork_content, **attr_code(artwork_attributes)
65
+ end
66
+ end
67
+ end
68
+
69
+
43
70
  # Syntax:
44
71
  # [[id]]
45
72
  # [quote, attribution, citation info] # citation info limited to URL
@@ -104,7 +131,7 @@ module Asciidoctor
104
131
  result << noko do |xml|
105
132
  xml.note **attr_code(note_attributes) do |xml_note|
106
133
  xml_note.name node.title unless node.title.nil?
107
- xml_note << [paragraph1(node)].flatten.join("\n")
134
+ xml_note << HTMLEntities.new.decode([paragraph1(node)].flatten.join("\n"))
108
135
  end
109
136
  end
110
137
  else
@@ -149,7 +176,7 @@ module Asciidoctor
149
176
  # ====
150
177
  def example(node)
151
178
  node.blocks.each do |b|
152
- unless %i{listing image literal}.include? b.context
179
+ unless %i{listing image literal stem}.include? b.context
153
180
  warn "asciidoctor: WARNING: examples (figures) should only contain listings (sourcecode), images (artwork), or literal (artwork):\n#{b.lines}"
154
181
  end
155
182
  end
@@ -56,8 +56,6 @@ module Asciidoctor
56
56
  alias_method :inline_menu, :skip
57
57
  alias_method :inline_image, :skip
58
58
 
59
- alias_method :stem, :literal
60
-
61
59
  alias_method :inline_callout, :content
62
60
  end
63
61
  end
@@ -74,16 +74,12 @@ module Asciidoctor
74
74
  end
75
75
  end
76
76
  # NOTE technically node.text should be node.reftext, but subs have already been applied to text
77
- %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
77
+ # %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
78
+ nil
78
79
  end
79
80
 
80
81
  def inline_anchor_ref(node)
81
- # If this is within referencegroup, output as bibanchor anyway
82
- if $processing_reflist
83
- %(<bibanchor="#{node.id}">) # will convert to anchor attribute upstream
84
- else
85
82
  warn %(asciidoctor: WARNING: anchor "#{node.id}" is not in a place where XML RFC will recognise it as an anchor attribute)
86
- end
87
83
  end
88
84
  end
89
85
  end
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module RFC
3
- VERSION = "0.2.0".freeze
3
+ VERSION = "0.8.0".freeze
4
4
  end
5
5
  end
@@ -156,7 +156,7 @@ describe Asciidoctor::RFC::V2::Converter do
156
156
 
157
157
 
158
158
  </front><middle>
159
- <section anchor="sect1" title="Section1"><t>Text<cref>Text _Text_ *Text* `Text` ~Text~ ^Text^ http://example.com/[linktext] &lt;&lt;ref&gt;&gt;</cref></t>
159
+ <section anchor="sect1" title="Section1"><t>Text<cref>Text _Text_ *Text* `Text` ~Text~ ^Text^ http://example.com/[linktext] </cref></t>
160
160
 
161
161
  </section>
162
162
  </middle><back>
@@ -208,6 +208,10 @@ describe Asciidoctor::RFC::V2::Converter do
208
208
  . They are allergic to *cinnamon*.
209
209
  . More than two glasses of orange juice in 24 hours makes them howl in harmony with alarms and sirens.
210
210
  . Celery makes them sad.
211
+
212
+ ....
213
+ <tagging>
214
+ ....
211
215
  ====
212
216
  INPUT
213
217
  <?xml version="1.0" encoding="US-ASCII"?>
@@ -236,8 +240,8 @@ describe Asciidoctor::RFC::V2::Converter do
236
240
 
237
241
 
238
242
 
239
- Celery makes them sad.</cref></t>
240
-
243
+ Celery makes them sad.
244
+ &lt;tagging&gt;</cref></t>
241
245
  </section>
242
246
  </middle>
243
247
  </rfc>
@@ -163,4 +163,27 @@ describe Asciidoctor::RFC::V2::Converter do
163
163
  </rfc>
164
164
  OUTPUT
165
165
  end
166
+
167
+ it "supplies today's date if invalid date given" do
168
+ # today's date is frozen at 2000-01-01 by spec_helper
169
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
170
+ = Document title
171
+ :docName:
172
+ :date: fred
173
+ Author
174
+ INPUT
175
+ <?xml version="1.0" encoding="US-ASCII"?>
176
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
177
+
178
+ <rfc
179
+ submissionType="IETF">
180
+ <front>
181
+ <title>Document title</title>
182
+ <author fullname="Author"/>
183
+ <date day="1" month="January" year="2000"/>
184
+ </front><middle>
185
+ </middle>
186
+ </rfc>
187
+ OUTPUT
188
+ end
166
189
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
  describe Asciidoctor::RFC::V2::Converter do
3
- it "renders a description list" do
3
+ it "renders a definition list" do
4
4
  expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
5
5
  = Document title
6
6
  Author
@@ -14,15 +14,74 @@ describe Asciidoctor::RFC::V2::Converter do
14
14
  <section anchor="_section_1" title="Section 1">
15
15
  <t>
16
16
  <list hangIndent="5" style="hanging">
17
- <t hangText="A">B</t>
18
- <t hangText="C">D</t>
17
+ <t hangText="A"><vspace blankLines="1"/>B</t>
18
+ <t hangText="C"><vspace blankLines="1"/>D</t>
19
19
  </list>
20
20
  </t>
21
21
  </section>
22
22
  OUTPUT
23
23
  end
24
24
 
25
- it "renders a description list with empty style" do
25
+ it "renders an inline definition list" do
26
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
27
+ = Document title
28
+ Author
29
+ :inline-definition-list: true
30
+
31
+ == Section 1
32
+ [[id]]
33
+ [hang-indent=5]
34
+ A:: B
35
+ C:: D
36
+ INPUT
37
+ <?xml version="1.0" encoding="US-ASCII"?>
38
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
39
+ <?rfc strict="yes"?>
40
+ <?rfc toc="yes"?>
41
+ <?rfc tocdepth="4"?>
42
+ <?rfc symrefs="yes"?>
43
+ <?rfc sortrefs="yes"?>
44
+ <?rfc compact="yes"?>
45
+ <?rfc subcompact="no"?>
46
+ <rfc submissionType="IETF">
47
+ <front>
48
+ <title>Document title</title>
49
+ <author fullname="Author"/>
50
+ <date day="1" month="January" year="2000"/>
51
+
52
+ </front><middle>
53
+ <section anchor="_section_1" title="Section 1">
54
+ <t>
55
+ <list hangIndent="5" style="hanging">
56
+ <t hangText="A"><vspace blankLines="1"/>B</t>
57
+ <t hangText="C"><vspace blankLines="1"/>D</t>
58
+ </list>
59
+ </t>
60
+ </section>
61
+ </middle>
62
+ </rfc>
63
+ OUTPUT
64
+ end
65
+
66
+ it "ignores formatting on definition list terms" do
67
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
68
+ = Document title
69
+ Author
70
+
71
+ == Section 1
72
+ `A` _2_:: B
73
+ INPUT
74
+ <section anchor="_section_1" title="Section 1">
75
+ <t>
76
+ <list style="hanging">
77
+ <t hangText="A 2"><vspace blankLines="1"/>B</t>
78
+ </list>
79
+ </t>
80
+ </section>
81
+ OUTPUT
82
+ end
83
+
84
+ it "renders a definition list with empty style" do
26
85
  expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
27
86
  = Document title
28
87
  Author
@@ -36,15 +95,15 @@ describe Asciidoctor::RFC::V2::Converter do
36
95
  <section anchor="_section_1" title="Section 1">
37
96
  <t>
38
97
  <list hangIndent="5" style="empty">
39
- <t hangText="A">B</t>
40
- <t hangText="C">D</t>
98
+ <t hangText="A"><vspace blankLines="1"/>B</t>
99
+ <t hangText="C"><vspace blankLines="1"/>D</t>
41
100
  </list>
42
101
  </t>
43
102
  </section>
44
103
  OUTPUT
45
104
  end
46
105
 
47
- it "renders hybrid description list" do
106
+ it "renders hybrid definition list" do
48
107
  expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
49
108
  = Document title
50
109
  Author
@@ -83,6 +142,26 @@ describe Asciidoctor::RFC::V2::Converter do
83
142
  OUTPUT
84
143
  end
85
144
 
145
+ it "renders a definition list with definitions on the next line" do
146
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
147
+ = Document title
148
+ Author
149
+
150
+ == Section 1
151
+ A::
152
+ +
153
+ B
154
+ INPUT
155
+ <section anchor="_section_1" title="Section 1">
156
+ <t>
157
+ <list style="hanging">
158
+ <t hangText="A"><vspace blankLines="1"/>B</t>
159
+ </list>
160
+ </t>
161
+ </section>
162
+ OUTPUT
163
+ end
164
+
86
165
  it "uses vspace to break up multi paragraph list items" do
87
166
  expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
88
167
  = Document title
@@ -98,8 +177,27 @@ describe Asciidoctor::RFC::V2::Converter do
98
177
  <section anchor="_section_1" title="Section 1">
99
178
  <t>
100
179
  <list style="hanging">
101
- <t hangText="Notes">Note 1.<vspace/>Note 2.
102
- <vspace/>Note 3.</t>
180
+ <t hangText="Notes"><vspace blankLines="1"/>Note 1.<vspace blankLines="1"/>Note 2.
181
+ <vspace blankLines="1"/>Note 3.</t>
182
+ </list>
183
+ </t>
184
+ </section>
185
+ OUTPUT
186
+ end
187
+ it "renders definition lists with more definition terms than definitions" do
188
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
189
+ = Document title
190
+ Author
191
+
192
+ == Section 1
193
+ Notes1::
194
+ Notes2:: Definition
195
+ INPUT
196
+ <section anchor="_section_1" title="Section 1">
197
+ <t>
198
+ <list style="hanging">
199
+ <t hangText="Notes1"/>
200
+ <t hangText="Notes2"><vspace blankLines="1"/>Definition</t>
103
201
  </list>
104
202
  </t>
105
203
  </section>