asciidoctor-rfc 0.8.0 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +3 -0
- data/.rubocop.ribose.yml +65 -0
- data/.rubocop.tb.yml +640 -0
- data/.rubocop.yml +13 -30
- data/.travis.yml +8 -3
- data/CODE_OF_CONDUCT.md +46 -0
- data/Gemfile +8 -1
- data/LICENSE +21 -17
- data/README.adoc +471 -52
- data/asciidoctor-rfc.gemspec +14 -13
- data/lib/asciidoctor-rfc.rb +4 -4
- data/lib/asciidoctor/rfc/common/base.rb +304 -58
- data/lib/asciidoctor/rfc/common/front.rb +3 -3
- data/lib/asciidoctor/rfc/v2/base.rb +71 -82
- data/lib/asciidoctor/rfc/v2/blocks.rb +33 -10
- data/lib/asciidoctor/rfc/v2/converter.rb +0 -3
- data/lib/asciidoctor/rfc/v2/inline_anchor.rb +35 -20
- data/lib/asciidoctor/rfc/v2/lists.rb +11 -13
- data/lib/asciidoctor/rfc/v2/table.rb +11 -9
- data/lib/asciidoctor/rfc/v2/validate.rb +18 -724
- data/lib/asciidoctor/rfc/v3/base.rb +75 -102
- data/lib/asciidoctor/rfc/v3/blocks.rb +7 -9
- data/lib/asciidoctor/rfc/v3/converter.rb +0 -1
- data/lib/asciidoctor/rfc/v3/front.rb +14 -7
- data/lib/asciidoctor/rfc/v3/inline_anchor.rb +12 -9
- data/lib/asciidoctor/rfc/v3/lists.rb +31 -45
- data/lib/asciidoctor/rfc/v3/table.rb +2 -2
- data/lib/asciidoctor/rfc/v3/validate.rb +19 -2153
- data/lib/asciidoctor/rfc/v3/validate.rng +1 -1
- data/lib/asciidoctor/rfc/version.rb +1 -1
- data/rfc2629-other.ent +61 -0
- data/rfc2629-xhtml.ent +165 -0
- data/rfc2629.dtd +312 -0
- data/spec/asciidoctor/rfc/v2/biblio_spec.rb +9 -0
- data/spec/asciidoctor/rfc/v2/comments_spec.rb +67 -1
- data/spec/asciidoctor/rfc/v2/crossref_spec.rb +127 -5
- data/spec/asciidoctor/rfc/v2/date_spec.rb +24 -28
- data/spec/asciidoctor/rfc/v2/dlist_spec.rb +5 -5
- data/spec/asciidoctor/rfc/v2/image_spec.rb +2 -2
- data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +28 -0
- data/spec/asciidoctor/rfc/v2/listing_spec.rb +2 -2
- data/spec/asciidoctor/rfc/v2/literal_spec.rb +4 -4
- data/spec/asciidoctor/rfc/v2/preamble_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v2/quote_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v2/references_spec.rb +210 -3
- data/spec/asciidoctor/rfc/v2/section_spec.rb +33 -0
- data/spec/asciidoctor/rfc/v2/table_spec.rb +40 -1
- data/spec/asciidoctor/rfc/v2/text_spec.rb +71 -14
- data/spec/asciidoctor/rfc/v2/ulist_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v3/biblio_spec.rb +13 -0
- data/spec/asciidoctor/rfc/v3/comments_spec.rb +71 -0
- data/spec/asciidoctor/rfc/v3/crossref_spec.rb +7 -0
- data/spec/asciidoctor/rfc/v3/dlist_spec.rb +4 -4
- data/spec/asciidoctor/rfc/v3/literal_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v3/preamble_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v3/references_spec.rb +208 -3
- data/spec/asciidoctor/rfc/v3/series_info_spec.rb +1 -1
- data/spec/asciidoctor/rfc/v3/table_spec.rb +70 -1
- data/spec/examples/README.adoc +42 -6
- data/spec/examples/biblio-insert-v2.adoc +29 -0
- data/spec/examples/biblio-insert-v3.adoc +30 -0
- data/spec/examples/davies-template-bare-06.adoc +1 -0
- data/spec/examples/draft-iab-html-rfc-bis.xml.adoc +2300 -0
- data/spec/examples/draft-iab-html-rfc-bis.xml.orig +1999 -0
- data/spec/examples/draft-iab-html-rfc-bis.xml.txt +2298 -0
- data/spec/examples/draft-iab-rfc-framework-bis.xml.adoc +662 -0
- data/spec/examples/draft-iab-rfc-framework-bis.xml.orig +476 -0
- data/spec/examples/draft-ietf-core-block-xx.mkd.adoc +8 -33
- data/spec/examples/hoffmanv2.xml.adoc +4 -0
- data/spec/examples/mib-doc-template-xml-06.adoc +6 -8
- data/spec/examples/refs-v2-database.xml +86 -0
- data/spec/examples/refs-v2.adoc +49 -0
- data/spec/examples/refs-v2.xml +50 -0
- data/spec/examples/refs-v2/AsciiDoc.xml +8 -0
- data/spec/examples/refs-v2/AsciiMathML.xml +8 -0
- data/spec/examples/refs-v2/IETF-BibXML.xml +9 -0
- data/spec/examples/refs-v2/MathJax.xml +8 -0
- data/spec/examples/refs-v2/NroffEdit.xml +8 -0
- data/spec/examples/refs-v2/TeX-LaTeX.xml +8 -0
- data/spec/examples/refs-v2/abarth +17 -0
- data/spec/examples/refs-v2/asciidoctor-bibliography.xml +19 -0
- data/spec/examples/refs-v2/asciidoctor-manual.xml +11 -0
- data/spec/examples/refs-v2/asciidoctor-rfc.xml +18 -0
- data/spec/examples/refs-v2/asciidoctor.xml +10 -0
- data/spec/examples/refs-v2/draftr.xml +8 -0
- data/spec/examples/refs-v2/kramdown-rfc2629.xml +8 -0
- data/spec/examples/refs-v2/lyx2rfc.xml +8 -0
- data/spec/examples/refs-v2/mmark.xml +9 -0
- data/spec/examples/refs-v2/pandoc2rfc.xml +8 -0
- data/spec/examples/refs-v2/reference.RFC.2119.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.5385.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7328.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7749.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7763.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7764.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7990.xml +7 -0
- data/spec/examples/refs-v2/reference.RFC.7991.xml +7 -0
- data/spec/examples/refs-v3-database.xml +137 -0
- data/spec/examples/refs-v3.adoc +57 -0
- data/spec/examples/refs-v3.xml +90 -0
- data/spec/examples/refs-v3/AsciiDoc.xml +8 -0
- data/spec/examples/refs-v3/AsciiMathML.xml +8 -0
- data/spec/examples/refs-v3/IETF-BibXML.xml +9 -0
- data/spec/examples/refs-v3/MathJax.xml +8 -0
- data/spec/examples/refs-v3/NroffEdit.xml +8 -0
- data/spec/examples/refs-v3/TeX-LaTeX.xml +8 -0
- data/spec/examples/refs-v3/abarth +17 -0
- data/spec/examples/refs-v3/asciidoctor-bibliography.xml +19 -0
- data/spec/examples/refs-v3/asciidoctor-manual.xml +11 -0
- data/spec/examples/refs-v3/asciidoctor-rfc.xml +18 -0
- data/spec/examples/refs-v3/asciidoctor.xml +10 -0
- data/spec/examples/refs-v3/draftr.xml +8 -0
- data/spec/examples/refs-v3/kramdown-rfc2629.xml +8 -0
- data/spec/examples/refs-v3/lyx2rfc.xml +8 -0
- data/spec/examples/refs-v3/mathrefs.xml +19 -0
- data/spec/examples/refs-v3/mmark.xml +9 -0
- data/spec/examples/refs-v3/pandoc2rfc.xml +8 -0
- data/spec/examples/refs-v3/reference.RFC.2119.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.5385.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7328.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7749.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7763.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7764.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7990.xml +7 -0
- data/spec/examples/refs-v3/reference.RFC.7991.xml +7 -0
- data/spec/examples/rfc2100.md.adoc +57 -44
- data/spec/examples/rfc3514.md.adoc +1 -1
- data/spec/examples/rfc6350.adoc +701 -695
- data/spec/examples/rfc6350.txt.orig +3372 -0
- data/spec/examples/rfc6350_refs.xml +774 -0
- data/spec/examples/rfc748.md.adoc +1 -1
- data/spec/examples/rfc7511.md.adoc +3 -3
- data/spec/examples/skel.mkd.adoc +1 -0
- data/spec/examples/stupid-s.mkd.adoc +4 -4
- metadata +94 -8
- data/spec/examples/rfc6350.bib +0 -763
@@ -37,10 +37,10 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
37
37
|
|
38
38
|
[bibliography]
|
39
39
|
== References
|
40
|
-
|
40
|
+
|
41
41
|
=== Normative References
|
42
42
|
++++
|
43
|
-
<reference anchor='
|
43
|
+
<reference anchor='xxISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
|
44
44
|
<front>
|
45
45
|
<title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
|
46
46
|
<author>
|
@@ -69,7 +69,7 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
69
69
|
<t>Text</t>
|
70
70
|
</section>
|
71
71
|
<references title="Normative References">
|
72
|
-
<reference anchor='
|
72
|
+
<reference anchor='xxISO.IEC.10118-3' target='https://www.iso.org/standard/67116.html'>
|
73
73
|
<front>
|
74
74
|
<title>ISO/IEC FDIS 10118-3 -- Information technology -- Security techniques -- Hash-functions -- Part 3: Dedicated hash-functions</title>
|
75
75
|
<author>
|
@@ -95,4 +95,211 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
95
95
|
</references>
|
96
96
|
OUTPUT
|
97
97
|
end
|
98
|
+
|
99
|
+
it "renders external RFC XML references as entities" do
|
100
|
+
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true).to_s).to be_equivalent_to <<~'OUTPUT'
|
101
|
+
= The Holy Hand Grenade of Antioch
|
102
|
+
Arthur Pendragon
|
103
|
+
:doctype: internet-draft
|
104
|
+
|
105
|
+
== Hello
|
106
|
+
Hello
|
107
|
+
|
108
|
+
[bibliography]
|
109
|
+
== Normative References
|
110
|
+
++++
|
111
|
+
<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
|
112
|
+
<front>
|
113
|
+
<title>
|
114
|
+
Key words for use in RFCs to Indicate Requirement Levels
|
115
|
+
</title>
|
116
|
+
<author initials="S." surname="Bradner" fullname="S. Bradner">
|
117
|
+
<organization/>
|
118
|
+
</author>
|
119
|
+
<date year="1997" month="March"/>
|
120
|
+
<abstract>
|
121
|
+
<t>
|
122
|
+
In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
|
123
|
+
</t>
|
124
|
+
</abstract>
|
125
|
+
</front>
|
126
|
+
<seriesInfo name="BCP" value="14"/>
|
127
|
+
<seriesInfo name="RFC" value="2119"/>
|
128
|
+
<seriesInfo name="DOI" value="10.17487/RFC2119"/>
|
129
|
+
</reference>
|
130
|
+
++++
|
131
|
+
|
132
|
+
[bibliography]
|
133
|
+
== Informative References
|
134
|
+
++++
|
135
|
+
<reference anchor="I-D.abarth-cake">
|
136
|
+
<front>
|
137
|
+
<title>Simple HTTP State Management Mechanism</title>
|
138
|
+
<author initials="A" surname="Barth" fullname="Adam Barth">
|
139
|
+
<organization/>
|
140
|
+
</author>
|
141
|
+
<date month="August" day="22" year="2010"/>
|
142
|
+
<abstract>
|
143
|
+
<t>
|
144
|
+
This document describes a simple HTTP state management mechanism, called cake, that lets HTTP servers maintain stateful sessions with HTTP user agents. This mechanism is harmonized with the same-origin security model and provides both confidentiality and integrity protection against active network attackers. In addition, the mechanism is robust to cross-site request forgery attacks.Editorial Note (To be removed by RFC Editor) If you have suggestions for improving this document, please send email to mailto:http-state@ietf.org. Further Working Group information is available from https://tools.ietf.org/wg/httpstate/.
|
145
|
+
</t>
|
146
|
+
</abstract>
|
147
|
+
</front>
|
148
|
+
<seriesInfo name="Internet-Draft" value="draft-abarth-cake-00"/>
|
149
|
+
<format type="TXT" target="http://www.ietf.org/internet-drafts/draft-abarth-cake-00.txt"/>
|
150
|
+
</reference>
|
151
|
+
++++
|
152
|
+
INPUT
|
153
|
+
<?xml version="1.0" encoding="US-ASCII"?>
|
154
|
+
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
|
155
|
+
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
|
156
|
+
<!ENTITY I-D.abarth-cake SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3//reference.I-D.draft-abarth-cake-00.xml">
|
157
|
+
]>
|
158
|
+
<?rfc strict="yes"?>
|
159
|
+
<?rfc compact="yes"?>
|
160
|
+
<?rfc subcompact="no"?>
|
161
|
+
<?rfc toc="yes"?>
|
162
|
+
<?rfc tocdepth="4"?>
|
163
|
+
<?rfc symrefs="yes"?>
|
164
|
+
<?rfc sortrefs="yes"?>
|
165
|
+
<rfc submissionType="IETF">
|
166
|
+
<front>
|
167
|
+
<title>The Holy Hand Grenade of Antioch</title>
|
168
|
+
<author fullname="Arthur Pendragon" surname="Pendragon"/>
|
169
|
+
<date day="1" month="January" year="2000"/>
|
170
|
+
|
171
|
+
</front><middle>
|
172
|
+
<section anchor="_hello" title="Hello">
|
173
|
+
<t>Hello</t>
|
174
|
+
</section>
|
175
|
+
</middle><back>
|
176
|
+
<references title="Normative References">
|
177
|
+
&RFC2119;
|
178
|
+
</references>
|
179
|
+
<references title="Informative References">
|
180
|
+
&I-D.abarth-cake;
|
181
|
+
</references>
|
182
|
+
</back>
|
183
|
+
</rfc>
|
184
|
+
OUTPUT
|
185
|
+
end
|
186
|
+
|
187
|
+
it "renders skeletal external RFC XML references as entities" do
|
188
|
+
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true).to_s).to be_equivalent_to <<~'OUTPUT'
|
189
|
+
= The Holy Hand Grenade of Antioch
|
190
|
+
Arthur Pendragon
|
191
|
+
:doctype: internet-draft
|
192
|
+
|
193
|
+
== Hello
|
194
|
+
Hello
|
195
|
+
|
196
|
+
[bibliography]
|
197
|
+
== Normative References
|
198
|
+
++++
|
199
|
+
<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
|
200
|
+
<front>
|
201
|
+
<title/>
|
202
|
+
<author/>
|
203
|
+
<date/>
|
204
|
+
</front>
|
205
|
+
</reference>
|
206
|
+
++++
|
207
|
+
|
208
|
+
[bibliography]
|
209
|
+
== Informative References
|
210
|
+
++++
|
211
|
+
<reference anchor="I-D.abarth-cake">
|
212
|
+
<front>
|
213
|
+
<title/>
|
214
|
+
<author/>
|
215
|
+
<date/>
|
216
|
+
</front>
|
217
|
+
</reference>
|
218
|
+
++++
|
219
|
+
INPUT
|
220
|
+
<?xml version="1.0" encoding="US-ASCII"?>
|
221
|
+
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
|
222
|
+
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
|
223
|
+
<!ENTITY I-D.abarth-cake SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3//reference.I-D.abarth-cake.xml">
|
224
|
+
]>
|
225
|
+
<?rfc strict="yes"?>
|
226
|
+
<?rfc compact="yes"?>
|
227
|
+
<?rfc subcompact="no"?>
|
228
|
+
<?rfc toc="yes"?>
|
229
|
+
<?rfc tocdepth="4"?>
|
230
|
+
<?rfc symrefs="yes"?>
|
231
|
+
<?rfc sortrefs="yes"?>
|
232
|
+
<rfc submissionType="IETF">
|
233
|
+
<front>
|
234
|
+
<title>The Holy Hand Grenade of Antioch</title>
|
235
|
+
<author fullname="Arthur Pendragon" surname="Pendragon"/>
|
236
|
+
<date day="1" month="January" year="2000"/>
|
237
|
+
|
238
|
+
</front><middle>
|
239
|
+
<section anchor="_hello" title="Hello">
|
240
|
+
<t>Hello</t>
|
241
|
+
</section>
|
242
|
+
</middle><back>
|
243
|
+
<references title="Normative References">
|
244
|
+
&RFC2119;
|
245
|
+
</references>
|
246
|
+
<references title="Informative References">
|
247
|
+
&I-D.abarth-cake;
|
248
|
+
</references>
|
249
|
+
</back>
|
250
|
+
</rfc>
|
251
|
+
OUTPUT
|
252
|
+
end
|
253
|
+
|
254
|
+
it "renders skeletal external RFC XML references with drafts as entities" do
|
255
|
+
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true).to_s).to be_equivalent_to <<~'OUTPUT'
|
256
|
+
= The Holy Hand Grenade of Antioch
|
257
|
+
Arthur Pendragon
|
258
|
+
:doctype: internet-draft
|
259
|
+
|
260
|
+
== Hello
|
261
|
+
Hello
|
262
|
+
|
263
|
+
[bibliography]
|
264
|
+
== Informative References
|
265
|
+
++++
|
266
|
+
<reference anchor="I-D.abarth-cake">
|
267
|
+
<front>
|
268
|
+
<title/>
|
269
|
+
<author/>
|
270
|
+
<date/>
|
271
|
+
</front>
|
272
|
+
<seriesInfo name="Internet-Draft" value="draft-abarth-cake-00"/>
|
273
|
+
</reference>
|
274
|
+
++++
|
275
|
+
INPUT
|
276
|
+
<?xml version="1.0" encoding="US-ASCII"?>
|
277
|
+
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
|
278
|
+
<!ENTITY I-D.abarth-cake SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3//reference.I-D.draft-abarth-cake-00.xml">
|
279
|
+
]>
|
280
|
+
<?rfc strict="yes"?>
|
281
|
+
<?rfc compact="yes"?>
|
282
|
+
<?rfc subcompact="no"?>
|
283
|
+
<?rfc toc="yes"?>
|
284
|
+
<?rfc tocdepth="4"?>
|
285
|
+
<?rfc symrefs="yes"?>
|
286
|
+
<?rfc sortrefs="yes"?>
|
287
|
+
<rfc submissionType="IETF">
|
288
|
+
<front>
|
289
|
+
<title>The Holy Hand Grenade of Antioch</title>
|
290
|
+
<author fullname="Arthur Pendragon" surname="Pendragon"/>
|
291
|
+
<date day="1" month="January" year="2000"/>
|
292
|
+
|
293
|
+
</front><middle>
|
294
|
+
<section anchor="_hello" title="Hello">
|
295
|
+
<t>Hello</t>
|
296
|
+
</section>
|
297
|
+
</middle><back>
|
298
|
+
<references title="Informative References">
|
299
|
+
&I-D.abarth-cake;
|
300
|
+
</references>
|
301
|
+
</back>
|
302
|
+
</rfc>
|
303
|
+
OUTPUT
|
304
|
+
end
|
98
305
|
end
|
@@ -32,6 +32,39 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
32
32
|
OUTPUT
|
33
33
|
end
|
34
34
|
|
35
|
+
it "strips formatting in section titles" 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
|
+
[[id]]
|
43
|
+
== `Section` 1
|
44
|
+
Para 1
|
45
|
+
|
46
|
+
Para 2
|
47
|
+
INPUT
|
48
|
+
<?xml version="1.0" encoding="US-ASCII"?>
|
49
|
+
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
|
50
|
+
|
51
|
+
<rfc
|
52
|
+
submissionType="IETF">
|
53
|
+
<front>
|
54
|
+
<title abbrev="abbrev_value">Document title</title>
|
55
|
+
<author fullname="Author"/>
|
56
|
+
<date day="1" month="January" year="2000"/>
|
57
|
+
</front><middle>
|
58
|
+
<section anchor="id" title="Section 1">
|
59
|
+
<t>Para 1</t>
|
60
|
+
<t>Para 2</t>
|
61
|
+
</section>
|
62
|
+
</middle>
|
63
|
+
</rfc>
|
64
|
+
OUTPUT
|
65
|
+
end
|
66
|
+
|
67
|
+
|
35
68
|
it "renders HTML entities and Non-ASCII characters and in section title attributes" do
|
36
69
|
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2, header_footer: true)).to be_equivalent_to <<~'OUTPUT'
|
37
70
|
= Document title
|
@@ -329,7 +329,7 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
329
329
|
|===
|
330
330
|
INPUT
|
331
331
|
<section anchor="_section_1" title="Section 1">
|
332
|
-
<texttable suppress-title="false" style="
|
332
|
+
<texttable suppress-title="false" style="headers">
|
333
333
|
<ttcol align="left">a</ttcol>
|
334
334
|
<ttcol align="left">b</ttcol>
|
335
335
|
<ttcol align="left">c</ttcol>
|
@@ -390,4 +390,43 @@ describe Asciidoctor::RFC::V2::Converter do
|
|
390
390
|
</section>
|
391
391
|
OUTPUT
|
392
392
|
end
|
393
|
+
it "renders a table with no header row" do
|
394
|
+
# this is incorrect RFC XML
|
395
|
+
expect(Asciidoctor.convert(<<~'INPUT', backend: :rfc2)).to be_equivalent_to <<~'OUTPUT'
|
396
|
+
= Document title
|
397
|
+
Author
|
398
|
+
|
399
|
+
== Section 1
|
400
|
+
[[id]]
|
401
|
+
[suppress-title=false,align=left,grid=cols]
|
402
|
+
.Table Title
|
403
|
+
|===
|
404
|
+
|
405
|
+
h|header cell | body cell
|
406
|
+
| | body cell
|
407
|
+
^|centre aligned cell | cell
|
408
|
+
<|left aligned cell | cell
|
409
|
+
>|right aligned cell | cell
|
410
|
+
|
411
|
+
|foot | foot
|
412
|
+
|===
|
413
|
+
INPUT
|
414
|
+
<section anchor="_section_1" title="Section 1">
|
415
|
+
<texttable anchor="id" title="Table Title" suppress-title="false" align="left" style="full">
|
416
|
+
<c>header cell</c>
|
417
|
+
<c>body cell</c>
|
418
|
+
<c></c>
|
419
|
+
<c>body cell</c>
|
420
|
+
<c>centre aligned cell</c>
|
421
|
+
<c>cell</c>
|
422
|
+
<c>left aligned cell</c>
|
423
|
+
<c>cell</c>
|
424
|
+
<c>right aligned cell</c>
|
425
|
+
<c>cell</c>
|
426
|
+
<c>foot</c>
|
427
|
+
<c>foot</c>
|
428
|
+
</texttable>
|
429
|
+
</section>
|
430
|
+
OUTPUT
|
431
|
+
end
|
393
432
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
def text_compare(old_xml, new_xml)
|
4
|
+
system("rm #{old_xml}.1")
|
5
|
+
system("rm #{new_xml}.1")
|
4
6
|
File.write("#{old_xml}.1", norm(File.read(old_xml, encoding: "utf-8")))
|
5
7
|
File.write("#{new_xml}.1", norm(File.read(new_xml, encoding: "utf-8")))
|
6
8
|
system("xml2rfc #{old_xml}.1 -o #{old_xml}.txt")
|
@@ -13,77 +15,132 @@ def text_compare1(old_xml, new_xml)
|
|
13
15
|
end
|
14
16
|
|
15
17
|
def norm(text)
|
16
|
-
text.gsub(%r{<spanx style="strong">(MUST|MUST
|
18
|
+
text.gsub(%r{<spanx style="strong">(MUST|MUST\s+NOT|REQUIRED|SHALL|SHALL\s+NOT|SHOULD|SHOULD\s+NOT|NOT\s+RECOMMENDED|RECOMMENDED|MAY|OPTIONAL)</spanx>}m, "\\1").
|
19
|
+
gsub(%r{<t hangText="([^"]+:) ">}, '<t hangText="\\1">').
|
20
|
+
gsub(%r{<date year="2009" month="July" day="05"/>}, '<date year="2009" month="July" day="5"/>').
|
21
|
+
gsub(%r{<date year="2017" month="November" day="03"/>}, '<date year="2017" month="November" day="3"/>').
|
22
|
+
gsub(%r{<author fullname="Editor name"}, '<author fullname="Editor Name"').
|
23
|
+
gsub(%r{<t>(Tables use ttcol to define column headers and widths[^<]+)</t>(\s*<texttable[^>]+>)}m, "\\2<preamble>\\1</preamble>").
|
24
|
+
gsub(%r{<t>(These are sometimes called "inert" gasses[^<]+)</t>(\s*<texttable[^>]+>)}m, "\\2<preamble>\\1</preamble>").
|
25
|
+
gsub(%r{(</texttable>\s*)<t>(which is a very simple example\.)</t>}, "<postamble>\\2</postamble>\\1").
|
26
|
+
gsub(%r{(</texttable>\s*)<t>(Source: Chemistry 101)</t>}, "<postamble>\\2</postamble>\\1").
|
27
|
+
gsub(%r{(<t hangText="Option Type">\s*<vspace />\s*)<vspace/>\s*(8-bit identifier of the type of option)}, "\\1\\2").
|
28
|
+
gsub(%r{(<t hangText="Option Length">\s*<vspace />\s*)<vspace/>\s*(8-bit unsigned integer\. The length of the option)}, "\\1\\2").
|
29
|
+
gsub(%r{(<t hangText="SRO Param">\s*<vspace />\s*)<vspace/>\s*(8-bit identifier indicating Scenic Routing parameters)}, "\\1\\2").
|
30
|
+
gsub(%r{<vspace blankLines="0"/>(The highest-order two bits)}, "\\1").
|
31
|
+
gsub(%r{<vspace blankLines="0"/>(The following BIT)}, "\\1").
|
32
|
+
gsub(%r{<vspace blankLines="0"/>(The following two bits)}, "\\1").
|
33
|
+
gsub(%r{<vspace blankLines="0"/>(The lowest-order two bits)}, "\\1").
|
34
|
+
gsub(%r{ width="25%">Name</ttcol>}, ">Name</ttcol>").
|
35
|
+
gsub(%r{ width="25%">Atomic Number</ttcol>}, ">Atomic Number</ttcol>").
|
36
|
+
gsub(%r{&RFC6949;}, '<reference anchor="RFC6949"> <front> <title>RFC Series Format Requirements and Future Development</title> <author initials="H." surname="Flanagan" fullname="H. Flanagan"> <organization/></author> <author initials="N." surname="Brownlee" fullname="N. Brownlee"> <organization/></author> <date year="2013" month="May"/> </front> <seriesInfo name="RFC" value="6949"/> <annotation>This is a primary reference work.</annotation> </reference>').
|
37
|
+
gsub(%r{ width="25%">Name</ttcol>}, ">Name</ttcol>").
|
38
|
+
gsub(%r{ width="25%">Atomic Number</ttcol>}, ">Atomic Number</ttcol>").
|
39
|
+
gsub(%r{title="IAB Members at the Time of Approval" numbered="no">}, 'title="IAB Members at the Time of Approval">').
|
40
|
+
gsub(%r{title="Acknowledgments" numbered="no">}, 'title="Acknowledgments">').
|
41
|
+
gsub(%r{target='http://www.rfc-editor.org/info/}, "target='https://www.rfc-editor.org/info/").
|
42
|
+
gsub(%r{target="http://www.rfc-editor.org/info/}, 'target="https://www.rfc-editor.org/info/').
|
43
|
+
gsub(%r{<\?rfc subcompact="yes" \?>\s*<list>(\s*<t>Jari Arkko</t>)}m, %{<list style="symbols">\n\\1}).
|
44
|
+
gsub(%r{&W3C.REC-CSS2-20110607;}, '<reference anchor="W3C.REC-CSS2-20110607" target="http://www.w3.org/TR/2011/REC-CSS2-20110607"> <front> <title>Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</title> <author initials="B." surname="Bos" fullname="Bert Bos"> <organization/> </author> <author initials="T." surname="Celik" fullname="Tantek Celik"> <organization/> </author> <author initials="I." surname="Hickson" fullname="Ian Hickson"> <organization/> </author> <author initials="H." surname="Lie" fullname="Hakon Wium Lie"> <organization/> </author> <date month="June" day="7" year="2011"/> </front> <seriesInfo name="World Wide Web Consortium Recommendation" value="REC-CSS2-20110607"/> <format type="HTML" target="http://www.w3.org/TR/2011/REC-CSS2-20110607"/> </reference>').
|
45
|
+
gsub(%r{&W3C.REC-html5-20141028;}, "<reference anchor='W3C.REC-html5-20141028' target='http://www.w3.org/TR/2014/REC-html5-20141028'> <front> <title>HTML5</title> <author initials='I.' surname='Hickson' fullname='Ian Hickson'> <organization /> </author> <author initials='R.' surname='Berjon' fullname='Robin Berjon'> <organization /> </author> <author initials='S.' surname='Faulkner' fullname='Steve Faulkner'> <organization /> </author> <author initials='T.' surname='Leithead' fullname='Travis Leithead'> <organization /> </author> <author initials='E.' surname='Navara' fullname='Erika Doyle Navara'> <organization /> </author> <author initials='T.' surname='O'Connor' fullname='Theresa O'Connor'> <organization /> </author> <author initials='S.' surname='Pfeiffer' fullname='Silvia Pfeiffer'> <organization /> </author> <date month='October' day='28' year='2014' /> </front> <seriesInfo name='World Wide Web Consortium Recommendation' value='REC-html5-20141028' /> <format type='HTML' target='http://www.w3.org/TR/2014/REC-html5-20141028' /> </reference>")
|
46
|
+
end
|
47
|
+
|
48
|
+
def remove_pages(text)
|
49
|
+
text.gsub(%r{\n+\S+ [^\n]+\[Page \d+\]\n.?\nRFC[^\n]+\n}, "\n").gsub(%r{\n\n\n+}, "\n\n")
|
50
|
+
end
|
51
|
+
|
52
|
+
def text_compare2(old_xml, new_xml)
|
53
|
+
File.write("#{old_xml}.1", norm(File.read(old_xml, encoding: "utf-8")))
|
54
|
+
File.write("#{new_xml}.1", norm(File.read(new_xml, encoding: "utf-8")))
|
55
|
+
system("xml2rfc #{old_xml}.1 -o #{old_xml}.txt.1")
|
56
|
+
system("xml2rfc #{new_xml}.1 -o #{new_xml}.txt.1")
|
57
|
+
File.write("#{old_xml}.txt", remove_pages(File.read("#{old_xml}.txt.1", encoding: "utf-8")))
|
58
|
+
File.write("#{new_xml}.txt", remove_pages(File.read("#{new_xml}.txt.1", encoding: "utf-8")))
|
17
59
|
end
|
18
60
|
|
19
61
|
describe Asciidoctor::RFC::V2::Converter do
|
62
|
+
# it "processes RFC 6350 RFC XML v2 example with bibliography preprocessing, with equivalent text" do
|
63
|
+
# system("asciidoctor -b rfc2 -r 'asciidoctor-bibliography' -r 'asciidoctor-rfc' ./spec/examples/rfc6350.adoc -o spec/examples/rfc6350.xml")
|
64
|
+
# text_compare2("spec/examples/rfc6350.xml", "spec/examples/rfc6350.xml")
|
65
|
+
# expect(File.read("spec/examples/rfc6350.xml.txt")).to eq(File.read("spec/examples/rfc6350.txt.orig"))
|
66
|
+
# end
|
20
67
|
it "processes Davies template with equivalent text" do
|
21
68
|
system("bin/asciidoctor-rfc2 spec/examples/davies-template-bare-06.adoc")
|
22
69
|
text_compare("spec/examples/davies-template-bare-06.xml.orig", "spec/examples/davies-template-bare-06.xml")
|
23
|
-
expect(norm(File.read("spec/examples/davies-template-bare-06.xml.orig.txt"))).to
|
70
|
+
expect(norm(File.read("spec/examples/davies-template-bare-06.xml.orig.txt"))).to eq(norm(File.read("spec/examples/davies-template-bare-06.xml.txt")))
|
24
71
|
end
|
25
72
|
it "processes MIB template with equivalent text" do
|
26
73
|
system("bin/asciidoctor-rfc2 spec/examples/mib-doc-template-xml-06.adoc")
|
27
74
|
text_compare("spec/examples/mib-doc-template-xml-06.xml.orig", "spec/examples/mib-doc-template-xml-06.xml")
|
28
|
-
expect(norm(File.read("spec/examples/mib-doc-template-xml-06.xml.orig.txt"))).to
|
75
|
+
expect(norm(File.read("spec/examples/mib-doc-template-xml-06.xml.orig.txt"))).to eq(norm(File.read("spec/examples/mib-doc-template-xml-06.xml.txt")))
|
29
76
|
end
|
30
77
|
it "processes rfc1149 from Markdown with equivalent text" do
|
31
78
|
# leaving out step of running ./mmark
|
32
79
|
system("bin/asciidoctor-rfc2 spec/examples/rfc1149.md.adoc")
|
33
80
|
text_compare("spec/examples/rfc1149.md.2.xml", "spec/examples/rfc1149.md.xml")
|
34
|
-
expect(norm(File.read("spec/examples/rfc1149.md.2.xml.txt"))).to
|
81
|
+
expect(norm(File.read("spec/examples/rfc1149.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc1149.md.xml.txt")))
|
35
82
|
end
|
36
83
|
it "processes rfc2100 from Markdown with equivalent text" do
|
37
84
|
# leaving out step of running ./mmark
|
38
85
|
system("bin/asciidoctor-rfc2 spec/examples/rfc2100.md.adoc")
|
39
86
|
text_compare("spec/examples/rfc2100.md.2.xml", "spec/examples/rfc2100.md.xml")
|
40
|
-
expect(norm(File.read("spec/examples/rfc2100.md.2.xml.txt"))).to
|
87
|
+
expect(norm(File.read("spec/examples/rfc2100.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc2100.md.xml.txt")))
|
41
88
|
end
|
42
89
|
it "processes rfc3514 from Markdown with equivalent text" do
|
43
90
|
# leaving out step of running ./mmark
|
44
91
|
system("bin/asciidoctor-rfc2 spec/examples/rfc3514.md.adoc")
|
45
92
|
text_compare("spec/examples/rfc3514.md.2.xml", "spec/examples/rfc3514.md.xml")
|
46
|
-
expect(norm(File.read("spec/examples/rfc3514.md.2.xml.txt"))).to
|
93
|
+
expect(norm(File.read("spec/examples/rfc3514.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc3514.md.xml.txt")))
|
47
94
|
end
|
48
95
|
it "processes rfc5841 from Markdown with equivalent text" do
|
49
96
|
# leaving out step of running ./mmark
|
50
97
|
system("bin/asciidoctor-rfc2 spec/examples/rfc5841.md.adoc")
|
51
98
|
text_compare("spec/examples/rfc5841.md.2.xml", "spec/examples/rfc5841.md.xml")
|
52
|
-
expect(norm(File.read("spec/examples/rfc5841.md.2.xml.txt"))).to
|
99
|
+
expect(norm(File.read("spec/examples/rfc5841.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc5841.md.xml.txt")))
|
53
100
|
end
|
54
101
|
it "processes rfc748 from Markdown with equivalent text" do
|
55
102
|
# leaving out step of running ./mmark
|
56
103
|
system("bin/asciidoctor-rfc2 spec/examples/rfc748.md.adoc")
|
57
104
|
text_compare("spec/examples/rfc748.md.2.xml", "spec/examples/rfc748.md.xml")
|
58
|
-
expect(norm(File.read("spec/examples/rfc748.md.2.xml.txt"))).to
|
105
|
+
expect(norm(File.read("spec/examples/rfc748.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc748.md.xml.txt")))
|
59
106
|
end
|
60
107
|
it "processes rfc7511 from Markdown with equivalent text" do
|
61
108
|
# leaving out step of running ./mmark
|
62
109
|
system("bin/asciidoctor-rfc2 spec/examples/rfc7511.md.adoc")
|
63
110
|
text_compare("spec/examples/rfc7511.md.2.xml", "spec/examples/rfc7511.md.xml")
|
64
|
-
expect(norm(File.read("spec/examples/rfc7511.md.2.xml.txt"))).to
|
111
|
+
expect(norm(File.read("spec/examples/rfc7511.md.2.xml.txt"))).to eq(norm(File.read("spec/examples/rfc7511.md.xml.txt")))
|
65
112
|
end
|
66
113
|
it "processes draft-ietf-core-block-xx from Kramdown with equivalent text" do
|
67
114
|
# leaving out step of running ./kramdown
|
68
115
|
system("bin/asciidoctor-rfc2 spec/examples/draft-ietf-core-block-xx.mkd.adoc")
|
69
116
|
text_compare("spec/examples/draft-ietf-core-block-xx.xml.orig", "spec/examples/draft-ietf-core-block-xx.mkd.xml")
|
70
|
-
expect(norm(File.read("spec/examples/draft-ietf-core-block-xx.xml.orig.txt"))).to
|
117
|
+
expect(norm(File.read("spec/examples/draft-ietf-core-block-xx.xml.orig.txt"))).to eq(norm(File.read("spec/examples/draft-ietf-core-block-xx.mkd.xml.txt")))
|
71
118
|
end
|
72
119
|
it "processes skel from Kramdown with equivalent text" do
|
73
120
|
# leaving out step of running ./kramdown
|
74
121
|
system("bin/asciidoctor-rfc2 spec/examples/skel.mkd.adoc")
|
75
|
-
|
76
|
-
expect(File.read("spec/examples/skel.xml.orig.txt")).to
|
122
|
+
text_compare("spec/examples/skel.xml.orig", "spec/examples/skel.mkd.xml")
|
123
|
+
expect(File.read("spec/examples/skel.xml.orig.txt")).to eq(File.read("spec/examples/skel.mkd.xml.txt"))
|
77
124
|
end
|
78
125
|
it "processes stupid-s from Kramdown with equivalent text" do
|
79
126
|
# leaving out step of running ./kramdown
|
80
127
|
system("bin/asciidoctor-rfc2 spec/examples/stupid-s.mkd.adoc")
|
81
128
|
text_compare("spec/examples/stupid-s.xml.orig", "spec/examples/stupid-s.mkd.xml")
|
82
|
-
expect(File.read("spec/examples/stupid-s.xml.orig.txt")).to
|
129
|
+
expect(File.read("spec/examples/stupid-s.xml.orig.txt")).to eq(File.read("spec/examples/stupid-s.mkd.xml.txt"))
|
83
130
|
end
|
84
131
|
it "processes Hoffman RFC XML v2 example with equivalent text" do
|
85
132
|
system("bin/asciidoctor-rfc2 spec/examples/hoffmanv2.xml.adoc")
|
86
133
|
text_compare("spec/examples/hoffmanv2.xml.orig", "spec/examples/hoffmanv2.xml.xml")
|
87
|
-
expect(norm(File.read("spec/examples/hoffmanv2.xml.orig.txt"))).to
|
134
|
+
expect(norm(File.read("spec/examples/hoffmanv2.xml.orig.txt"))).to eq(norm(File.read("spec/examples/hoffmanv2.xml.xml.txt")))
|
135
|
+
end
|
136
|
+
it "processes draft-iab-rfc-framework-bis RFC XML v2 example with equivalent text" do
|
137
|
+
system("bin/asciidoctor-rfc2 spec/examples/draft-iab-rfc-framework-bis.xml.adoc")
|
138
|
+
text_compare("spec/examples/draft-iab-rfc-framework-bis.xml.orig", "spec/examples/draft-iab-rfc-framework-bis.xml.xml")
|
139
|
+
expect(norm(File.read("spec/examples/draft-iab-rfc-framework-bis.xml.orig.txt"))).to eq(norm(File.read("spec/examples/draft-iab-rfc-framework-bis.xml.xml.txt")))
|
140
|
+
end
|
141
|
+
it "processes draft-iab-html-rfc-bis RFC XML v2 example with equivalent text" do
|
142
|
+
system("bin/asciidoctor-rfc2 spec/examples/draft-iab-html-rfc-bis.xml.adoc")
|
143
|
+
text_compare("spec/examples/draft-iab-html-rfc-bis.xml.orig", "spec/examples/draft-iab-html-rfc-bis.xml.xml")
|
144
|
+
expect(norm(File.read("spec/examples/draft-iab-html-rfc-bis.xml.orig.txt"))).to eq(norm(File.read("spec/examples/draft-iab-html-rfc-bis.xml.xml.txt")))
|
88
145
|
end
|
89
146
|
end
|