asciidoctor-rfc 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.oss-guides.rubocop.yml +1077 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +19 -1063
  6. data/.travis.yml +3 -2
  7. data/Guardfile +22 -0
  8. data/README.adoc +1151 -0
  9. data/Rakefile +1 -1
  10. data/asciidoctor-rfc.gemspec +20 -3
  11. data/bin/asciidoctor-rfc2 +15 -0
  12. data/bin/asciidoctor-rfc3 +15 -0
  13. data/bin/rspec +0 -1
  14. data/lib/asciidoctor-rfc.rb +4 -0
  15. data/lib/asciidoctor/rfc/common/base.rb +218 -0
  16. data/lib/asciidoctor/rfc/common/front.rb +120 -0
  17. data/lib/asciidoctor/rfc/v2/base.rb +341 -0
  18. data/lib/asciidoctor/rfc/v2/blocks.rb +192 -0
  19. data/lib/asciidoctor/rfc/v2/converter.rb +64 -0
  20. data/lib/asciidoctor/rfc/v2/front.rb +69 -0
  21. data/lib/asciidoctor/rfc/v2/inline_anchor.rb +102 -0
  22. data/lib/asciidoctor/rfc/v2/lists.rb +134 -0
  23. data/lib/asciidoctor/rfc/v2/table.rb +112 -0
  24. data/lib/asciidoctor/rfc/v2/validate.rb +738 -0
  25. data/lib/asciidoctor/rfc/v2/validate2.rng +716 -0
  26. data/lib/asciidoctor/rfc/v3/base.rb +358 -0
  27. data/lib/asciidoctor/rfc/v3/blocks.rb +203 -0
  28. data/lib/asciidoctor/rfc/v3/converter.rb +64 -0
  29. data/lib/asciidoctor/rfc/v3/front.rb +115 -0
  30. data/lib/asciidoctor/rfc/v3/inline_anchor.rb +90 -0
  31. data/lib/asciidoctor/rfc/v3/lists.rb +190 -0
  32. data/lib/asciidoctor/rfc/v3/svg.rng +9081 -0
  33. data/lib/asciidoctor/rfc/v3/table.rb +65 -0
  34. data/lib/asciidoctor/rfc/v3/validate.rb +2168 -0
  35. data/lib/asciidoctor/rfc/v3/validate.rng +2143 -0
  36. data/lib/asciidoctor/rfc/version.rb +2 -2
  37. data/spec/asciidoctor/rfc/v2/appendix_spec.rb +124 -0
  38. data/spec/asciidoctor/rfc/v2/area_spec.rb +60 -0
  39. data/spec/asciidoctor/rfc/v2/author_spec.rb +444 -0
  40. data/spec/asciidoctor/rfc/v2/comments_spec.rb +316 -0
  41. data/spec/asciidoctor/rfc/v2/crossref_spec.rb +205 -0
  42. data/spec/asciidoctor/rfc/v2/date_spec.rb +166 -0
  43. data/spec/asciidoctor/rfc/v2/dlist_spec.rb +108 -0
  44. data/spec/asciidoctor/rfc/v2/document_spec.rb +161 -0
  45. data/spec/asciidoctor/rfc/v2/example_spec.rb +50 -0
  46. data/spec/asciidoctor/rfc/v2/front_spec.rb +75 -0
  47. data/spec/asciidoctor/rfc/v2/image_spec.rb +81 -0
  48. data/spec/asciidoctor/rfc/v2/indexterm_spec.rb +66 -0
  49. data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +177 -0
  50. data/spec/asciidoctor/rfc/v2/keyword_spec.rb +63 -0
  51. data/spec/asciidoctor/rfc/v2/listing_spec.rb +59 -0
  52. data/spec/asciidoctor/rfc/v2/literal_spec.rb +53 -0
  53. data/spec/asciidoctor/rfc/v2/olist_spec.rb +147 -0
  54. data/spec/asciidoctor/rfc/v2/paragraph_spec.rb +68 -0
  55. data/spec/asciidoctor/rfc/v2/preamble_spec.rb +140 -0
  56. data/spec/asciidoctor/rfc/v2/quote_spec.rb +24 -0
  57. data/spec/asciidoctor/rfc/v2/references_spec.rb +96 -0
  58. data/spec/asciidoctor/rfc/v2/section_spec.rb +260 -0
  59. data/spec/asciidoctor/rfc/v2/sidebar_spec.rb +32 -0
  60. data/spec/asciidoctor/rfc/v2/table_spec.rb +293 -0
  61. data/spec/asciidoctor/rfc/v2/ulist_spec.rb +96 -0
  62. data/spec/asciidoctor/rfc/v2/workgroup_spec.rb +60 -0
  63. data/spec/asciidoctor/rfc/v3/appendix_spec.rb +130 -0
  64. data/spec/asciidoctor/rfc/v3/area_spec.rb +63 -0
  65. data/spec/asciidoctor/rfc/v3/author_spec.rb +540 -0
  66. data/spec/asciidoctor/rfc/v3/comments_spec.rb +308 -0
  67. data/spec/asciidoctor/rfc/v3/crossref_spec.rb +269 -0
  68. data/spec/asciidoctor/rfc/v3/date_spec.rb +149 -0
  69. data/spec/asciidoctor/rfc/v3/dlist_spec.rb +121 -0
  70. data/spec/asciidoctor/rfc/v3/document_spec.rb +109 -0
  71. data/spec/asciidoctor/rfc/v3/example_spec.rb +34 -0
  72. data/spec/asciidoctor/rfc/v3/front_spec.rb +43 -0
  73. data/spec/asciidoctor/rfc/v3/image_spec.rb +81 -0
  74. data/spec/asciidoctor/rfc/v3/indexterm_spec.rb +69 -0
  75. data/spec/asciidoctor/rfc/v3/inline_formatting_spec.rb +319 -0
  76. data/spec/asciidoctor/rfc/v3/keyword_spec.rb +33 -0
  77. data/spec/asciidoctor/rfc/v3/link_spec.rb +34 -0
  78. data/spec/asciidoctor/rfc/v3/listing_spec.rb +59 -0
  79. data/spec/asciidoctor/rfc/v3/literal_spec.rb +51 -0
  80. data/spec/asciidoctor/rfc/v3/olist_spec.rb +168 -0
  81. data/spec/asciidoctor/rfc/v3/paragraph_spec.rb +73 -0
  82. data/spec/asciidoctor/rfc/v3/preamble_spec.rb +112 -0
  83. data/spec/asciidoctor/rfc/v3/quote_spec.rb +91 -0
  84. data/spec/asciidoctor/rfc/v3/references_spec.rb +147 -0
  85. data/spec/asciidoctor/rfc/v3/section_spec.rb +198 -0
  86. data/spec/asciidoctor/rfc/v3/series_info_spec.rb +151 -0
  87. data/spec/asciidoctor/rfc/v3/sidebar_spec.rb +30 -0
  88. data/spec/asciidoctor/rfc/v3/table_spec.rb +275 -0
  89. data/spec/asciidoctor/rfc/v3/ulist_spec.rb +74 -0
  90. data/spec/asciidoctor/rfc/v3/workgroup_spec.rb +33 -0
  91. data/spec/examples/davies-template-bare-06.adoc +361 -0
  92. data/spec/examples/davies-template-bare-06.xml.orig +426 -0
  93. data/spec/examples/example-v2.adoc +181 -0
  94. data/spec/examples/example-v2.xml +675 -0
  95. data/spec/examples/example-v3.adoc +185 -0
  96. data/spec/examples/example-v3.xml +1009 -0
  97. data/spec/examples/mib-doc-template-xml-06.adoc +596 -0
  98. data/spec/examples/mib-doc-template-xml-06.xml.orig +654 -0
  99. data/spec/examples/rfc1149.md +76 -0
  100. data/spec/examples/rfc1149.md.2.xml +94 -0
  101. data/spec/examples/rfc1149.md.3.xml +93 -0
  102. data/spec/examples/rfc1149.md.adoc +65 -0
  103. data/spec/examples/rfc2100.md +149 -0
  104. data/spec/examples/rfc2100.md.2.xml +169 -0
  105. data/spec/examples/rfc2100.md.3.xml +163 -0
  106. data/spec/examples/rfc2100.md.adoc +136 -0
  107. data/spec/examples/rfc3514.md +203 -0
  108. data/spec/examples/rfc3514.md.2.xml +238 -0
  109. data/spec/examples/rfc3514.md.3.xml +258 -0
  110. data/spec/examples/rfc3514.md.adoc +324 -0
  111. data/spec/examples/rfc5841.md +342 -0
  112. data/spec/examples/rfc5841.md.2.xml +393 -0
  113. data/spec/examples/rfc5841.md.3.xml +449 -0
  114. data/spec/examples/rfc5841.md.adoc +414 -0
  115. data/spec/examples/rfc6350.adoc +3499 -0
  116. data/spec/examples/rfc6350.bib +763 -0
  117. data/spec/examples/rfc748.md +79 -0
  118. data/spec/examples/rfc748.md.2.xml +116 -0
  119. data/spec/examples/rfc748.md.3.xml +109 -0
  120. data/spec/examples/rfc748.md.adoc +80 -0
  121. data/spec/examples/rfc7511.md +257 -0
  122. data/spec/examples/rfc7511.md.2.xml +300 -0
  123. data/spec/examples/rfc7511.md.3.xml +347 -0
  124. data/spec/examples/rfc7511.md.adoc +417 -0
  125. data/spec/spec_helper.rb +115 -5
  126. metadata +274 -9
  127. data/.hound.yml +0 -3
  128. data/README.md +0 -84
  129. data/lib/asciidoctor/rfc.rb +0 -7
  130. data/spec/asciidoctor-rfc/.keep +0 -0
@@ -0,0 +1,166 @@
1
+ require "spec_helper"
2
+ require "date"
3
+ describe Asciidoctor::RFC::V2::Converter do
4
+ it "renders the date" do
5
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
6
+ = Document title
7
+ :docName:
8
+ Author
9
+ :revdate: 2070-01-01T00:00:00Z
10
+
11
+ == Section 1
12
+ text
13
+ INPUT
14
+ <?xml version="1.0" encoding="US-ASCII"?>
15
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
16
+
17
+ <rfc
18
+ submissionType="IETF">
19
+ <front>
20
+ <title>Document title</title>
21
+ <author fullname="Author"/>
22
+ <date day="1" month="January" year="2070"/>
23
+ </front><middle>
24
+ <section anchor="_section_1" title="Section 1">
25
+ <t>text</t>
26
+ </section>
27
+ </middle>
28
+ </rfc>
29
+ OUTPUT
30
+ end
31
+
32
+ it "renders the revdate" do
33
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
34
+ = Document title
35
+ :docName:
36
+ Author
37
+ :date: 2000-01-01T05:00:00Z
38
+
39
+ == Section 1
40
+ text
41
+ INPUT
42
+ <?xml version="1.0" encoding="US-ASCII"?>
43
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
44
+
45
+ <rfc
46
+ submissionType="IETF">
47
+ <front>
48
+ <title>Document title</title>
49
+ <author fullname="Author"/>
50
+ <date day="1" month="January" year="2000"/>
51
+ </front><middle>
52
+ <section anchor="_section_1" title="Section 1">
53
+ <t>text</t>
54
+ </section>
55
+ </middle>
56
+ </rfc>
57
+ OUTPUT
58
+ end
59
+
60
+ it "gives precedence to revdate" do
61
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
62
+ = Document title
63
+ :docName:
64
+ Author
65
+ :revdate: 2070-01-01T00:00:00Z
66
+ :date: 2000-01-01T05:00:00Z
67
+
68
+ == Section 1
69
+ text
70
+ INPUT
71
+ <?xml version="1.0" encoding="US-ASCII"?>
72
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
73
+
74
+ <rfc
75
+ submissionType="IETF">
76
+ <front>
77
+ <title>Document title</title>
78
+ <author fullname="Author"/>
79
+ <date day="1" month="January" year="2070"/>
80
+ </front><middle>
81
+ <section anchor="_section_1" title="Section 1">
82
+ <t>text</t>
83
+ </section>
84
+ </middle>
85
+ </rfc>
86
+ OUTPUT
87
+ end
88
+
89
+ it "permits year-only revdate" do
90
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
91
+ = Document title
92
+ :docName:
93
+ Author
94
+ :revdate: 1972
95
+
96
+ == Section 1
97
+ text
98
+ INPUT
99
+ <?xml version="1.0" encoding="US-ASCII"?>
100
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
101
+
102
+ <rfc
103
+ submissionType="IETF">
104
+ <front>
105
+ <title>Document title</title>
106
+ <author fullname="Author"/>
107
+ <date year="1972"/>
108
+ </front><middle>
109
+ <section anchor="_section_1" title="Section 1">
110
+ <t>text</t>
111
+ </section>
112
+ </middle>
113
+ </rfc>
114
+ OUTPUT
115
+ end
116
+
117
+ it "permits year-month revdate" do
118
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
119
+ = Document title
120
+ :docName:
121
+ Author
122
+ :revdate: 1972-06
123
+
124
+ == Section 1
125
+ text
126
+ INPUT
127
+ <?xml version="1.0" encoding="US-ASCII"?>
128
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
129
+
130
+ <rfc
131
+ submissionType="IETF">
132
+ <front>
133
+ <title>Document title</title>
134
+ <author fullname="Author"/>
135
+ <date year="1972" month="June"/>
136
+ </front><middle>
137
+ <section anchor="_section_1" title="Section 1">
138
+ <t>text</t>
139
+ </section>
140
+ </middle>
141
+ </rfc>
142
+ OUTPUT
143
+ end
144
+
145
+ it "supplies today's date if no date given" do
146
+ # today's date is frozen at 2000-01-01 by spec_helper
147
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
148
+ = Document title
149
+ :docName:
150
+ Author
151
+ INPUT
152
+ <?xml version="1.0" encoding="US-ASCII"?>
153
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
154
+
155
+ <rfc
156
+ submissionType="IETF">
157
+ <front>
158
+ <title>Document title</title>
159
+ <author fullname="Author"/>
160
+ <date day="1" month="January" year="2000"/>
161
+ </front><middle>
162
+ </middle>
163
+ </rfc>
164
+ OUTPUT
165
+ end
166
+ end
@@ -0,0 +1,108 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders a description list" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ Author
7
+
8
+ == Section 1
9
+ [[id]]
10
+ [hang-indent=5]
11
+ A:: B
12
+ C:: D
13
+ INPUT
14
+ <section anchor="_section_1" title="Section 1">
15
+ <t>
16
+ <list hangIndent="5" style="hanging">
17
+ <t hangText="A">B</t>
18
+ <t hangText="C">D</t>
19
+ </list>
20
+ </t>
21
+ </section>
22
+ OUTPUT
23
+ end
24
+
25
+ it "renders a description list with empty style" do
26
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
27
+ = Document title
28
+ Author
29
+
30
+ == Section 1
31
+ [[id]]
32
+ [empty,hang-indent=5]
33
+ A:: B
34
+ C:: D
35
+ INPUT
36
+ <section anchor="_section_1" title="Section 1">
37
+ <t>
38
+ <list hangIndent="5" style="empty">
39
+ <t hangText="A">B</t>
40
+ <t hangText="C">D</t>
41
+ </list>
42
+ </t>
43
+ </section>
44
+ OUTPUT
45
+ end
46
+
47
+ it "renders hybrid description list" do
48
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
49
+ = Document title
50
+ Author
51
+
52
+ == Section 1
53
+ Dairy::
54
+ * Milk
55
+ * Eggs
56
+ Bakery::
57
+ * Bread
58
+ Produce::
59
+ * Bananas
60
+ INPUT
61
+ <section anchor="_section_1" title="Section 1">
62
+ <t>
63
+ <list style="hanging">
64
+ <t hangText="Dairy">
65
+ <list style="symbols">
66
+ <t>Milk</t>
67
+ <t>Eggs</t>
68
+ </list>
69
+ </t>
70
+ <t hangText="Bakery">
71
+ <list style="symbols">
72
+ <t>Bread</t>
73
+ </list>
74
+ </t>
75
+ <t hangText="Produce">
76
+ <list style="symbols">
77
+ <t>Bananas</t>
78
+ </list>
79
+ </t>
80
+ </list>
81
+ </t>
82
+ </section>
83
+ OUTPUT
84
+ end
85
+
86
+ it "uses vspace to break up multi paragraph list items" do
87
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
88
+ = Document title
89
+ Author
90
+
91
+ == Section 1
92
+ Notes:: Note 1.
93
+ +
94
+ Note 2.
95
+ +
96
+ Note 3.
97
+ INPUT
98
+ <section anchor="_section_1" title="Section 1">
99
+ <t>
100
+ <list style="hanging">
101
+ <t hangText="Notes">Note 1.<vspace/>Note 2.
102
+ <vspace/>Note 3.</t>
103
+ </list>
104
+ </t>
105
+ </section>
106
+ OUTPUT
107
+ end
108
+ end
@@ -0,0 +1,161 @@
1
+ require "spec_helper"
2
+ require "byebug"
3
+ describe Asciidoctor::RFC::V2::Converter do
4
+ it "renders the minimal document w/ default values" do
5
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
6
+ = Document title
7
+ :docName:
8
+ Author
9
+
10
+ == Section 1
11
+ text
12
+ INPUT
13
+ <?xml version="1.0" encoding="US-ASCII"?>
14
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
15
+
16
+ <rfc
17
+ submissionType="IETF">
18
+ <front>
19
+ <title>Document title</title>
20
+ <author fullname="Author"/>
21
+ <date day="1" month="January" year="2000"/>
22
+ </front><middle>
23
+ <section anchor="_section_1" title="Section 1">
24
+
25
+ <t>text</t>
26
+
27
+ </section>
28
+ </middle>
29
+ </rfc>
30
+ OUTPUT
31
+ end
32
+
33
+ it "renders all document attributes for RFC" do
34
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
35
+ = Document title
36
+ Author
37
+ :name: 1111
38
+ :abbrev: abbrev
39
+ :doctype: rfc
40
+ :ipr: full3978
41
+ :consensus: false
42
+ :obsoletes: 1, 2
43
+ :updates: 10, 11
44
+ :index-include: index_include_value
45
+ :ipr-extract: ipr_extract_value
46
+ :submission-type: IRTF
47
+ :status: info
48
+ :series-no: 12
49
+ :xml-lang: en
50
+
51
+ [[ipr_extract_value]]
52
+ == Section 1
53
+ Text
54
+ INPUT
55
+ <?xml version="1.0" encoding="US-ASCII"?>
56
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
57
+
58
+ <rfc ipr="full3978" obsoletes="1, 2" updates="10, 11" category="info" consensus="no" submissionType="IRTF" iprExtract="ipr_extract_value" number="1111" seriesNo="12" xml:lang="en">
59
+ <front>
60
+
61
+ <title abbrev="abbrev">Document title</title>
62
+
63
+ <author fullname="Author"/>
64
+
65
+ <date day="1" month="January" year="2000"/>
66
+
67
+
68
+ </front><middle>
69
+ <section anchor="ipr_extract_value" title="Section 1">
70
+
71
+ <t>Text</t>
72
+
73
+ </section>
74
+ </middle>
75
+ </rfc>
76
+ OUTPUT
77
+ end
78
+
79
+ it "renders all document attributes for Internet Draft" do
80
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
81
+ = Document title
82
+ Author
83
+ :name: draft-03-draft
84
+ :abbrev: abbrev
85
+ :doctype: internet-draft
86
+ :ipr: full3978
87
+ :consensus: false
88
+ :obsoletes: 1, 2
89
+ :updates: 10, 11
90
+ :ipr-extract: ipr_extract_value
91
+ :submission-type: IRTF
92
+ :status: info
93
+ :series-no: 12
94
+ :xml-lang: en
95
+
96
+ [[ipr_extract_value]]
97
+ == Section 1
98
+ Text
99
+ INPUT
100
+ <?xml version="1.0" encoding="US-ASCII"?>
101
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
102
+
103
+ <rfc ipr="full3978" obsoletes="1, 2" updates="10, 11" category="info" consensus="no" submissionType="IRTF" iprExtract="ipr_extract_value" docName="draft-03-draft" seriesNo="12" xml:lang="en">
104
+ <front>
105
+
106
+ <title abbrev="abbrev">Document title</title>
107
+
108
+ <author fullname="Author"/>
109
+
110
+ <date day="1" month="January" year="2000"/>
111
+
112
+
113
+ </front><middle>
114
+ <section anchor="ipr_extract_value" title="Section 1">
115
+
116
+ <t>Text</t>
117
+
118
+ </section>
119
+ </middle>
120
+ </rfc>
121
+ OUTPUT
122
+ end
123
+
124
+ it "renders back matter" do
125
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
126
+ = Document title
127
+ :docName:
128
+ Author
129
+
130
+ == Section 1
131
+ Text
132
+
133
+ [appendix]
134
+ == Appendix
135
+ Lipsum.
136
+ INPUT
137
+ <?xml version="1.0" encoding="US-ASCII"?>
138
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
139
+
140
+ <rfc submissionType="IETF">
141
+ <front>
142
+ <title>Document title</title>
143
+ <author fullname="Author"/>
144
+ <date day="1" month="January" year="2000"/>
145
+ </front><middle>
146
+ <section anchor="_section_1" title="Section 1">
147
+
148
+ <t>Text</t>
149
+
150
+ </section>
151
+ </middle><back>
152
+ <section anchor="_appendix" title="Appendix">
153
+
154
+ <t>Lipsum.</t>
155
+
156
+ </section>
157
+ </back>
158
+ </rfc>
159
+ OUTPUT
160
+ end
161
+ end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders a maximal example" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
5
+ [[id]]
6
+ .Figure 1
7
+ [align=left,alt=Alt Text,suppress-title=true]
8
+ ====
9
+ [[id2]]
10
+ .figure1.txt
11
+ ....
12
+ Figures are only permitted to contain listings (sourcecode), images (artwork), or literal (artwork)
13
+ ....
14
+ ====
15
+ INPUT
16
+ <figure anchor="id" align="left" alt="Alt Text" title="Figure 1" suppress-title="true">
17
+ <artwork name="figure1.txt">
18
+ Figures are only permitted to contain listings (sourcecode), images (artwork), or literal (artwork)
19
+ </artwork>
20
+ </figure>
21
+ OUTPUT
22
+ end
23
+
24
+ it "renders preambles and postambles in example" do
25
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
26
+ ====
27
+ Preamble text
28
+
29
+ .figure1.txt
30
+ ....
31
+ Figures are only permitted to contain listings (sourcecode), images (artwork), or literal (artwork)
32
+ ....
33
+
34
+ Postamble text
35
+ ====
36
+ INPUT
37
+ <figure>
38
+ <preamble>
39
+ Preamble text
40
+ </preamble>
41
+ <artwork name="figure1.txt">
42
+ Figures are only permitted to contain listings (sourcecode), images (artwork), or literal (artwork)
43
+ </artwork>
44
+ <postamble>
45
+ Postamble text
46
+ </postamble>
47
+ </figure>
48
+ OUTPUT
49
+ end
50
+ end