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.
Files changed (137) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +3 -0
  3. data/.rubocop.ribose.yml +65 -0
  4. data/.rubocop.tb.yml +640 -0
  5. data/.rubocop.yml +13 -30
  6. data/.travis.yml +8 -3
  7. data/CODE_OF_CONDUCT.md +46 -0
  8. data/Gemfile +8 -1
  9. data/LICENSE +21 -17
  10. data/README.adoc +471 -52
  11. data/asciidoctor-rfc.gemspec +14 -13
  12. data/lib/asciidoctor-rfc.rb +4 -4
  13. data/lib/asciidoctor/rfc/common/base.rb +304 -58
  14. data/lib/asciidoctor/rfc/common/front.rb +3 -3
  15. data/lib/asciidoctor/rfc/v2/base.rb +71 -82
  16. data/lib/asciidoctor/rfc/v2/blocks.rb +33 -10
  17. data/lib/asciidoctor/rfc/v2/converter.rb +0 -3
  18. data/lib/asciidoctor/rfc/v2/inline_anchor.rb +35 -20
  19. data/lib/asciidoctor/rfc/v2/lists.rb +11 -13
  20. data/lib/asciidoctor/rfc/v2/table.rb +11 -9
  21. data/lib/asciidoctor/rfc/v2/validate.rb +18 -724
  22. data/lib/asciidoctor/rfc/v3/base.rb +75 -102
  23. data/lib/asciidoctor/rfc/v3/blocks.rb +7 -9
  24. data/lib/asciidoctor/rfc/v3/converter.rb +0 -1
  25. data/lib/asciidoctor/rfc/v3/front.rb +14 -7
  26. data/lib/asciidoctor/rfc/v3/inline_anchor.rb +12 -9
  27. data/lib/asciidoctor/rfc/v3/lists.rb +31 -45
  28. data/lib/asciidoctor/rfc/v3/table.rb +2 -2
  29. data/lib/asciidoctor/rfc/v3/validate.rb +19 -2153
  30. data/lib/asciidoctor/rfc/v3/validate.rng +1 -1
  31. data/lib/asciidoctor/rfc/version.rb +1 -1
  32. data/rfc2629-other.ent +61 -0
  33. data/rfc2629-xhtml.ent +165 -0
  34. data/rfc2629.dtd +312 -0
  35. data/spec/asciidoctor/rfc/v2/biblio_spec.rb +9 -0
  36. data/spec/asciidoctor/rfc/v2/comments_spec.rb +67 -1
  37. data/spec/asciidoctor/rfc/v2/crossref_spec.rb +127 -5
  38. data/spec/asciidoctor/rfc/v2/date_spec.rb +24 -28
  39. data/spec/asciidoctor/rfc/v2/dlist_spec.rb +5 -5
  40. data/spec/asciidoctor/rfc/v2/image_spec.rb +2 -2
  41. data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +28 -0
  42. data/spec/asciidoctor/rfc/v2/listing_spec.rb +2 -2
  43. data/spec/asciidoctor/rfc/v2/literal_spec.rb +4 -4
  44. data/spec/asciidoctor/rfc/v2/preamble_spec.rb +1 -1
  45. data/spec/asciidoctor/rfc/v2/quote_spec.rb +1 -1
  46. data/spec/asciidoctor/rfc/v2/references_spec.rb +210 -3
  47. data/spec/asciidoctor/rfc/v2/section_spec.rb +33 -0
  48. data/spec/asciidoctor/rfc/v2/table_spec.rb +40 -1
  49. data/spec/asciidoctor/rfc/v2/text_spec.rb +71 -14
  50. data/spec/asciidoctor/rfc/v2/ulist_spec.rb +1 -1
  51. data/spec/asciidoctor/rfc/v3/biblio_spec.rb +13 -0
  52. data/spec/asciidoctor/rfc/v3/comments_spec.rb +71 -0
  53. data/spec/asciidoctor/rfc/v3/crossref_spec.rb +7 -0
  54. data/spec/asciidoctor/rfc/v3/dlist_spec.rb +4 -4
  55. data/spec/asciidoctor/rfc/v3/literal_spec.rb +1 -1
  56. data/spec/asciidoctor/rfc/v3/preamble_spec.rb +1 -1
  57. data/spec/asciidoctor/rfc/v3/references_spec.rb +208 -3
  58. data/spec/asciidoctor/rfc/v3/series_info_spec.rb +1 -1
  59. data/spec/asciidoctor/rfc/v3/table_spec.rb +70 -1
  60. data/spec/examples/README.adoc +42 -6
  61. data/spec/examples/biblio-insert-v2.adoc +29 -0
  62. data/spec/examples/biblio-insert-v3.adoc +30 -0
  63. data/spec/examples/davies-template-bare-06.adoc +1 -0
  64. data/spec/examples/draft-iab-html-rfc-bis.xml.adoc +2300 -0
  65. data/spec/examples/draft-iab-html-rfc-bis.xml.orig +1999 -0
  66. data/spec/examples/draft-iab-html-rfc-bis.xml.txt +2298 -0
  67. data/spec/examples/draft-iab-rfc-framework-bis.xml.adoc +662 -0
  68. data/spec/examples/draft-iab-rfc-framework-bis.xml.orig +476 -0
  69. data/spec/examples/draft-ietf-core-block-xx.mkd.adoc +8 -33
  70. data/spec/examples/hoffmanv2.xml.adoc +4 -0
  71. data/spec/examples/mib-doc-template-xml-06.adoc +6 -8
  72. data/spec/examples/refs-v2-database.xml +86 -0
  73. data/spec/examples/refs-v2.adoc +49 -0
  74. data/spec/examples/refs-v2.xml +50 -0
  75. data/spec/examples/refs-v2/AsciiDoc.xml +8 -0
  76. data/spec/examples/refs-v2/AsciiMathML.xml +8 -0
  77. data/spec/examples/refs-v2/IETF-BibXML.xml +9 -0
  78. data/spec/examples/refs-v2/MathJax.xml +8 -0
  79. data/spec/examples/refs-v2/NroffEdit.xml +8 -0
  80. data/spec/examples/refs-v2/TeX-LaTeX.xml +8 -0
  81. data/spec/examples/refs-v2/abarth +17 -0
  82. data/spec/examples/refs-v2/asciidoctor-bibliography.xml +19 -0
  83. data/spec/examples/refs-v2/asciidoctor-manual.xml +11 -0
  84. data/spec/examples/refs-v2/asciidoctor-rfc.xml +18 -0
  85. data/spec/examples/refs-v2/asciidoctor.xml +10 -0
  86. data/spec/examples/refs-v2/draftr.xml +8 -0
  87. data/spec/examples/refs-v2/kramdown-rfc2629.xml +8 -0
  88. data/spec/examples/refs-v2/lyx2rfc.xml +8 -0
  89. data/spec/examples/refs-v2/mmark.xml +9 -0
  90. data/spec/examples/refs-v2/pandoc2rfc.xml +8 -0
  91. data/spec/examples/refs-v2/reference.RFC.2119.xml +7 -0
  92. data/spec/examples/refs-v2/reference.RFC.5385.xml +7 -0
  93. data/spec/examples/refs-v2/reference.RFC.7328.xml +7 -0
  94. data/spec/examples/refs-v2/reference.RFC.7749.xml +7 -0
  95. data/spec/examples/refs-v2/reference.RFC.7763.xml +7 -0
  96. data/spec/examples/refs-v2/reference.RFC.7764.xml +7 -0
  97. data/spec/examples/refs-v2/reference.RFC.7990.xml +7 -0
  98. data/spec/examples/refs-v2/reference.RFC.7991.xml +7 -0
  99. data/spec/examples/refs-v3-database.xml +137 -0
  100. data/spec/examples/refs-v3.adoc +57 -0
  101. data/spec/examples/refs-v3.xml +90 -0
  102. data/spec/examples/refs-v3/AsciiDoc.xml +8 -0
  103. data/spec/examples/refs-v3/AsciiMathML.xml +8 -0
  104. data/spec/examples/refs-v3/IETF-BibXML.xml +9 -0
  105. data/spec/examples/refs-v3/MathJax.xml +8 -0
  106. data/spec/examples/refs-v3/NroffEdit.xml +8 -0
  107. data/spec/examples/refs-v3/TeX-LaTeX.xml +8 -0
  108. data/spec/examples/refs-v3/abarth +17 -0
  109. data/spec/examples/refs-v3/asciidoctor-bibliography.xml +19 -0
  110. data/spec/examples/refs-v3/asciidoctor-manual.xml +11 -0
  111. data/spec/examples/refs-v3/asciidoctor-rfc.xml +18 -0
  112. data/spec/examples/refs-v3/asciidoctor.xml +10 -0
  113. data/spec/examples/refs-v3/draftr.xml +8 -0
  114. data/spec/examples/refs-v3/kramdown-rfc2629.xml +8 -0
  115. data/spec/examples/refs-v3/lyx2rfc.xml +8 -0
  116. data/spec/examples/refs-v3/mathrefs.xml +19 -0
  117. data/spec/examples/refs-v3/mmark.xml +9 -0
  118. data/spec/examples/refs-v3/pandoc2rfc.xml +8 -0
  119. data/spec/examples/refs-v3/reference.RFC.2119.xml +7 -0
  120. data/spec/examples/refs-v3/reference.RFC.5385.xml +7 -0
  121. data/spec/examples/refs-v3/reference.RFC.7328.xml +7 -0
  122. data/spec/examples/refs-v3/reference.RFC.7749.xml +7 -0
  123. data/spec/examples/refs-v3/reference.RFC.7763.xml +7 -0
  124. data/spec/examples/refs-v3/reference.RFC.7764.xml +7 -0
  125. data/spec/examples/refs-v3/reference.RFC.7990.xml +7 -0
  126. data/spec/examples/refs-v3/reference.RFC.7991.xml +7 -0
  127. data/spec/examples/rfc2100.md.adoc +57 -44
  128. data/spec/examples/rfc3514.md.adoc +1 -1
  129. data/spec/examples/rfc6350.adoc +701 -695
  130. data/spec/examples/rfc6350.txt.orig +3372 -0
  131. data/spec/examples/rfc6350_refs.xml +774 -0
  132. data/spec/examples/rfc748.md.adoc +1 -1
  133. data/spec/examples/rfc7511.md.adoc +3 -3
  134. data/spec/examples/skel.mkd.adoc +1 -0
  135. data/spec/examples/stupid-s.mkd.adoc +4 -4
  136. metadata +94 -8
  137. data/spec/examples/rfc6350.bib +0 -763
data/.rubocop.yml CHANGED
@@ -1,32 +1,15 @@
1
- inherit_from: .oss-guides.rubocop.yml
2
-
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ inherit_from:
6
+ # Thoughtbot's style guide from: https://github.com/thoughtbot/guides
7
+ - ".rubocop.tb.yml"
8
+ # Overrides from Ribose
9
+ - ".rubocop.ribose.yml"
3
10
  AllCops:
4
- TargetRubyVersion: 2.3
5
-
6
- Metrics/LineLength:
7
- Exclude:
8
- - "spec/**/*"
9
-
11
+ DisplayCopNames: false
12
+ StyleGuideCopsOnly: false
13
+ TargetRubyVersion: 2.4
10
14
  Rails:
11
- Enabled: false
12
-
13
- Metrics/AbcSize:
14
- Enabled: false
15
-
16
- Metrics/LineLength:
17
- Enabled: false
18
-
19
- Metrics/ModuleLength:
20
- Enabled: false
21
-
22
- Metrics/MethodLength:
23
- Enabled: false
24
-
25
- Metrics/PerceivedComplexity:
26
- Enabled: false
27
-
28
- Metrics/CyclomaticComplexity:
29
- Enabled: false
30
-
31
- Naming/VariableName:
32
- Enabled: false
15
+ Enabled: true
data/.travis.yml CHANGED
@@ -1,6 +1,11 @@
1
- sudo: false
1
+ sudo: true
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3
4
+ - 2.4.0
5
+ before_install:
6
+ - gem install bundler -v 1.16.0
7
+ - bundle install
8
+ install:
9
+ - sudo pip install xml2rfc
5
10
  script:
6
- - bundle exec rspec
11
+ - bundle exec rspec --color --format documentation --require spec_helper
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at ronald.tse@ribose.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in ribose.gemspec
3
+ group :development, :test do
4
+ gem "asciidoctor-bibliography",
5
+ git: "https://github.com/riboseinc/asciidoctor-bibliography.git"
6
+ gem "rspec"
7
+ gem "rspec-rails", "~> 3.0"
8
+ end
9
+
10
+ # Specify your gem"s dependencies in ribose.gemspec
4
11
  gemspec
data/LICENSE CHANGED
@@ -1,21 +1,25 @@
1
- MIT License
1
+ BSD 2-Clause License
2
2
 
3
- Copyright (c) 2017 Ribose
3
+ Copyright (c) 2018, Ribose
4
+ All rights reserved.
4
5
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
14
11
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.adoc CHANGED
@@ -1,4 +1,4 @@
1
- = Writing Internet-Drafts and RFCs in AsciiDoc
1
+ = AsciiRFC: Writing Internet-Drafts and RFCs in AsciiDoc
2
2
  :source-highlighter: coderay
3
3
  :icons: font
4
4
 
@@ -23,7 +23,15 @@ RFC XML output in both v3 and v2 formats:
23
23
  * v3 RFC XML (https://tools.ietf.org/html/rfc7991[RFC 7991])
24
24
  * v2 RFC XML (https://tools.ietf.org/html/rfc7749[RFC 7749])
25
25
 
26
- Its syntax is designed to be "`native-asciidoctor`":
26
+ Its syntax is designed to be "`native-asciidoctor`" as much as possible, with
27
+ some templated use of attributes to convey added information for RFC XML
28
+ output.
29
+
30
+ We refer to the version of Asciidoc markup processed by this gem as AsciiRFC.
31
+
32
+ This README documents the AsciiRFC markup in full detail. For further
33
+ information about AsciiRFC, please refer to the
34
+ https://datatracker.ietf.org/doc/draft-ribose-asciirfc/[AsciiRFC IETF Internet-Draft].
27
35
 
28
36
 
29
37
  == Installation
@@ -50,15 +58,30 @@ $ gem install asciidoctor-rfc
50
58
  ----
51
59
 
52
60
 
53
- == Quick Start
61
+ == Quick Start / Template
62
+
63
+ Clone the
64
+ https://github.com/riboseinc/rfc-in-asciidoc-template[`rfc-in-asciidoc-template`]
65
+ repository as a template, and populate it for your Asciidoc RFCs and
66
+ Internet-Drafts:
67
+
68
+ [source,console]
69
+ ----
70
+ $ git clone https://github.com/riboseinc/rfc-in-asciidoc-template
71
+ ----
72
+
73
+ See the https://github.com/riboseinc/rfc-in-asciidoc-template[README] of that document for
74
+ more information.
75
+
76
+ == Quick Example
54
77
 
55
78
  Illustrating with v2 RFC XML, and Internet Draft rather than RFC
56
79
 
57
80
  [source,asciidoc]
58
81
  ----
59
- = A Standard for the Transmission of IP Datagrams on Avian Carriers
82
+ = A Standard for the Transmission of IP Datagrams on Avian Carriers
60
83
  David Waitzman <dwaitzman@BBN.COM>
61
- :doctype: internet-draft
84
+ :doctype: internet-draft
62
85
  :abbrev: IP Datagrams on Avian Carriers
63
86
  :obsoletes: 10, 120
64
87
  :updates: 2010, 2120
@@ -87,7 +110,7 @@ IEEE802.3. The carriers have an intrinsic collision avoidance
87
110
  system, which increases availability. Unlike some network
88
111
  technologies, such as packet radio, communication is not limited to
89
112
  line-of-sight distance. Connection oriented service is available in
90
- some cities, usually based upon a central hub topology.
113
+ some cities, usually based upon a central hub topology.
91
114
 
92
115
  NOTE: Yes, this is an April Fool's RFC.
93
116
 
@@ -141,26 +164,28 @@ typical MTU is 256 milligrams. Some datagram padding may be needed.<<RFC7253>>
141
164
  ++++
142
165
  ----
143
166
 
167
+
144
168
  == Usage
145
169
 
146
170
  Converting your AsciiDoc to RFC XML is a simple as running the appropriate
147
- `./bin/asciidoctor-rfc` script using Ruby, and passing our
171
+ `./bin/asciidoctor-rfc` script using Ruby, and passing your
148
172
  AsciiDoc document file as the first argument.
149
173
 
174
+ Usually you would use the `asciidoctor` executable, specifying this gem as a
175
+ library:
176
+
150
177
  [source,console]
151
178
  ----
152
- $ ruby ./bin/asciidoctor-rfc3 draft-example-00.adoc # RFC XML v3 output
153
- $ ruby ./bin/asciidoctor-rfc2 draft-example-00.adoc # RFC XML v2 output
154
- ## WIP: bundle exec asciidoctor -b asciidoctor-rfc3 draft-example-00.adoc # RFC XML v3 output
155
- ## WIP: bundle exec asciidoctor -b asciidoctor-rfc2 draft-example-00.adoc # RFC XML v2 output
179
+ $ asciidoctor -b rfc3 -r 'asciidoctor-rfc' a.adoc # RFC XML v3 output
180
+ $ asciidoctor -b rfc2 -r 'asciidoctor-rfc' a.adoc # RFC XML v2 output
156
181
  ----
157
182
 
158
- You can also use the asciidoctor executable, specifying this gem as a library:
183
+ or through the included bin-stub:
159
184
 
160
185
  [source,console]
161
186
  ----
162
- $ asciidoctor -b rfc3 -r 'asciidoctor/rfc' a.adoc # RFC XML v3 output
163
- $ asciidoctor -b rfc2 -r 'asciidoctor/rfc' a.adoc # RFC XML v2 output
187
+ $ ./bin/asciidoctor-rfc3 draft-example-00.adoc # RFC XML v3 output
188
+ $ ./bin/asciidoctor-rfc2 draft-example-00.adoc # RFC XML v2 output
164
189
  ----
165
190
 
166
191
  When the script completes, you should see the RFC XML file `draft-example-00.xml` in the
@@ -185,7 +210,7 @@ not permit anchors for the `note` or `abstract` elements, while RFC XML v2
185
210
  uses anchors for much fewer block elements (e.g. `artwork`, `list`.)
186
211
  * Asciidoctor has a more restrctive block model: it regards elements such as
187
212
  admonitions, lists, and tables as blocks, and does not allow them to be nested
188
- within paragraphs.
213
+ within paragraphs.
189
214
 
190
215
  As a result, it may be necessary to postedit the RFC XML output, if the block
191
216
  model produced does not reflect the intended structure accurately.
@@ -193,10 +218,14 @@ model produced does not reflect the intended structure accurately.
193
218
 
194
219
  NOTE: The gem validates all RFC XML generated through the RELAXNG schema definitions
195
220
  of RFC XML. While the gem attempts to generate valid RFC XML, some Asciidoctor
196
- text may not align with the RFC XML document model, and any highlighted syntax
197
- errors will also need to be rectified in postediting, before processing the
221
+ text may not align with the RFC XML document model, and any highlighted syntax
222
+ errors will also need to be rectified in postediting, before processing the
198
223
  generated XML further.
199
224
 
225
+ NOTE: A summary guide to authoring RFC XML in Asciidoctor is also available at
226
+ https://tools.ietf.org/html/draft-ribose-asciirfc-02 (with source at
227
+ https://github.com/riboseinc/rfc-asciidoc-rfc ).
228
+
200
229
 
201
230
  === Document Type: `rfc` or `internet-draft` (Mandatory)
202
231
 
@@ -215,7 +244,7 @@ Set the `doctype` attribute to set status of this document:
215
244
  * `rfc@number` will be set to the `:name:` attribute (in v2)
216
245
 
217
246
 
218
- === Gem Options
247
+ === Global Options
219
248
 
220
249
  [cols="2", options="header"]
221
250
  |===
@@ -229,7 +258,7 @@ Override default assumption that boldface uppercase BCP14 word is to be rendered
229
258
 
230
259
  |`:smart-quotes:`
231
260
  |Optional. Default value `true`. Allowed values: `true`, `false`.
232
- Permit smart quotes, when they are specified explicitly in Asciidoc (as `"`...`"`, `'`...`'`.)
261
+ Permit smart quotes, when they are specified explicitly in Asciidoc (as `"`...`"`, `'`...`'`.)
233
262
  When disabled, smart quotes are rendered as straight quotes, and Asciidoc's default conversion
234
263
  of straight apostrophes to smart is undone.
235
264
 
@@ -239,10 +268,58 @@ Only applies to v2. By default, `<vspace blankLines="1">` is inserted after
239
268
  the definition in a v2 definition list, to satisfy the requirement from `idnits` validation
240
269
  that definition terms be separated by a carriage return from the definition. That is, by
241
270
  default inline definition lists are rendered as paragraphing definition lists. If the option is
242
- on, the additional `vspace` element is not added, and inline definition lists are left as is..
271
+ on, the additional `vspace` element is not added, and inline definition lists are left as is.
272
+
273
+ |`:flush-caches:`
274
+ |Optional. Default value `false`. Allowed values: `true`, `false`.
275
+ Delete and reload the caches of references to be included externally, and of workgroups,
276
+ during processing of this document.
277
+ The caches are stored in `~/.asciidoc-rfc-biblio-cache.json` and `~/.asciidoc-rfc-workgroup-cache.json`.
278
+
279
+ |`:biblio-dir:`
280
+ |Optional. Name of directory. If present, gives the name of a directory from which RFC XML references are to be read into the document, rather than assuming the references are already present in the document.
281
+
282
+ |`:normative:`
283
+ |Optional. Comma-delimited list of reference anchors. Used in conjunction with `:biblio-dir:`, which uses a single directory for all references: this attribute
284
+ lists those references which are to be considered normative, and listed under the _Normative References_ heading.
243
285
 
244
286
  |===
245
287
 
288
+ Any of these global options can also be included in the command line call, for either
289
+ the asciidoctor executable or the local bin-stubs, through the command line option `-a`;
290
+ e.g.
291
+
292
+ [source,console]
293
+ ----
294
+ $ asciidoctor -a flush-biblio=true -b rfc3 -r 'asciidoctor-rfc' a.adoc
295
+ $ ./bin/asciidoctor-rfc2 -a smart-quotes=false draft-example-00.adoc
296
+ ----
297
+
298
+ [[caches]]
299
+ ==== Caches
300
+
301
+ The cache of externally addressable bibliographic information is built from screenscraping the contents of:
302
+
303
+ * https://xml2rfc.tools.ietf.org/public/rfc/bibxml/
304
+ * https://xml2rfc.tools.ietf.org/public/rfc/bibxml2/
305
+ * https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/
306
+ * https://xml2rfc.tools.ietf.org/public/rfc/bibxml4/
307
+ * https://xml2rfc.tools.ietf.org/public/rfc/bibxml5/
308
+
309
+ The cache of current IETF and IRTF workgroups is built from screenscraping the contents of:
310
+
311
+ * https://tools.ietf.org/wg/
312
+ * https://irtf.org/groups
313
+
314
+ The caches are not rebuilt daily, as the bibliographic cache is with xml2rfc.
315
+ If you want to refresh the caches,
316
+
317
+ * delete
318
+ your `~/.asciidoc-rfc-biblio-cache.json` and `~/.asciidoc-rfc-workgroup-cache.json` files;
319
+ * insert the document attribute `:flush-caches: true` into
320
+ the header of the document being processed; or
321
+ * run the asciidoctor executable with option `-a flush-caches=true`
322
+ (which has the same effect).
246
323
 
247
324
  === Basic Document Attributes
248
325
 
@@ -312,7 +389,7 @@ https://tools.ietf.org/html/rfc7991#section-2.4[here].
312
389
  | `front/area`
313
390
 
314
391
  | `:workgroup:`
315
- | Optional. Comma delimited text on which IETF workgroup or research group this
392
+ | Optional. Comma delimited text on which IETF or IRTF workgroup or research group this
316
393
  document originates from. See https://tools.ietf.org/html/rfc7991#section-2.65[here].
317
394
  | `front/workgroup`
318
395
 
@@ -326,11 +403,11 @@ metadata.
326
403
  === Processing Instructions
327
404
  The `xml2rfc` tool accepts processing instructions of the form `<?rfc keyword='value'?>`:
328
405
  see https://xml2rfc.tools.ietf.org/authoring/README.html#processing.instructions .
329
- (Of these, `sort-refs`, `sym-refs` and `toc-include` are also present in the
406
+ (Of these, `sort-refs`, `sym-refs` and `toc-include` are also present in the
330
407
  v3 RFC XML specifcation, as attributes of the
331
408
  root `rfc` element: <<v3documentattributes,v3-specific document attributes>>.)
332
- Those processing instructions which apply to the entire document can also be
333
- specified for this gem as document options.
409
+ Those processing instructions which apply to the entire document can also be
410
+ specified for this gem as document options.
334
411
 
335
412
  |===
336
413
  |keyword |meaning
@@ -365,7 +442,7 @@ specified for this gem as document options.
365
442
  |text-list-symbols | modify the list of symbols used (when generated text) for list type="symbols". For example, specifying "abcde" will cause "a" to be used for 1st level, "b" for the 2nd level, etc, cycling back to the first character "a" at the 6th level. Specifying "o*" will cause the characters "o" and "*" to be alternated for each successive level.
366
443
  |toc-include | (`toc`) generate a table-of-contents
367
444
  |tocappendix | control whether the word "Appendix" appears in the table-of-content
368
- |tocdepth | if toc is "yes", then this determines the depth of the table-of-contents
445
+ |toc-depth | if toc is "yes", then this determines the depth of the table-of-contents
369
446
  |tocindent | if toc is "yes", then setting this to "yes" will indent subsections in the table-of-contents
370
447
  |tocnarrow | affects horizontal spacing in the table-of-content
371
448
  |tocompact | if toc is "yes", then setting this to "no" will make it a little less compact
@@ -375,6 +452,9 @@ specified for this gem as document options.
375
452
 
376
453
  Exceptionally, `compact`, `toc-include`, `sym-refs`, `sort-refs` and `strict` are is set by default to `yes`, `subcompact` to `no`, and `toc-depth` to 4.
377
454
 
455
+ The additional document option `rfc2629xslt` (default value: true) injects into the document header the processing
456
+ instruction `<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>`, which impacts on the output of xml2rfc.
457
+
378
458
  === Document Name / Number (Mandatory)
379
459
 
380
460
  The `name` attribute sets the document's name. This should be a number if
@@ -397,8 +477,8 @@ When `doctype` is set to:
397
477
 
398
478
  Set the `status` attribute to set the current status of this document.
399
479
 
400
- The following values are allowed: `standard`, `informational`, `experimental`, `bcp`, `fyi`,
401
- `full-standard` (v3 only), `historic` (v2 only).
480
+ The following values are allowed: `standard`, `informational`, `experimental`, `bcp`, `fyi`,
481
+ `full-standard` (v3 only), `historic` (v2 only).
402
482
 
403
483
  * In v3, this sets the first `front/seriesInfo` element with `@status` as one
404
484
  of: `standard`, `informational`, `experimental`, `bcp`, `fyi`, `full-standard`.
@@ -410,7 +490,7 @@ The following values are allowed: `standard`, `informational`, `experimental`, `
410
490
  Set the `intended-series` attribute to set the intended series of this
411
491
  document.
412
492
 
413
- The following values are allowed: `standard`, `informational`, `experimental`, `bcp`, `fyi`, `full-standard`.
493
+ The following values are allowed: `standard`, `informational`, `experimental`, `bcp`, `fyi`, `full-standard`.
414
494
 
415
495
  When `doctype` is set to:
416
496
 
@@ -508,8 +588,8 @@ formatter should use symbolic references (such as "`[RFC2119]`") or not
508
588
  formatter should contain a table of contents. Supported in v2 as a processing instruction.
509
589
  | `rfc@tocInclude`
510
590
 
511
- | `:link{_i_}: _URL_` or `:link{_i_}: _URL_ _REL_`
512
- a| Optional. A link to an external document related to this document.
591
+ | `:link: _URL_, _URL_ _REL_`
592
+ a| Optional. Comma-delimited links to an external document related to this document.
513
593
 
514
594
  There are 4 types of values:
515
595
 
@@ -536,7 +616,7 @@ You will need to provide the following information.
536
616
 
537
617
  ==== Multiple Author Names
538
618
 
539
- Just like a normal AsciiDoc, you can provide author information in the author
619
+ Just like a normal AsciiDoc, you can provide author information in the author
540
620
  header (sample of 3 authors):
541
621
 
542
622
  [source,asciidoc]
@@ -800,6 +880,10 @@ The following represent the v3 relref element
800
880
  In v2, the relref style crossreferences are rendered as equivalent `xref` crossreferences,
801
881
  inserting section numbers as appropriate.
802
882
 
883
+ Note that fragments (e.g. `crossreference#fragment`) are not supported on the `xref@target` attribute,
884
+ in either v2 or v3: the RFC XML specification requires that the `xref@target` attribute equals
885
+ the value of an anchor attribute elsewhere in the document.
886
+
803
887
 
804
888
  === Indexing
805
889
 
@@ -844,6 +928,8 @@ NOTE: The delimiters must occur within the one line; the following is invalid in
844
928
  PROBABLY*
845
929
  --
846
930
 
931
+ Any formatting XML spans within `spanx` elements are stripped in postprocessing.
932
+
847
933
  === Paragraphs
848
934
 
849
935
  [source,asciidoc]
@@ -871,6 +957,84 @@ Quotation <3>
871
957
 
872
958
  === Comments
873
959
 
960
+ ==== Asciidoctor comments
961
+
962
+ Asciidoctor implements both inline comments (prefixed with `\\`)
963
+ and block comments (prefixed with `\\\\`). Both are ignored by
964
+ the Asciidoctor processor, and are not rendered in any output,
965
+ including RFC XML.
966
+
967
+ Asciidoctor also permits paragraphs and open blocks (which can contain
968
+ multiple paragraphs) to be treated as Asciidoctor comments, if
969
+ they have the style attribute `[comment]`:
970
+
971
+ [source,asciidoc]
972
+ ----
973
+
974
+ // This is an inline Asciidoctor comment, which will not be output to XML.
975
+
976
+ [comment]
977
+ This is a single paragraph Asciidoctor comment,
978
+ which will not be output to XML.
979
+
980
+ ////
981
+ This is a block Asciidoctor comment,
982
+
983
+ which will not be output to XML.
984
+ ////
985
+
986
+ [comment]
987
+ --
988
+ This is a
989
+
990
+ multiple paragraph
991
+
992
+ Asciidoctor comment, which will not be output to XML.
993
+ --
994
+ ----
995
+
996
+ ==== XML comments
997
+
998
+ XML inline comments may be introduced into XML through the `[comment]`
999
+ formatting macro: any such comments may not span more than one line.
1000
+
1001
+ [source,asciidoc]
1002
+ --
1003
+ Text [comment]#This is a comment# Text
1004
+ --
1005
+
1006
+ The foregoing will be rendered in RFC XML as:
1007
+
1008
+ [source,xml]
1009
+ --
1010
+ <t>Text <!-- This is a comment --> Text</t>
1011
+ --
1012
+
1013
+ XML block comments are introduced through the role attribute
1014
+ `[.comment]`, which can be prefied to a paragraph or an open
1015
+ block (which can contain multiple paragraphs):
1016
+
1017
+ [source,asciidoc]
1018
+ ----
1019
+ [.comment]
1020
+ This is a single paragraph XML comment.
1021
+
1022
+ [.comment]
1023
+ --
1024
+ This is a
1025
+
1026
+ multiple paragraph
1027
+
1028
+ XML comment.
1029
+ --
1030
+ ----
1031
+
1032
+ ==== Text Comments
1033
+
1034
+ RFC XML provides for editorial comments which may optionally appear
1035
+ in the published text (subject to either the v3 `cref@display`
1036
+ attribute, or the `comments` processing instruction).
1037
+
874
1038
  In v2 RFC XML, comment text is stripped of all formatting.
875
1039
 
876
1040
  [source,asciidoc]
@@ -893,7 +1057,12 @@ Any admonition inside the body of the text is a comment.
893
1057
 
894
1058
  === Source Code Listings
895
1059
 
1060
+ In RFC XML, `sourcecode` (v3) and `artwork` (v2) elements only occur within a
1061
+ `figure` wrapper; this gem supplies that wrapper if it is not provided
1062
+ explicitly.
1063
+
896
1064
  [source,asciidoc]
1065
+ .Without Figure Wrapper
897
1066
  --
898
1067
  [[id]] <1>
899
1068
  .Source code listing title <2>
@@ -904,15 +1073,83 @@ begin() {
904
1073
  }
905
1074
  ----
906
1075
  --
907
- <1> v3: `figure/sourcecode@anchor`; v2: `figure/artwork@anchor`
1076
+ <1> v3: `figure/sourcecode@anchor`; v2: `figure@anchor` (moved into supplied wrapper: anchors not supported on `artwork`)
908
1077
  <2> v3: `figure/sourcecode@name`; v2: `figure/artwork@name`
909
1078
  <3> v3: `figure/sourcecode@type`; `figure/sourcecode@src` (`align` and `alt` not supported). If `src` is present, the listing is not expected to have any content: content is taken from the hyperlink in the attribute. v2: `figure/artwork@type`, `figure/artwork@src`, `figure/artwork@align`, `figure/artwork@alt`.
910
1079
  <4> v3: `figure/sourcecode`; v2: `figure/artwork`
911
1080
 
1081
+ [source,asciidoc]
1082
+ .With Figure Wrapper
1083
+ --
1084
+ [[id]] <1>
1085
+ [align,alt,suppress-title] <2>
1086
+ .Figure 1 <3>
1087
+ ====
1088
+ Preamble text <4>
1089
+
1090
+ [[id1]] <5>
1091
+ .Source code listing title <6>
1092
+ [source,type,src=uri,align,alt] <7>
1093
+ ----
1094
+ begin() {
1095
+ source code listing <8>
1096
+ }
1097
+ ----
1098
+
1099
+ Postamble text <9>
1100
+ ====
1101
+ --
1102
+ <1> `figure@anchor`
1103
+ <2> v2 only: `figure/artwork@align`, `figure/artwork@alt`, `figure@suppress-title` (attributes only available in v2)
1104
+ <3> `figure/name`
1105
+ <4> v2 only: `figure/preamble` (only available in v2)
1106
+ <5> v3: `figure/sourcecode@anchor`; v2: Not supported: use `figure@anchor`
1107
+ <6> v3: `figure/sourcecode@name`; v2: `figure/artwork@name`
1108
+ <7> v3: `figure/sourcecode@type`; `figure/sourcecode@src` (`align` and `alt` not supported). If `src` is present, the listing is not expected to have any content: content is taken from the hyperlink in the attribute. v2: `figure/artwork@type`, `figure/artwork@src`, `figure/artwork@align`, `figure/artwork@alt`.
1109
+ <8> v3: `figure/sourcecode`; v2: `figure/artwork`
1110
+ <9> v2 only: `figure/postamble` (only available in v2)
1111
+
912
1112
 
913
1113
  === ASCII Art and Images
914
1114
 
1115
+ In RFC XML, `artwork` elements only occur within a
1116
+ `figure` wrapper; this gem supplies that wrapper if it is not provided
1117
+ explicitly.
1118
+
1119
+
1120
+ [source,asciidoc]
1121
+ .Ascii-Art Without Figure Wrapper
1122
+ --
1123
+ [[id]] <1>
1124
+ .Figure2.jpg <2>
1125
+ [align=left|center|right,alt=Ascii Art,type=text/plain] <3>
1126
+ ....
1127
+ ------------------------
1128
+ | Ascii Art |
1129
+ ------------------------ <4>
1130
+ ....
1131
+ --
1132
+ <1> v3 only: `figure/artwork@anchor`; v2: `figure@anchor` (moved into supplied wrapper: anchors not supported on `artwork`)
1133
+ <2> `figure/artwork@name`
1134
+ <3> `figure/artwork@align`, `figure/artwork@alt`; `figure@type` (attribute only available in v2)
1135
+ <4> `figure/artwork`
1136
+
1137
+ [source,asciidoc]
1138
+ .Image Without Figure Wrapper
1139
+ --
1140
+ [[id]] <1>
1141
+ .Figure2.jpg <2>
1142
+ [align=left|center|right,alt=alt_text,type=img/jpeg] <3>
1143
+ image::filename.jpg[alt_text,700,200] <4>
1144
+ --
1145
+ <1> v3 only: `figure/artwork@anchor`; v2: `figure@anchor` (moved into supplied wrapper: anchors not supported on `artwork`)
1146
+ <2> `figure/artwork@name`
1147
+ <3> `figure/artwork@align`, `figure/artwork@alt`; `figure/artwork@type` (only available in v2, intended to be a MIME type; v3: populated as either `svg` or `binary-art` depending on file suffix)
1148
+ <4> `figure/artwork@src`, `figure/artwork@alt`, `figure/artwork@width` (deprecated in v3), `figure/artwork@height` (deprecated in v3)
1149
+
1150
+
915
1151
  [source,asciidoc]
1152
+ .With Figure Wrapper
916
1153
  --
917
1154
  [[id]] <1>
918
1155
  [align,alt,suppress-title] <2>
@@ -922,14 +1159,16 @@ Preamble text <4>
922
1159
 
923
1160
  [[id]] <5>
924
1161
  .Figure2.jpg <8>
925
- [align=left|center|right,alt=alt_text,type] <6>
1162
+ [align=left|center|right,alt=alt_text,type=text/plain] <6>
926
1163
  ....
927
- Figures are only permitted to contain listings (sourcecode), images (artwork),
1164
+ Figures are
1165
+ only permitted to contain listings (sourcecode),
1166
+ images (artwork),
928
1167
  or literal (artwork) <7>
929
1168
  ....
930
1169
  [[id]] <5>
931
1170
  .Figure2.jpg <8>
932
- [align=left|center|right,alt=alt_text,type] <9>
1171
+ [align=left|center|right,alt=alt_text,type=img/jpeg] <9>
933
1172
  image::filename.jpg[alt_text,700,200] <10>
934
1173
 
935
1174
  Postamble text <11>
@@ -939,7 +1178,7 @@ Postamble text <11>
939
1178
  <2> v2 only: `figure/artwork@align`, `figure/artwork@alt`, `figure@suppress-title` (attributes only available in v2)
940
1179
  <3> `figure/name`
941
1180
  <4> v2 only: `figure/preamble` (only available in v2)
942
- <5> `figure/artwork@anchor`
1181
+ <5> v3: `figure/artwork@anchor`; v2: Not supported: use `figure@anchor`
943
1182
  <6> `figure/artwork@align`, `figure/artwork@alt`; `figure@type` (attribute only available in v2)
944
1183
  <7> `figure/artwork`
945
1184
  <8> `figure/artwork@name`
@@ -949,6 +1188,8 @@ Postamble text <11>
949
1188
 
950
1189
  === Mathematical examples
951
1190
 
1191
+ In order for mathematical formatting to be recognised in Asciidoc, the document attribute `:stem:` needs to be set.
1192
+
952
1193
  [source,asciidoc]
953
1194
  --
954
1195
  :stem:
@@ -960,8 +1201,8 @@ sqrt(4) = 2
960
1201
  --
961
1202
 
962
1203
  Mathematical examples are treated identically to literals, and are rendered as `artwork` in both v2 and v3;
963
- however their default alignment is set as `center`. As with inline stem expressions, they are treated identically
964
- to monospace expressions; they are not currently rendered as MathML or any other notation.
1204
+ however their default alignment is set as `center`. As with inline stem expressions, they are treated identically
1205
+ to monospace expressions in the RFC XML output; they are not currently rendered as MathML or any other notation.
965
1206
 
966
1207
  === Unordered and Ordered Lists
967
1208
 
@@ -974,7 +1215,7 @@ to monospace expressions; they are not currently rendered as MathML or any other
974
1215
  ** Nested list <4>
975
1216
 
976
1217
  [[id]] <5>
977
- [spacing=compact,start=n,group=n,counter=token,hang-indent=n,format=List #%d,arabic|loweralpha|upperralpha|lowerroman|upperroman] <6>
1218
+ [spacing=compact,empty=true,start=n,group=n,counter=token,hang-indent=n,format=List #%d,arabic|loweralpha|upperralpha|lowerroman|upperroman] <6>
978
1219
  . A <7>
979
1220
  . B <7>
980
1221
  --
@@ -983,7 +1224,7 @@ to monospace expressions; they are not currently rendered as MathML or any other
983
1224
  <3> v2: `list[@style="symbols"]/t`; v3: ul/li
984
1225
  <4> v2: `list[@style="symbols"]/t/list[@style="symbols"]/t`; v3: `ul/li/ul/li`
985
1226
  <5> v3: `ol@anchor`; attribute only available in v3
986
- <6> v2: `list/counter`, `list@hangIndent`, `list@style = format List #%d`, `list@style` (for arabic|loweralpha|upperralpha|lowerroman|upperroman) (`start`, `empty` and `group` not available) v3: `ol@empty`, `ol@start`, `ol@group`, `ol@type = "#%d", `ol@type` (for arabic|loweralpha|upperralpha|lowerroman|upperroman) (`counter`, `hangIndent` not available)
1227
+ <6> v2: `list/counter`, `list@hangIndent`, `list@style = format List #%d`, `list@style` (for arabic|loweralpha|upperralpha|lowerroman|upperroman) (`spacing`, `start`, `empty` and `group` not available) v3: `ol@spacing`, `ol@empty`, `ol@start`, `ol@group`, `ol@type = "#%d", `ol@type` (for arabic|loweralpha|upperralpha|lowerroman|upperroman) (`counter`, `hangIndent` not available)
987
1228
  <7> v2: `list/t`; v3: `ol/li`
988
1229
 
989
1230
  NOTE: Asciidoctor does not permit anchors on list items: the anchors in the following are ignored.
@@ -1028,7 +1269,7 @@ paragraphs within v2 list items are replaced with `vspace` tages.
1028
1269
  === Tables
1029
1270
 
1030
1271
  The converter respects the AsciiDoc (horizontal) align attributes of cells (v2,
1031
- v3), column widths (v2), and `colspan`, `rowspan` attributes (v3).
1272
+ v3), column widths (v2), and `colspan`, `rowspan` attributes (v3).
1032
1273
 
1033
1274
  (Exceptionally,
1034
1275
  column widths specified for v2 as `"1,1,1,1,1,1...."` will be ignored, since Asciidoctor
@@ -1037,7 +1278,7 @@ internally treats them identically to unspecified column widths on a table.)
1037
1278
  [source,asciidoc]
1038
1279
  --
1039
1280
  [[id]] <1>
1040
- [suppress-title=true|false,align=left|center|right,grid=all|cols|none] <2>
1281
+ [suppress-title=true|false,align=left|center|right,grid=all|cols|none|rows] <2>
1041
1282
  .Table Title <3>
1042
1283
  |===
1043
1284
  |[[id]] head | head <4>
@@ -1049,7 +1290,7 @@ h|header cell | body cell <5>
1049
1290
  |===
1050
1291
  --
1051
1292
  <1> v3: `table@anchor`; v2: `texttable@anchor`
1052
- <2> v2: `texttable@suppress-title`, `texttable@align`, `texttable@style` (attributes only available in v2). Mapping of Asciidoc grid attribute to RFC XML style attribute is: `all` > `all`, `cols` > `full`, `none` > `none`. The RFC XML `headers` attribute is not supported. The Asciidoc attribute `rows` is not supported.
1293
+ <2> v2: `texttable@suppress-title`, `texttable@align`, `texttable@style` (attributes only available in v2). Mapping of Asciidoc grid attribute to RFC XML style attribute is: `all` > `all`, `cols` > `full`, `none` > `none`, `rows` > `headers` (although the two are not strictly equivalent).
1053
1294
  <3> v3: `table/name`; v2: `texttable@title`
1054
1295
  <4> v3: `table/thead/tr/td`; v2: `texttable/ttcol@id` (attribute only available in v2), `texttable/ttcol`
1055
1296
  <5> v3: `table/tbody/tr/th`, `table/tbody/tr/td`; v2: `texttable/c`, `texttable/c`
@@ -1072,7 +1313,7 @@ Sidebar <2>
1072
1313
  <2> `<aside>Sidebar</aside>`
1073
1314
 
1074
1315
 
1075
- === References
1316
+ === References: Embedded in Document
1076
1317
 
1077
1318
  References are expected to be provided in raw RFC XML v2 format. For v3, a list of crossreferences may
1078
1319
  precede the block of references, with alternative text. This will not be rendered, but it will be used
@@ -1084,6 +1325,9 @@ RFC requires two separate bibliographies, one for normative and one for informat
1084
1325
  either can be omitted. All bibliography sections in the must be styled with the prefix `[bibliography]`,
1085
1326
  and must appear in sequence, before any appendices.
1086
1327
 
1328
+ By default, the references cited must be included as raw RFC XML, and separated
1329
+ into the normative and informative sections.
1330
+
1087
1331
  [source,asciidoc]
1088
1332
  --
1089
1333
  [[id]] <1>
@@ -1101,10 +1345,63 @@ and must appear in sequence, before any appendices.
1101
1345
  (raw XML) <2>
1102
1346
  ++++
1103
1347
  --
1104
- <1> `back/references@anchor`
1348
+ <1> `back/references@anchor` (only in v3)
1105
1349
  <2> `back/displayreference@target`, `back/displayreference@to` (only in v3)
1106
1350
  <3> `back/references/reference`
1107
1351
 
1352
+ In postprocessing, bibliographic entries available from http://xml.resource.org/public/rfc are replaced
1353
+ with external references to that entry, using XML entities in RFC XML v2, and XML includes
1354
+ in RFC XML v3. Do not insert your own entities or XML includes into the references; the gem will have difficulty
1355
+ processing them.
1356
+
1357
+ [[external-directory-refs]]
1358
+ === References: External Directory
1359
+
1360
+ As an alternative, the document attribute `:biblio-dir:` can nominate a directory in which separate XML files can be placed, one for each reference to be included. (RFC XML v3 referencegroup elements will also be recognised as files.) The gem will read in from that directory only the files that have actually been cited, and insert them into the appropriate bibliography, without the references needing to be given under the bibliographies as above. (In fact, any XML already provided will be deleted.) By default, references will be considered informative; the document attribute `:normative:` can be used to specify a comma-delimited list of normative references.
1361
+
1362
+ The gem will issue a warning if any cited reference is not included in the directory. However, external references do not have to be included in the directory: they will be recognised by comparing their anchors against the external bibliography cache, and referenced as entities or includes. However, particular drafts of Internet-Draft documents do still need to be included as separate documents (see <<external-ref-lookup>>.)
1363
+
1364
+ For example:
1365
+
1366
+ [source,asciidoc]
1367
+ --
1368
+ = The Holy Hand Grenade of Antioch
1369
+ Arthur Pendragon
1370
+ :doctype: internet-draft
1371
+ :workgroup: silly
1372
+ :biblio-dir: refs <1>
1373
+ :normative: RFC2119, AsciiDoc <1>
1374
+
1375
+ [[xyz]]
1376
+ == Hello
1377
+ Hello
1378
+
1379
+ * a <<RFC2119,2.3 of: See internet draft subsection>> <3>
1380
+ * b <<I-D.abarth-cake>>
1381
+ * b2 <<I-D.abarth-cake,what>>
1382
+ * b1 <<I-D.abarth-cake,2.3 of: See internet draft subsection>> <3>
1383
+ * c <<xyz,format=counter: xyzzy>> <4>
1384
+ * d <<biblio>> <4>
1385
+ * e <<AsciiDoc,AsciiDoctor>>
1386
+ * f <<mathrefs>>
1387
+
1388
+
1389
+ [[biblio]]
1390
+ === Biblio
1391
+ See biblio
1392
+
1393
+ [bibliography]
1394
+ == Normative References <5>
1395
+
1396
+ [bibliography]
1397
+ == Informative References <6>
1398
+ --
1399
+ <1> The RFC XML references are included in the directory `./refs`, with one file per reference. For example, we would expect it to contain a file corresponding to the reference `mathrefs`. A file corresponding to `RFC2119` is optional, and in fact will be ignored, since the anchor is recognised as an external reference. A file corresponding to `I-D.abarth-cake` will not be ignored, if that file contains a `seriesInfo` element nominating a specific draft version.
1400
+ <2> The references in the `./refs` directory are by default considered informative; this attribute indicates that `RFC2119` and `AsciiDoc` are to be considered normative.
1401
+ <3> References are recognised in `relref` as well as `xref` elements.
1402
+ <4> The gem differentiates between bibliographic references and crossreferences to other anchors within the document.
1403
+ <5> The bibliographic headers need to be provided as above, and its titles are expected to be "Normative References" and "Informative References"; the gem will look for those titles specifically in order to insert the references it identifies from the file. However, no XML content is expected to be provided under each heading, and any XML content that is provided will be ignored.
1404
+
1108
1405
 
1109
1406
  === Appendices
1110
1407
 
@@ -1129,16 +1426,12 @@ asciidoctor commands:
1129
1426
 
1130
1427
  |===
1131
1428
  | RFC XML element | RFC XML v3 | RFC XML v2
1429
+
1132
1430
  | `front/boilerplate` | Not added | N/A
1133
1431
  | `iref@primary` | N | N
1134
- | `reference/*` (and all children) | N/A | N
1135
- | `reference/front` | N | N
1136
- | `reference/annotation` | N | N
1137
- | `reference@quote-title` | N | N/A
1138
- | `reference@target` | N | N
1432
+ | `reference` (and all children) 2+| Supported only as pass-through or through asciidoc-bibliography gem
1139
1433
  | `table/preamble` | Deprecated | N
1140
1434
  | `table/postamble` | Deprecated | N
1141
- | `table@style = headers` | N/A | N
1142
1435
  | `artwork@width` | Only on images | Only on images
1143
1436
  | `artwork@height` | Only on images | Only on images
1144
1437
  |===
@@ -1149,6 +1442,7 @@ These asciidoctor features are not supported in output of these formats:
1149
1442
 
1150
1443
  |===
1151
1444
  | asciidoctor feature | RFC XML v2 | RFC XML v3
1445
+
1152
1446
  | http://asciidoctor.org/docs/user-manual/#quote[Quote] | Rendered as normal paragraph | Supported
1153
1447
  | http://asciidoctor.org/docs/user-manual/#quote[Quote]: Non-URL Citations 2+| Ignored
1154
1448
  | http://asciidoctor.org/docs/user-manual/#verse[Verse] | Rendered as normal paragraph | Rendered as Quote
@@ -1169,7 +1463,7 @@ These asciidoctor features are not supported in output of these formats:
1169
1463
  | Macro: http://asciidoctor.org/docs/user-manual/#ui-buttons[UI buttons] 2+| Ignored
1170
1464
  | Table: http://asciidoctor.org/docs/user-manual/#footer-row[Distinction between table body and table footer] | No | Supported
1171
1465
  | Table: http://asciidoctor.org/docs/user-manual/#header-row[Multiple table header rows] | No | Supported
1172
- | Table: http://asciidoctor.org/docs/user-manual/#table-borders[Table borders: grid = rows] | No | Ignored
1466
+ | Table: http://asciidoctor.org/docs/user-manual/#table-borders[Table borders: grid = rows] | Rendered as `headers` | Ignored
1173
1467
  | Table: http://asciidoctor.org/docs/user-manual/#table-borders[Table borders: grid = cols\|none] | Supported | Ignored
1174
1468
  | Table: http://asciidoctor.org/docs/user-manual/#table-borders[Table borders: frame] 2+| Ignored
1175
1469
  | Table: http://asciidoctor.org/docs/user-manual/#cell[Table cells: rowspan] | Ignored | Supported
@@ -1178,6 +1472,131 @@ These asciidoctor features are not supported in output of these formats:
1178
1472
  | Table: http://asciidoctor.org/docs/user-manual/#cols-format[Table columns: width] | Supported | Ignored
1179
1473
  |===
1180
1474
 
1475
+ [[external-ref-lookup]]
1476
+ == Lookup of external references
1477
+
1478
+ In order to speed the lookup of references on the http://xml.resource.org/public/rfc website for external
1479
+ references, a cache of references is built the first time the gem is run, in the user's home directory:
1480
+ `~/.asciidoc-rfc-biblio-cache.json`. This maps all the canonical anchors for external references as defined
1481
+ by the IETF, such as `RFC2119` or `CCITT.E163.1988`, to the URLs that their RFC reference is stored on.
1482
+ References are detected for replacement in the Asciidoc document by matching the `references@anchor`
1483
+ attribute to one of those canonical anchors; the content of the local RFC XML reference is not checked.
1484
+
1485
+ (For rebuilding the cache, see <<caches>>.)
1486
+
1487
+ Rather than hand crafting RFC XML references for RFC documents, or other references hosted at `http://xml.resource.org/public/rfc/`,
1488
+ you need only create a dummy `<reference>` element containing the IETF-defined anchor for that citation. In postprocessing, any
1489
+ references that are hosted at xml.resource.org will be identified by their anchor, and replaced by entities or XML includes,
1490
+ for RFC XML v2 and v3 respectively. (The complete list of authoritative
1491
+ RFC XML bibliographies is available from https://xml2rfc.tools.ietf.org , online and in zipped form.)
1492
+
1493
+ Because the content of any externally defined `<reference>` element is overwritten with an entity or include,
1494
+ you do not need to provide a full reference. You can supply a minimal reference like `<reference anchor="RFC2119"/>`,
1495
+ but note that such a reference is invalid in the RFC XML schema, and the gem will report a missing element during processing.
1496
+ (The document will still be processed successfully.) To prevent any validation error reports, the minimal syntactically valid reference is:
1497
+
1498
+ [source,xml]
1499
+ --
1500
+ <reference anchor="RFC2119">
1501
+ <front>
1502
+ <title/>
1503
+ <author/>
1504
+ <date/>
1505
+ </front>
1506
+ </reference>
1507
+ --
1508
+
1509
+ If you wish to cite a specific version of an Internet-Draft, you will need to include the `seriesInfo` element
1510
+ in the reference that identifies the specific version; the anchor is the same for all internet drafts. For example:
1511
+
1512
+ [source,xml]
1513
+ --
1514
+ <reference anchor="I-D.abarth-cake">
1515
+ <front>
1516
+ <title/>
1517
+ <author/>
1518
+ <date/>
1519
+ </front>
1520
+ <seriesInfo name="Internet-Draft" value="draft-abarth-cake-00"/>
1521
+ </reference>
1522
+ --
1523
+
1524
+ As discussed under <<external-directory-refs>>, any citations of specific versions of an Internet-Draft need to be included as explicit files in an external directory of RFC XML references, since the seriesInfo draft information cannot be recovered by the anchor. However, any other external references do not require a corresponding directory file (although normative references do still need to be named in the `:normative:` document attribute.)
1525
+
1526
+ == asciidoc-bibliography integration
1527
+
1528
+ [TODO]
1529
+
1530
+ ////
1531
+ The https://github.com/riboseinc/asciidoctor-bibliography[asciidoc-bibliography] gem allows citations to be imported
1532
+ into asciidoc from BibTex or RFC XML files. The gem natively requires the user to provide the correct, presorted
1533
+ RFC XML references within asciidoc separately for normative and for informative references. Using the asciidoc-bibliography
1534
+ gem, the user can instead have a single file of RFC XML references, and indicate in place whether each reference
1535
+ is intended to be normative or informative, as is the case for MMark; the gem will then extract the correct RFC XML
1536
+ references from the references file, and insert them in order into the normative and informative references respectively.
1537
+
1538
+ Integration with the asciidoc-bibliography gem proceeds as follows:
1539
+
1540
+ . Create an RFC XML references file, consisting of a `<references>` element with individual `<reference>` elements inserted,
1541
+ as would be done for the informative and normative references normally. The references file will contain all possible
1542
+ references to be used
1543
+ in the file; the bibliography gem will select which references have actually been cited in the document.
1544
+ .. The caveats for <<external-ref-lookup,externally available references>> also apply to the references file.
1545
+ Unlike the case for RFC XML documents created manually, the references file does not recognise XML entities
1546
+ and will not attempt to download them during processing; postprocessing means you do not need to create your own
1547
+ XML entities anyway.
1548
+ .. The RFC XML in the references file will need to be appropriate to the version of RFC XML used in the main document, as
1549
+ usual. Note that RFC XML v2 references are forward compatible with v3; v3 contains a couple of additional elements.
1550
+ . Add the following header attributes to the main document:
1551
+ +
1552
+ --
1553
+ `:bibliography-database:` :: The name of the references file; this is expected to be in the same directory as
1554
+ the main document.
1555
+ `:bibliography-passthrough:` :: `citations`. This instructs the asciidoctor-bibliography gem to wrap the citations
1556
+ in an Asciidoctor passthrough block. If `true` is used, the references introduced through `cite` macros will also
1557
+ be treated as inline Asciidoctor passthrough text.
1558
+ `:bibliography-prepend-empty:` :: `true|false`. No current effect on file
1559
+ `:bibliography-hyperlinks:` :: `true|false` (default `true`): inserts bibliographic link around reference. Use `false`.
1560
+ `:bibliography-style:` :: The style of reference used in the references file; the recognised styles are `rfc-v2` and
1561
+ `rfc-v3`, for RFC XML v2 and RFC XML v3 respectively.
1562
+ --
1563
+
1564
+ . References to a normative reference are inserted with the macro `cite:norm[id]` instead of `<<id>>`, where `id` is
1565
+ the anchor of the reference.
1566
+ . References to an informative reference are inserted with the macro `cite:info[id]` instead of `<<id>>`, where `id` is
1567
+ the anchor of the reference.
1568
+ .. Text may be prefixed or suffixed to the crossreference with the `prefix` and `suffix` attributes.
1569
+ .. Arbitrary text associated with a crossreference is inserted with a `text` attribute (with the citation itself in curly brackets), and fragment references are inserted with a `locator` attribute.
1570
+ .. Formatted crossreferences and `relref` crossreferences are entered by inserting the expected raw XML in the `text` attribute. Do not use the `{cite}` interpolation of the citation. Using `cite:norm`, the following equivalence obtain between normal Asciidoc treatment of crossreferences and asciidoc-bibliography macros:
1571
+ *** `<<id,words>>` = `cite:norm[id, text="<xref target='id'>words</xref>"]`
1572
+ *** `<<id,format=counter: words>>` (processed as a formatted crossreference) = `cite:norm[id, text="<xref format='counter' target='id'>words</xref>"]`
1573
+ *** `<<id,2.4 comma: words>>` (processed as relref) = `cite:norm[id, text="<relref displayFormat='comma' section='2.4' target='id'}/>"]`
1574
+ *** `<<id#section2_4,2.4 comma: words>>` (processed as relref with a cross-document internal reference) = `cite:norm[id, text="<relref relative='section2_4' displayFormat='comma' section='2.4' target='id'/>"]`
1575
+ . Normative and Informative References are inserted in the document through a macro, which occurs where the RFC XML
1576
+ references would be inserted
1577
+ +
1578
+ [source,asciidoc]
1579
+ --
1580
+ [bibliography]
1581
+ == Normative References
1582
+
1583
+ ++++
1584
+ bibliography::norm[]
1585
+ ++++
1586
+
1587
+ [bibliography]
1588
+ == Informative References
1589
+
1590
+ ++++
1591
+ bibliography::info[]
1592
+ ++++
1593
+ --
1594
+ . In order to preprocess the macros, the asciidoctor-bibliography gem is passed as an `-r` argument to the
1595
+ asciidoctor-rfc invocation:
1596
+ ** `asciidoctor -b rfc2 -r 'asciidoctor-bibliography' -r 'asciidoctor-rfc' spec/examples/refs-v2.adoc`
1597
+ ** `asciidoctor -b rfc3 -r 'asciidoctor-bibliography' -r 'asciidoctor-rfc' spec/examples/refs-v3.adoc`
1598
+ . `referencegroup` citations are not currently supported by the asciidoctor-bibliography gem.
1599
+ ////
1181
1600
 
1182
1601
  == Examples
1183
1602