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,33 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders keywords" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :docName:
7
+ Author
8
+ :keyword: first_keyword, second_keyword
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 prepTime="2000-01-01T05:00:00Z" version="3" submissionType="IETF">
17
+ <front>
18
+ <title>Document title</title>
19
+ <author fullname="Author">
20
+ </author>
21
+ <date day="1" month="January" year="2000"/>
22
+ <keyword>first_keyword</keyword>
23
+ <keyword>second_keyword</keyword>
24
+ </front><middle>
25
+ <section anchor="_section_1" numbered="false">
26
+ <name>Section 1</name>
27
+ <t>Text</t>
28
+ </section>
29
+ </middle>
30
+ </rfc>
31
+ OUTPUT
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders links" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :docName:
7
+ Author
8
+ :link: http://www.example.com,urn:issn:99999999 item
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 prepTime="2000-01-01T05:00:00Z"
17
+ version="3" submissionType="IETF">
18
+ <link href="http://www.example.com"/>
19
+ <link href="urn:issn:99999999" rel="item"/>
20
+ <front>
21
+ <title>Document title</title>
22
+ <author fullname="Author">
23
+ </author>
24
+ <date day="1" month="January" year="2000"/>
25
+ </front><middle>
26
+ <section anchor="_section_1" numbered="false">
27
+ <name>Section 1</name>
28
+ <t>text</t>
29
+ </section>
30
+ </middle>
31
+ </rfc>
32
+ OUTPUT
33
+ end
34
+ end
@@ -0,0 +1,59 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders a listing block with source attribute, ignoring listing content" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ [[literal-id]]
6
+ .filename.rb
7
+ [source,ruby,src=http://example.com/ruby.rb]
8
+ ----
9
+ def listing(node)
10
+ result = []
11
+ result << "<figure>" if node.parent.context != :example
12
+ end
13
+ ----
14
+ INPUT
15
+ <figure>
16
+ <sourcecode anchor="literal-id" name="filename.rb" type="ruby" src="http://example.com/ruby.rb">
17
+ </sourcecode>
18
+ </figure>
19
+ OUTPUT
20
+ end
21
+
22
+ it "renders a listing block without source attribute" do
23
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
24
+ [[literal-id]]
25
+ .filename.rb
26
+ [source,ruby]
27
+ ----
28
+ def listing(node)
29
+ result = []
30
+ result << "<figure>" if node.parent.context != :example
31
+ end
32
+ ----
33
+ INPUT
34
+ <figure>
35
+ <sourcecode anchor="literal-id" name="filename.rb" type="ruby">
36
+ def listing(node)
37
+ result = []
38
+ result &lt;&lt; "&lt;figure&gt;" if node.parent.context != :example
39
+ end
40
+ </sourcecode>
41
+ </figure>
42
+ OUTPUT
43
+ end
44
+
45
+ it "renders a listing paragraph" do
46
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
47
+ [listing]
48
+ This is an example of a paragraph styled with `listing`.
49
+ Notice that the monospace markup is preserved in the output.
50
+ INPUT
51
+ <figure>
52
+ <sourcecode>
53
+ This is an example of a paragraph styled with `listing`.
54
+ Notice that the monospace markup is preserved in the output.
55
+ </sourcecode>
56
+ </figure>
57
+ OUTPUT
58
+ end
59
+ end
@@ -0,0 +1,51 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders a listing" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ [[literal-id]]
6
+ .filename
7
+ [align=left,alt=alt_text]
8
+ ....
9
+ Literal contents.
10
+ ....
11
+ INPUT
12
+ <figure>
13
+ <artwork anchor="literal-id" align="left" name="filename" type="ascii-art" alt="alt_text">
14
+ Literal contents.
15
+ </artwork>
16
+ </figure>
17
+ OUTPUT
18
+ end
19
+ it "ignores callouts" do
20
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
21
+ [[literal-id]]
22
+ .filename
23
+ [align=left,alt=alt_text]
24
+ ....
25
+ Literal contents.
26
+ ....
27
+ <1> This is a callout
28
+ INPUT
29
+ <figure>
30
+ <artwork anchor="literal-id" align="left" name="filename" type="ascii-art" alt="alt_text">
31
+ Literal contents.
32
+ </artwork>
33
+ </figure>
34
+ OUTPUT
35
+ end
36
+ it "renders stem as a literal" do
37
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
38
+ :stem:
39
+ [stem]
40
+ ++++
41
+ sqrt(4) = 2
42
+ ++++
43
+ INPUT
44
+ <figure>
45
+ <artwork type="ascii-art">
46
+ sqrt(4) = 2
47
+ </artwork>
48
+ </figure>
49
+ OUTPUT
50
+ end
51
+ end
@@ -0,0 +1,168 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders an ordered list" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :docName:
7
+ Author
8
+
9
+ == Section 1
10
+ [[id]]
11
+ [start=3,group=5,arabic,spacing=compact]
12
+ . First
13
+ . Second
14
+ INPUT
15
+ <section anchor="_section_1" numbered="false">
16
+ <name>Section 1</name>
17
+ <ol anchor="id" spacing="compact" start="3" group="5" type="1">
18
+ <li>First</li>
19
+ <li>Second</li>
20
+ </ol>
21
+ </section>
22
+ OUTPUT
23
+ end
24
+ it "ignores anchors on list items" do
25
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
26
+ = Document title
27
+ :docName:
28
+ Author
29
+
30
+ == Section 1
31
+ [[id]]
32
+ [start=3,group=5,arabic,spacing=compact]
33
+ . First
34
+ . [[id1]] Second
35
+ INPUT
36
+ <section anchor="_section_1" numbered="false">
37
+ <name>Section 1</name>
38
+ <ol anchor="id" spacing="compact" start="3" group="5" type="1">
39
+ <li>First</li>
40
+ <li>Second</li>
41
+ </ol>
42
+ </section>
43
+ OUTPUT
44
+ end
45
+ it "renders an ordered list with custom style" do
46
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
47
+ = Document title
48
+ :docName:
49
+ Author
50
+
51
+ == Section 1
52
+ [format="#%d"]
53
+ . First
54
+ . Second
55
+ INPUT
56
+ <section anchor="_section_1" numbered="false">
57
+ <name>Section 1</name>
58
+ <ol type="#%d">
59
+ <li>First</li>
60
+ <li>Second</li>
61
+ </ol>
62
+ </section>
63
+ OUTPUT
64
+ end
65
+ it "renders a nested ordered list" do
66
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
67
+ = Document title
68
+ :docName:
69
+ Author
70
+
71
+ == Section 1
72
+ [[id]]
73
+ [loweralpha]
74
+ . First
75
+ . Second
76
+ [upperalpha]
77
+ .. Third
78
+ .. Fourth
79
+ . Fifth
80
+ . Sixth
81
+ INPUT
82
+ <section anchor="_section_1" numbered="false">
83
+ <name>Section 1</name>
84
+ <ol anchor="id" type="a">
85
+ <li>First</li>
86
+ <li><t>Second</t>
87
+ <ol type="A">
88
+ <li>Third</li>
89
+ <li>Fourth</li>
90
+ </ol>
91
+ </li>
92
+ <li>Fifth</li>
93
+ <li>Sixth</li>
94
+ </ol>
95
+ </section>
96
+ OUTPUT
97
+ end
98
+ it "renders a nested ordered/unordered list" do
99
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
100
+ = Document title
101
+ :docName:
102
+ Author
103
+
104
+ == Section 1
105
+ [[id]]
106
+ [lowerroman]
107
+ . First
108
+ . Second
109
+ ** Third
110
+ ** Fourth
111
+ INPUT
112
+ <section anchor="_section_1" numbered="false">
113
+ <name>Section 1</name>
114
+ <ol anchor="id" type="i">
115
+ <li>First</li>
116
+ <li><t>Second</t>
117
+ <ul>
118
+ <li>Third</li>
119
+ <li>Fourth</li>
120
+ </ul>
121
+ </li>
122
+ </ol>
123
+ </section>
124
+ OUTPUT
125
+ end
126
+ it "renders decimal lists as arabic" do
127
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
128
+ = Document title
129
+ :docName:
130
+ Author
131
+
132
+ == Section 1
133
+ [[id]]
134
+ [decimal]
135
+ . First
136
+ . Second
137
+ INPUT
138
+ <section anchor="_section_1" numbered="false">
139
+ <name>Section 1</name>
140
+ <ol anchor="id" type="1">
141
+ <li>First</li>
142
+ <li>Second</li>
143
+ </ol>
144
+ </section>
145
+ OUTPUT
146
+ end
147
+ it "renders lowergreek lists as arabic" do
148
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
149
+ = Document title
150
+ :docName:
151
+ Author
152
+
153
+ == Section 1
154
+ [[id]]
155
+ [lowergreek]
156
+ . First
157
+ . Second
158
+ INPUT
159
+ <section anchor="_section_1" numbered="false">
160
+ <name>Section 1</name>
161
+ <ol anchor="id" type="1">
162
+ <li>First</li>
163
+ <li>Second</li>
164
+ </ol>
165
+ </section>
166
+ OUTPUT
167
+ end
168
+ end
@@ -0,0 +1,73 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders a paragraph" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :abbrev: abbrev_value
7
+ :docName:
8
+ Author
9
+
10
+ == Section 1
11
+ [[id]]
12
+ [keep-with-next=true, keep-with-previous=true, foo=bar]
13
+ Lorem ipsum.
14
+ INPUT
15
+ <section anchor="_section_1" numbered="false">
16
+ <name>Section 1</name>
17
+ <t anchor="id" keepWithNext="true" keepWithPrevious="true">Lorem ipsum.</t>
18
+ </section>
19
+ OUTPUT
20
+ end
21
+
22
+ it "suppresses smart apostrophes" do
23
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
24
+ = Document title
25
+ :abbrev: abbrev_value
26
+ :docName:
27
+ :smart-quotes: false
28
+ Author
29
+
30
+ == Dante's Revenge
31
+ Don't panic!
32
+ INPUT
33
+ <?xml version="1.0" encoding="US-ASCII"?>
34
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
35
+ <?rfc strict="yes"?>
36
+ <?rfc toc="yes"?>
37
+ <?rfc tocdepth="4"?>
38
+ <?rfc symrefs=""?>
39
+ <?rfc sortrefs=""?>
40
+ <?rfc compact="yes"?>
41
+ <?rfc subcompact="no"?>
42
+ <rfc submissionType="IETF" prepTime="2000-01-01T05:00:00Z" version="3">
43
+ <front>
44
+ <title abbrev="abbrev_value">Document title</title>
45
+ <author fullname="Author"/>
46
+ <date day="1" month="January" year="2000"/>
47
+
48
+ </front><middle>
49
+ <section anchor="_dante_s_revenge" numbered="false">
50
+ <name>Dante's Revenge</name>
51
+ <t>Don't panic!</t>
52
+ </section>
53
+ </rfc>
54
+ OUTPUT
55
+ end
56
+
57
+ it "allows smart apostrophes" do
58
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
59
+ = Document title
60
+ :abbrev: abbrev_value
61
+ :docName:
62
+ Author
63
+
64
+ == Dante's Revenge
65
+ Don't panic!
66
+ INPUT
67
+ <section anchor="_dante_s_revenge" numbered="false">
68
+ <name>Dante&#8217;s Revenge</name>
69
+ <t>Don&#8217;t panic!</t>
70
+ </section>
71
+ OUTPUT
72
+ end
73
+ end
@@ -0,0 +1,112 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders no abstract if preamble has no content" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ Author
7
+ :docName:
8
+
9
+ == Lorem
10
+ Ipsum.
11
+ INPUT
12
+ <?xml version="1.0" encoding="US-ASCII"?>
13
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
14
+
15
+ <rfc prepTime="2000-01-01T05:00:00Z"
16
+ version="3" submissionType="IETF">
17
+ <front>
18
+ <title>Document title</title>
19
+ <author fullname="Author">
20
+ </author>
21
+ <date day="1" month="January" year="2000"/>
22
+ </front><middle>
23
+ <section anchor="_lorem" numbered="false">
24
+ <name>Lorem</name>
25
+ <t>Ipsum.</t>
26
+ </section>
27
+ </middle>
28
+ </rfc>
29
+ OUTPUT
30
+ end
31
+ it "renders preamble contents as abstract" do
32
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
33
+ = Document title
34
+ Author
35
+ :docName:
36
+
37
+ Preamble content.
38
+
39
+ More Preamble content.
40
+
41
+ == Lorem
42
+ Ipsum.
43
+ INPUT
44
+ <?xml version="1.0" encoding="US-ASCII"?>
45
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
46
+
47
+ <rfc prepTime="2000-01-01T05:00:00Z"
48
+ version="3" submissionType="IETF">
49
+ <front>
50
+ <title>Document title</title>
51
+ <author fullname="Author">
52
+ </author>
53
+ <date day="1" month="January" year="2000"/>
54
+ <abstract>
55
+ <t>Preamble content.</t>
56
+ <t>More Preamble content.</t>
57
+ </abstract>
58
+ </front><middle>
59
+ <section anchor="_lorem" numbered="false">
60
+ <name>Lorem</name>
61
+ <t>Ipsum.</t>
62
+ </section>
63
+ </middle>
64
+ </rfc>
65
+ OUTPUT
66
+ end
67
+ it "renders admonitions in preamble as notes" do
68
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
69
+ = Document title
70
+ Author
71
+ :docName:
72
+
73
+ NOTE: This is a note.
74
+
75
+ [NOTE,remove-in-rfc=true]
76
+ .Title of Note
77
+ ====
78
+ This is another note.
79
+ ====
80
+
81
+ == Lorem
82
+ Ipsum.
83
+ INPUT
84
+ <?xml version="1.0" encoding="US-ASCII"?>
85
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
86
+
87
+ <rfc prepTime="2000-01-01T05:00:00Z"
88
+ version="3" submissionType="IETF">
89
+ <front>
90
+ <title>Document title</title>
91
+ <author fullname="Author">
92
+ </author>
93
+ <date day="1" month="January" year="2000"/>
94
+ <note>
95
+ <t>
96
+ This is a note.
97
+ </t>
98
+ </note>
99
+ <note removeInRFC="true">
100
+ <name>Title of Note</name>
101
+ <t>This is another note.</t>
102
+ </note>
103
+ </front><middle>
104
+ <section anchor="_lorem" numbered="false">
105
+ <name>Lorem</name>
106
+ <t>Ipsum.</t>
107
+ </section>
108
+ </middle>
109
+ </rfc>
110
+ OUTPUT
111
+ end
112
+ end