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,91 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders a quote" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ [[verse-id]]
6
+ [quote, attribution="quote attribution", citetitle="http://www.foo.bar"]
7
+ Text
8
+ INPUT
9
+ <blockquote anchor="verse-id" quotedFrom="quote attribution" cite="http://www.foo.bar">
10
+ Text
11
+ </blockquote>
12
+ OUTPUT
13
+ end
14
+
15
+ it "renders a multi-paragraph quote" do
16
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
17
+ [[verse-id]]
18
+ [quote, attribution="quote attribution", citetitle="http://www.foo.bar"]
19
+ ____
20
+ Dennis: Come and see the violence inherent in the system. Help! Help! I'm being repressed!
21
+
22
+ King Arthur: Bloody peasant!
23
+
24
+ Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh? That's what I'm on about! Did you see him repressing me? You saw him, Didn't you?
25
+ ____
26
+ INPUT
27
+ <blockquote anchor="verse-id" quotedFrom="quote attribution" cite="http://www.foo.bar">
28
+ <t>Dennis: Come and see the violence inherent in the system. Help! Help! I&#8217;m being repressed!</t>
29
+ <t>King Arthur: Bloody peasant!</t>
30
+ <t>Dennis: Oh, what a giveaway! Did you hear that? Did you hear that, eh? That&#8217;s what I&#8217;m on about! Did you see him repressing me? You saw him, Didn&#8217;t you?</t>
31
+ </blockquote>
32
+ OUTPUT
33
+ end
34
+
35
+ it "renders a quoted paragraph" do
36
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
37
+ [[verse-id]]
38
+ "I hold it that a little rebellion now and then is a good thing,
39
+ and as necessary in the political world as storms in the physical."
40
+ -- Thomas Jefferson, Papers of Thomas Jefferson: Volume 11
41
+ INPUT
42
+ <blockquote anchor="verse-id" quotedFrom="Thomas Jefferson" cite="Papers of Thomas Jefferson: Volume 11">
43
+ I hold it that a little rebellion now and then is a good thing,
44
+ and as necessary in the political world as storms in the physical.
45
+ </blockquote>
46
+ OUTPUT
47
+ end
48
+
49
+ it "renders a blockquote with internal markup" do
50
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
51
+ > I've got Markdown in my AsciiDoc!
52
+ >
53
+ > * Blockquotes
54
+ > * Headings
55
+ > * Fenced code blocks
56
+ >
57
+ > ....
58
+ > Wha?
59
+ > ....
60
+ >
61
+ > Yep. AsciiDoc and Markdown share a lot of common syntax already.
62
+ INPUT
63
+ <blockquote>
64
+ <t>I&#8217;ve got Markdown in my AsciiDoc!</t>
65
+ <ul>
66
+ <li>Blockquotes</li>
67
+ <li>Headings</li>
68
+ <li>Fenced code blocks</li>
69
+ </ul>
70
+ <figure>
71
+ <artwork type="ascii-art">
72
+ Wha?
73
+ </artwork>
74
+ </figure>
75
+ <t>Yep. AsciiDoc and Markdown share a lot of common syntax already.</t>
76
+ </blockquote>
77
+ OUTPUT
78
+ end
79
+
80
+ it "renders a verse" do
81
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
82
+ [[verse-id]]
83
+ [verse, Carl Sandburg, two lines from the poem Fog]
84
+ The *fog* comes
85
+ on little cat feet.
86
+ INPUT
87
+ <blockquote anchor="verse-id" quotedFrom="Carl Sandburg">The <strong>fog</strong> comes
88
+ on little cat feet.</blockquote>
89
+ OUTPUT
90
+ end
91
+ end
@@ -0,0 +1,147 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders raw RFC XML as references" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ Author
7
+ :doctype: internet-draft
8
+
9
+ == Text
10
+ Text
11
+
12
+ [bibliography]
13
+ == References
14
+ ++++
15
+ <reference anchor='ISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
16
+ <front>
17
+ <title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
18
+ <author>
19
+ <organization>International Organization for Standardization</organization>
20
+ <address>
21
+ <postal>
22
+ <street>BIBC II</street>
23
+ <street>Chemin de Blandonnet 8</street>
24
+ <street>CP 401</street>
25
+ <city>Vernier</city>
26
+ <region>Geneva</region>
27
+ <code>1214</code>
28
+ <country>Switzerland</country>
29
+ </postal>
30
+ <phone>+41 22 749 01 11</phone>
31
+ <email>central@iso.org</email>
32
+ <uri>https://www.iso.org/</uri>
33
+ </address>
34
+ </author>
35
+ <date day='15' month='September' year='2017'/>
36
+ </front>
37
+ </reference>
38
+ ++++
39
+ INPUT
40
+ <section anchor="_text" numbered="false">
41
+ <name>Text</name>
42
+ <t>Text</t>
43
+ </section>
44
+ </middle><back>
45
+ <references anchor="_references">
46
+ <name>References</name>
47
+ <reference anchor='ISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
48
+ <front>
49
+ <title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
50
+ <author>
51
+ <organization>International Organization for Standardization</organization>
52
+ <address>
53
+ <postal>
54
+ <street>BIBC II</street>
55
+ <street>Chemin de Blandonnet 8</street>
56
+ <street>CP 401</street>
57
+ <city>Vernier</city>
58
+ <region>Geneva</region>
59
+ <code>1214</code>
60
+ <country>Switzerland</country>
61
+ </postal>
62
+ <phone>+41 22 749 01 11</phone>
63
+ <email>central@iso.org</email>
64
+ <uri>https://www.iso.org/</uri>
65
+ </address>
66
+ </author>
67
+ <date day='15' month='September' year='2017'/>
68
+ </front>
69
+ </reference>
70
+ </references>
71
+ OUTPUT
72
+ end
73
+
74
+ it "renders raw RFC XML as references, with displayreferences" do
75
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3)).to be_equivalent_to <<~'OUTPUT'
76
+ = Document title
77
+ Author
78
+ :doctype: internet-draft
79
+
80
+ == Text
81
+ Text
82
+
83
+ [bibliography]
84
+ == References
85
+ * [[[xxx,1]]]
86
+ * [[[gof,2]]]
87
+ ++++
88
+ <reference anchor='ISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
89
+ <front>
90
+ <title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
91
+ <author>
92
+ <organization>International Organization for Standardization</organization>
93
+ <address>
94
+ <postal>
95
+ <street>BIBC II</street>
96
+ <street>Chemin de Blandonnet 8</street>
97
+ <street>CP 401</street>
98
+ <city>Vernier</city>
99
+ <region>Geneva</region>
100
+ <code>1214</code>
101
+ <country>Switzerland</country>
102
+ </postal>
103
+ <phone>+41 22 749 01 11</phone>
104
+ <email>central@iso.org</email>
105
+ <uri>https://www.iso.org/</uri>
106
+ </address>
107
+ </author>
108
+ <date day='15' month='September' year='2017'/>
109
+ </front>
110
+ </reference>
111
+ ++++
112
+ INPUT
113
+ <section anchor="_text" numbered="false">
114
+ <name>Text</name>
115
+ <t>Text</t>
116
+ </section>
117
+ <displayreference target="xxx" to="1"/>
118
+ <displayreference target="gof" to="2"/>
119
+ <references anchor="_references">
120
+ <name>References</name>
121
+ <reference anchor='ISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
122
+ <front>
123
+ <title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
124
+ <author>
125
+ <organization>International Organization for Standardization</organization>
126
+ <address>
127
+ <postal>
128
+ <street>BIBC II</street>
129
+ <street>Chemin de Blandonnet 8</street>
130
+ <street>CP 401</street>
131
+ <city>Vernier</city>
132
+ <region>Geneva</region>
133
+ <code>1214</code>
134
+ <country>Switzerland</country>
135
+ </postal>
136
+ <phone>+41 22 749 01 11</phone>
137
+ <email>central@iso.org</email>
138
+ <uri>https://www.iso.org/</uri>
139
+ </address>
140
+ </author>
141
+ <date day='15' month='September' year='2017'/>
142
+ </front>
143
+ </reference>
144
+ </references>
145
+ OUTPUT
146
+ end
147
+ end
@@ -0,0 +1,198 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "renders section with attributes" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :abbrev: abbrev_value
7
+ :docName:
8
+ Author
9
+
10
+ [remove-in-rfc=true,toc=include]
11
+ == Section 1
12
+ Para 1
13
+
14
+ Para 2
15
+ INPUT
16
+ <?xml version="1.0" encoding="US-ASCII"?>
17
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
18
+
19
+ <rfc prepTime="2000-01-01T05:00:00Z"
20
+ version="3" submissionType="IETF">
21
+ <front>
22
+ <title abbrev="abbrev_value">Document title</title>
23
+ <author fullname="Author">
24
+ </author>
25
+ <date day="1" month="January" year="2000"/>
26
+ </front><middle>
27
+ <section anchor="_section_1" removeInRFC="true" toc="include" numbered="false">
28
+ <name>Section 1</name>
29
+ <t>Para 1</t>
30
+ <t>Para 2</t>
31
+ </section>
32
+ </middle>
33
+ </rfc>
34
+ OUTPUT
35
+ end
36
+
37
+ it "renders subsections" do
38
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
39
+ = Document title
40
+ :abbrev: abbrev_value
41
+ :docName:
42
+ Author
43
+
44
+ :sectnums:
45
+ [toc=exclude]
46
+ == Section 1
47
+ Para 1
48
+
49
+ === Subsection 1.1
50
+ Para 1a
51
+
52
+ :sectnums!:
53
+ [toc=default]
54
+
55
+ === Subsection 1.2
56
+ Para 2
57
+
58
+ ==== Subsection 1.2.1
59
+ Para 3
60
+ INPUT
61
+ <?xml version="1.0" encoding="US-ASCII"?>
62
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
63
+
64
+ <rfc prepTime="2000-01-01T05:00:00Z"
65
+ version="3" submissionType="IETF">
66
+ <front>
67
+ <title abbrev="abbrev_value">Document title</title>
68
+ <author fullname="Author">
69
+ </author>
70
+ <date day="1" month="January" year="2000"/>
71
+ </front><middle>
72
+ <section anchor="_section_1" toc="exclude" numbered="true">
73
+ <name>Section 1</name>
74
+ <t>Para 1</t>
75
+ <section anchor="_subsection_1_1" numbered="true">
76
+ <name>Subsection 1.1</name>
77
+ <t>Para 1a</t>
78
+ </section>
79
+ <section anchor="_subsection_1_2" toc="default" numbered="false">
80
+ <name>Subsection 1.2</name>
81
+ <t>Para 2</t>
82
+ <section anchor="_subsection_1_2_1" numbered="false">
83
+ <name>Subsection 1.2.1</name>
84
+ <t>Para 3</t>
85
+ </section>
86
+ </section>
87
+ </section>
88
+ </middle>
89
+ </rfc>
90
+ OUTPUT
91
+ end
92
+
93
+ it "ignores page breaks" do
94
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
95
+ = Document title
96
+ :abbrev: abbrev_value
97
+ :docName:
98
+ Author
99
+
100
+ == Section 1
101
+ Para 1
102
+
103
+ <<<
104
+
105
+ Para 2
106
+ INPUT
107
+ <?xml version="1.0" encoding="US-ASCII"?>
108
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
109
+
110
+ <rfc prepTime="2000-01-01T05:00:00Z"
111
+ version="3" submissionType="IETF">
112
+ <front>
113
+ <title abbrev="abbrev_value">Document title</title>
114
+ <author fullname="Author">
115
+ </author>
116
+ <date day="1" month="January" year="2000"/>
117
+ </front><middle>
118
+ <section anchor="_section_1" numbered="false">
119
+ <name>Section 1</name>
120
+ <t>Para 1</t>
121
+ <t>Para 2</t>
122
+ </section>
123
+ </middle>
124
+ </rfc>
125
+ OUTPUT
126
+ end
127
+
128
+ it "ignores horizontal rules" do
129
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
130
+ = Document title
131
+ :abbrev: abbrev_value
132
+ :docName:
133
+ Author
134
+
135
+ == Section 1
136
+ Para 1
137
+
138
+ '''
139
+
140
+ Para 2
141
+ INPUT
142
+ <?xml version="1.0" encoding="US-ASCII"?>
143
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
144
+
145
+ <rfc prepTime="2000-01-01T05:00:00Z"
146
+ version="3" submissionType="IETF">
147
+ <front>
148
+ <title abbrev="abbrev_value">Document title</title>
149
+ <author fullname="Author">
150
+ </author>
151
+ <date day="1" month="January" year="2000"/>
152
+ </front><middle>
153
+ <section anchor="_section_1" numbered="false">
154
+ <name>Section 1</name>
155
+ <t>Para 1</t>
156
+ <t>Para 2</t>
157
+ </section>
158
+ </middle>
159
+ </rfc>
160
+ OUTPUT
161
+ end
162
+
163
+ it "renders floating titles" do
164
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
165
+ = Document title
166
+ :abbrev: abbrev_value
167
+ :docName:
168
+ Author
169
+
170
+ == Section 1
171
+ Para 1
172
+
173
+ [discrete]
174
+ == Section 2
175
+ Para 2
176
+ INPUT
177
+ <?xml version="1.0" encoding="US-ASCII"?>
178
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
179
+
180
+ <rfc prepTime="2000-01-01T05:00:00Z"
181
+ version="3" submissionType="IETF">
182
+ <front>
183
+ <title abbrev="abbrev_value">Document title</title>
184
+ <author fullname="Author">
185
+ </author>
186
+ <date day="1" month="January" year="2000"/>
187
+ </front><middle>
188
+ <section anchor="_section_1" numbered="false">
189
+ <name>Section 1</name>
190
+ <t>Para 1</t>
191
+ <t><strong>Section 2</strong></t>
192
+ <t>Para 2</t>
193
+ </section>
194
+ </middle>
195
+ </rfc>
196
+ OUTPUT
197
+ end
198
+ end
@@ -0,0 +1,151 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V3::Converter do
3
+ it "sets seriesInfo attributes for Internet Draft" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ Author
7
+ :doctype: internet-draft
8
+ :name: internet-draft-this-is-an-internet-draft-00
9
+ :status: informational
10
+ :intended-series: bcp
11
+ :submission-type: IRTF
12
+
13
+ == Section 1
14
+ Text
15
+ INPUT
16
+ <?xml version="1.0" encoding="US-ASCII"?>
17
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
18
+
19
+ <rfc prepTime="2000-01-01T05:00:00Z"
20
+ version="3" submissionType="IRTF">
21
+ <front>
22
+ <title>Document title</title>
23
+ <seriesInfo name="Internet-Draft" status="informational" stream="IRTF" value="internet-draft-this-is-an-internet-draft-00"/>
24
+ <seriesInfo name="" status="bcp" value="internet-draft-this-is-an-internet-draft-00"/>
25
+ <author fullname="Author">
26
+ </author>
27
+ <date day="1" month="January" year="2000"/>
28
+ </front><middle>
29
+ <section anchor="_section_1" numbered="false">
30
+
31
+ <name>Section 1</name>
32
+
33
+ <t>Text</t>
34
+
35
+ </section>
36
+ </middle>
37
+ </rfc>
38
+ OUTPUT
39
+ end
40
+ it "sets seriesInfo attributes for RFC, with FYI status" do
41
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
42
+ = Document title
43
+ Author
44
+ :doctype: rfc
45
+ :name: 1111
46
+ :status: full-standard
47
+ :intended-series: fyi 1111
48
+ :submission-type: IRTF
49
+
50
+ == Section 1
51
+ Text
52
+ INPUT
53
+ <?xml version="1.0" encoding="US-ASCII"?>
54
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
55
+
56
+ <rfc prepTime="2000-01-01T05:00:00Z"
57
+ version="3" submissionType="IRTF">
58
+ <front>
59
+ <title>Document title</title>
60
+ <seriesInfo name="RFC" status="full-standard" stream="IRTF" value="1111"/>
61
+ <seriesInfo name="" status="fyi" value="1111"/>
62
+ <author fullname="Author">
63
+ </author>
64
+ <date day="1" month="January" year="2000"/>
65
+ </front><middle>
66
+ <section anchor="_section_1" numbered="false">
67
+
68
+ <name>Section 1</name>
69
+
70
+ <t>Text</t>
71
+
72
+ </section>
73
+ </middle>
74
+ </rfc>
75
+ OUTPUT
76
+ end
77
+ it "treats the rfc- prefix on :name: as optional" do
78
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
79
+ = Document title
80
+ Author
81
+ :doctype: rfc
82
+ :name: rfc-1111
83
+ :status: full-standard
84
+ :intended-series: fyi 1111
85
+ :submission-type: IRTF
86
+
87
+ == Section 1
88
+ Text
89
+ INPUT
90
+ <?xml version="1.0" encoding="US-ASCII"?>
91
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
92
+
93
+ <rfc prepTime="2000-01-01T05:00:00Z"
94
+ version="3" submissionType="IRTF">
95
+ <front>
96
+ <title>Document title</title>
97
+ <seriesInfo name="RFC" status="full-standard" stream="IRTF" value="1111"/>
98
+ <seriesInfo name="" status="fyi" value="1111"/>
99
+ <author fullname="Author">
100
+ </author>
101
+ <date day="1" month="January" year="2000"/>
102
+ </front><middle>
103
+ <section anchor="_section_1" numbered="false">
104
+
105
+ <name>Section 1</name>
106
+
107
+ <t>Text</t>
108
+
109
+ </section>
110
+ </middle>
111
+ </rfc>
112
+ OUTPUT
113
+ end
114
+ it "sets seriesInfo attributes for RFC with historic status" do
115
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc3, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
116
+ = Document title
117
+ Author
118
+ :doctype: rfc
119
+ :name: rfc-1111
120
+ :status: full-standard
121
+ :intended-series: historic
122
+ :submission-type: IRTF
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 prepTime="2000-01-01T05:00:00Z"
131
+ version="3" submissionType="IRTF">
132
+ <front>
133
+ <title>Document title</title>
134
+ <seriesInfo name="RFC" status="full-standard" stream="IRTF" value="1111"/>
135
+ <seriesInfo name="" status="historic" value="1111"/>
136
+ <author fullname="Author">
137
+ </author>
138
+ <date day="1" month="January" year="2000"/>
139
+ </front><middle>
140
+ <section anchor="_section_1" numbered="false">
141
+
142
+ <name>Section 1</name>
143
+
144
+ <t>Text</t>
145
+
146
+ </section>
147
+ </middle>
148
+ </rfc>
149
+ OUTPUT
150
+ end
151
+ end