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,75 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders author, date, area, workgroup, keyword in sequence" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ Author
7
+ :abbrev: abbrev_value
8
+ :name: rfc-1111
9
+ :revdate: 1999-01-01
10
+ :area: horticulture
11
+ :workgroup: IETF
12
+ :keyword: widgets
13
+
14
+ == Section 1
15
+ text
16
+ INPUT
17
+ <?xml version="1.0" encoding="US-ASCII"?>
18
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
19
+
20
+ <rfc
21
+ submissionType="IETF" docName="rfc-1111">
22
+ <front>
23
+ <title abbrev="abbrev_value">Document title</title>
24
+ <author fullname="Author"/>
25
+ <date day="1" month="January" year="1999"/>
26
+ <area>horticulture</area>
27
+ <workgroup>IETF</workgroup>
28
+ <keyword>widgets</keyword>
29
+ </front><middle>
30
+ <section anchor="_section_1" title="Section 1">
31
+
32
+ <t>text</t>
33
+
34
+ </section>
35
+ </middle>
36
+ </rfc>
37
+ OUTPUT
38
+ end
39
+ it "deals with entities in titles" do
40
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
41
+ = Document on the derivation of x & y < z
42
+ Author
43
+ :abbrev: deriv x & y < z
44
+ :name: rfc-1111
45
+ :revdate: 1999-01-01
46
+ :area: horticulture
47
+ :workgroup: IETF
48
+ :keyword: widgets
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
57
+ submissionType="IETF" docName="rfc-1111">
58
+ <front>
59
+ <title abbrev="deriv x &amp; y &lt; z">Document on the derivation of x &amp; y &lt; z</title>
60
+ <author fullname="Author"/>
61
+ <date day="1" month="January" year="1999"/>
62
+ <area>horticulture</area>
63
+ <workgroup>IETF</workgroup>
64
+ <keyword>widgets</keyword>
65
+ </front><middle>
66
+ <section anchor="_section_1" title="Section 1">
67
+
68
+ <t>text</t>
69
+
70
+ </section>
71
+ </middle>
72
+ </rfc>
73
+ OUTPUT
74
+ end
75
+ end
@@ -0,0 +1,81 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders an image with block attributes" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
5
+ [[id]]
6
+ .Title
7
+ [align=center,alt=alt_text,type=img/jpeg]
8
+ image::http:://www.example/org/filename.jpg[]
9
+ INPUT
10
+ <figure>
11
+ <artwork name="Title" align="center" alt="alt_text" type="img/jpeg" src="http:://www.example/org/filename.jpg"/>
12
+ </figure>
13
+ OUTPUT
14
+ end
15
+ it "renders an image with macro attributes" do
16
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
17
+ [[id]]
18
+ .Title
19
+ image::http:://www.example/org/filename.jpg[alt_text,300,200]
20
+ INPUT
21
+ <figure>
22
+ <artwork name="Title" alt="alt_text" src="http:://www.example/org/filename.jpg" width="300" height="200"/>
23
+ </figure>
24
+ OUTPUT
25
+ end
26
+ it "skips inline images" do
27
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
28
+ You should click image:play.jpg[Sunset] to continue.
29
+ INPUT
30
+ <t>You should click to continue.</t>
31
+ OUTPUT
32
+ end
33
+ it "skips keyboard shortcuts" do
34
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
35
+ :experimental:
36
+ You should click kbd:[F11] to continue.
37
+ INPUT
38
+ <t>You should click to continue.</t>
39
+ OUTPUT
40
+ end
41
+ it "skips menu selections" do
42
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
43
+ :experimental:
44
+ You should click menu:View[Zoom > Reset] to continue.
45
+ INPUT
46
+ <t>You should click to continue.</t>
47
+ OUTPUT
48
+ end
49
+ it "skips UI buttons" do
50
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
51
+ :experimental:
52
+ You should click btn:[OK] to continue.
53
+ INPUT
54
+ <t>You should click to continue.</t>
55
+ OUTPUT
56
+ end
57
+ it "skips audio" do
58
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
59
+ Text
60
+
61
+ audio::ocean_waves.mp3[options="autoplay,loop"]
62
+
63
+ Text
64
+ INPUT
65
+ <t>Text</t>
66
+ <t>Text</t>
67
+ OUTPUT
68
+ end
69
+ it "skips video" do
70
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
71
+ Text
72
+
73
+ video::video_file.mp4[width=640, start=60, end=140, options=autoplay]
74
+
75
+ Text
76
+ INPUT
77
+ <t>Text</t>
78
+ <t>Text</t>
79
+ OUTPUT
80
+ end
81
+ end
@@ -0,0 +1,66 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders index" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :abbrev: abbrev_value
7
+ :docName:
8
+ Author
9
+
10
+ == Section 1
11
+ This ((indexterm))
12
+ is visible in the text,
13
+ this one is not (((indexterm, index-subterm))).
14
+ INPUT
15
+ <?xml version="1.0" encoding="US-ASCII"?>
16
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
17
+
18
+ <rfc
19
+ submissionType="IETF">
20
+ <front>
21
+ <title abbrev="abbrev_value">Document title</title>
22
+ <author fullname="Author"/>
23
+ <date day="1" month="January" year="2000"/>
24
+ </front><middle>
25
+ <section anchor="_section_1" title="Section 1">
26
+ <t>This indexterm<iref item="indexterm"/>
27
+ is visible in the text,
28
+ this one is not <iref item="indexterm" subitem="index-subterm"/>.</t>
29
+ </section>
30
+ </middle>
31
+ </rfc>
32
+ OUTPUT
33
+ end
34
+
35
+ it "does not render tertiary index terms" do
36
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
37
+ = Document title
38
+ :abbrev: abbrev_value
39
+ :docName:
40
+ Author
41
+
42
+ == Section 1
43
+ This ((indexterm))
44
+ is visible in the text,
45
+ this one with a tertiary term is not (((indexterm, index-subterm, index-subsubterm))).
46
+ INPUT
47
+ <?xml version="1.0" encoding="US-ASCII"?>
48
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
49
+
50
+ <rfc
51
+ submissionType="IETF">
52
+ <front>
53
+ <title abbrev="abbrev_value">Document title</title>
54
+ <author fullname="Author"/>
55
+ <date day="1" month="January" year="2000"/>
56
+ </front><middle>
57
+ <section anchor="_section_1" title="Section 1">
58
+ <t>This indexterm<iref item="indexterm"/>
59
+ is visible in the text,
60
+ this one with a tertiary term is not <iref item="indexterm" subitem="index-subterm"/>.</t>
61
+ </section>
62
+ </middle>
63
+ </rfc>
64
+ OUTPUT
65
+ end
66
+ end
@@ -0,0 +1,177 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "treats bcp14 macro in v2 as <strong>" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
5
+ = Document title
6
+ :abbrev: abbrev_value
7
+ :docName:
8
+ Author
9
+
10
+ == Section 1
11
+ This [bcp14]#must not# stand
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 abbrev="abbrev_value">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
+ <t>This <spanx style="strong">MUST NOT</spanx> stand</t>
25
+ </section>
26
+ </middle>
27
+ </rfc>
28
+ OUTPUT
29
+ end
30
+
31
+ it "respects Asciidoctor inline formatting" do
32
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
33
+ = Document title
34
+ :abbrev: abbrev_value
35
+ :docName:
36
+ Author
37
+
38
+ == Section 1
39
+ _Text_ *Text* `Text` "`Text`" '`Text`' ^Superscript^ ~Subscript~
40
+ INPUT
41
+ <?xml version="1.0" encoding="US-ASCII"?>
42
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
43
+
44
+ <rfc
45
+ submissionType="IETF">
46
+ <front>
47
+ <title abbrev="abbrev_value">Document title</title>
48
+ <author fullname="Author"/>
49
+ <date day="1" month="January" year="2000"/>
50
+ </front><middle>
51
+ <section anchor="_section_1" title="Section 1">
52
+ <t><spanx style="emph">Text</spanx> <spanx style="strong">Text</spanx> <spanx style="verb">Text</spanx> &#8220;Text&#8221; &#8216;Text&#8217; ^Superscript^ _Subscript_</t>
53
+ </section>
54
+ </middle>
55
+ </rfc>
56
+ OUTPUT
57
+ end
58
+
59
+ it "allows suppression of smart quotes" do
60
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
61
+ = Document title
62
+ :abbrev: abbrev_value
63
+ :docName:
64
+ :smart-quotes: false
65
+ Author
66
+
67
+ == Section 1
68
+ "`Text`" '`Text`'
69
+ INPUT
70
+ <?xml version="1.0" encoding="US-ASCII"?>
71
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
72
+
73
+ <rfc
74
+ submissionType="IETF">
75
+ <front>
76
+ <title abbrev="abbrev_value">Document title</title>
77
+ <author fullname="Author"/>
78
+ <date day="1" month="January" year="2000"/>
79
+ </front><middle>
80
+ <section anchor="_section_1" title="Section 1">
81
+ <t>"Text" 'Text'</t>
82
+ </section>
83
+ </middle>
84
+ </rfc>
85
+ OUTPUT
86
+ end
87
+
88
+ it "renders stem as literal" do
89
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
90
+ = Document title
91
+ :abbrev: abbrev_value
92
+ :docName:
93
+ Author
94
+ :stem:
95
+
96
+ == Section 1
97
+ stem:[sqrt(4) = 2]
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 abbrev="abbrev_value">Document title</title>
106
+ <author fullname="Author"/>
107
+ <date day="1" month="January" year="2000"/>
108
+ </front><middle>
109
+ <section anchor="_section_1" title="Section 1">
110
+ <t>sqrt(4) = 2</t>
111
+ </section>
112
+ </middle>
113
+ </rfc>
114
+ OUTPUT
115
+ end
116
+ it "deals with non-Ascii characters" do
117
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
118
+ = Document title
119
+ :abbrev: abbrev_value
120
+ :docName:
121
+ Author
122
+
123
+ == Section 1
124
+ Hello René! Hello Владимир!
125
+
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 abbrev="abbrev_value">Document title</title>
134
+ <author fullname="Author"/>
135
+ <date day="1" month="January" year="2000"/>
136
+ </front><middle>
137
+ <section anchor="_section_1" title="Section 1">
138
+ <t>Hello Ren&#233;! Hello &#1042;&#1083;&#1072;&#1076;&#1080;&#1084;&#1080;&#1088;!</t>
139
+ </section>
140
+ </middle>
141
+ </rfc>
142
+ OUTPUT
143
+ end
144
+ it "deals with HTML entities" do
145
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
146
+ = Document title
147
+ :abbrev: abbrev_value
148
+ :docName:
149
+ Author
150
+
151
+ == Section 1
152
+ Hello &lt;&nbsp;(&amp;lt;)
153
+
154
+ == Section 2
155
+ Hello &lt;&nbsp;(&amp;lt;)
156
+ INPUT
157
+ <?xml version="1.0" encoding="US-ASCII"?>
158
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
159
+
160
+ <rfc
161
+ submissionType="IETF">
162
+ <front>
163
+ <title abbrev="abbrev_value">Document title</title>
164
+ <author fullname="Author"/>
165
+ <date day="1" month="January" year="2000"/>
166
+ </front><middle>
167
+ <section anchor="_section_1" title="Section 1">
168
+ <t>Hello &lt;&#160;(&amp;lt;)</t>
169
+ </section>
170
+ <section anchor="_section_2" title="Section 2">
171
+ <t>Hello &lt;&#160;(&amp;lt;)</t>
172
+ </section>
173
+ </middle>
174
+ </rfc>
175
+ OUTPUT
176
+ end
177
+ end
@@ -0,0 +1,63 @@
1
+ require "spec_helper"
2
+ describe Asciidoctor::RFC::V2::Converter do
3
+ it "renders keywords" do
4
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, 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
17
+ submissionType="IETF">
18
+ <front>
19
+ <title>Document title</title>
20
+ <author fullname="Author"/>
21
+ <date day="1" month="January" year="2000"/>
22
+ <keyword>first_keyword</keyword><keyword>second_keyword</keyword>
23
+ </front><middle>
24
+ <section anchor="_section_1" title="Section 1">
25
+
26
+ <t>text</t>
27
+
28
+ </section>
29
+ </middle>
30
+ </rfc>
31
+ OUTPUT
32
+ end
33
+ it "deals with entities in keywords" do
34
+ expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
35
+ = Document title
36
+ :docName:
37
+ Author
38
+ :keyword: first_keyword & second_keyword
39
+
40
+ == Section 1
41
+ text
42
+ INPUT
43
+ <?xml version="1.0" encoding="US-ASCII"?>
44
+ <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
45
+
46
+ <rfc
47
+ submissionType="IETF">
48
+ <front>
49
+ <title>Document title</title>
50
+ <author fullname="Author"/>
51
+ <date day="1" month="January" year="2000"/>
52
+ <keyword>first_keyword &amp; second_keyword</keyword>
53
+ </front><middle>
54
+ <section anchor="_section_1" title="Section 1">
55
+
56
+ <t>text</t>
57
+
58
+ </section>
59
+ </middle>
60
+ </rfc>
61
+ OUTPUT
62
+ end
63
+ end