asciidoctor-rfc 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.oss-guides.rubocop.yml +1077 -0
  4. data/.rspec +1 -0
  5. data/.rubocop.yml +19 -1063
  6. data/.travis.yml +3 -2
  7. data/Guardfile +22 -0
  8. data/README.adoc +1151 -0
  9. data/Rakefile +1 -1
  10. data/asciidoctor-rfc.gemspec +20 -3
  11. data/bin/asciidoctor-rfc2 +15 -0
  12. data/bin/asciidoctor-rfc3 +15 -0
  13. data/bin/rspec +0 -1
  14. data/lib/asciidoctor-rfc.rb +4 -0
  15. data/lib/asciidoctor/rfc/common/base.rb +218 -0
  16. data/lib/asciidoctor/rfc/common/front.rb +120 -0
  17. data/lib/asciidoctor/rfc/v2/base.rb +341 -0
  18. data/lib/asciidoctor/rfc/v2/blocks.rb +192 -0
  19. data/lib/asciidoctor/rfc/v2/converter.rb +64 -0
  20. data/lib/asciidoctor/rfc/v2/front.rb +69 -0
  21. data/lib/asciidoctor/rfc/v2/inline_anchor.rb +102 -0
  22. data/lib/asciidoctor/rfc/v2/lists.rb +134 -0
  23. data/lib/asciidoctor/rfc/v2/table.rb +112 -0
  24. data/lib/asciidoctor/rfc/v2/validate.rb +738 -0
  25. data/lib/asciidoctor/rfc/v2/validate2.rng +716 -0
  26. data/lib/asciidoctor/rfc/v3/base.rb +358 -0
  27. data/lib/asciidoctor/rfc/v3/blocks.rb +203 -0
  28. data/lib/asciidoctor/rfc/v3/converter.rb +64 -0
  29. data/lib/asciidoctor/rfc/v3/front.rb +115 -0
  30. data/lib/asciidoctor/rfc/v3/inline_anchor.rb +90 -0
  31. data/lib/asciidoctor/rfc/v3/lists.rb +190 -0
  32. data/lib/asciidoctor/rfc/v3/svg.rng +9081 -0
  33. data/lib/asciidoctor/rfc/v3/table.rb +65 -0
  34. data/lib/asciidoctor/rfc/v3/validate.rb +2168 -0
  35. data/lib/asciidoctor/rfc/v3/validate.rng +2143 -0
  36. data/lib/asciidoctor/rfc/version.rb +2 -2
  37. data/spec/asciidoctor/rfc/v2/appendix_spec.rb +124 -0
  38. data/spec/asciidoctor/rfc/v2/area_spec.rb +60 -0
  39. data/spec/asciidoctor/rfc/v2/author_spec.rb +444 -0
  40. data/spec/asciidoctor/rfc/v2/comments_spec.rb +316 -0
  41. data/spec/asciidoctor/rfc/v2/crossref_spec.rb +205 -0
  42. data/spec/asciidoctor/rfc/v2/date_spec.rb +166 -0
  43. data/spec/asciidoctor/rfc/v2/dlist_spec.rb +108 -0
  44. data/spec/asciidoctor/rfc/v2/document_spec.rb +161 -0
  45. data/spec/asciidoctor/rfc/v2/example_spec.rb +50 -0
  46. data/spec/asciidoctor/rfc/v2/front_spec.rb +75 -0
  47. data/spec/asciidoctor/rfc/v2/image_spec.rb +81 -0
  48. data/spec/asciidoctor/rfc/v2/indexterm_spec.rb +66 -0
  49. data/spec/asciidoctor/rfc/v2/inline_formatting_spec.rb +177 -0
  50. data/spec/asciidoctor/rfc/v2/keyword_spec.rb +63 -0
  51. data/spec/asciidoctor/rfc/v2/listing_spec.rb +59 -0
  52. data/spec/asciidoctor/rfc/v2/literal_spec.rb +53 -0
  53. data/spec/asciidoctor/rfc/v2/olist_spec.rb +147 -0
  54. data/spec/asciidoctor/rfc/v2/paragraph_spec.rb +68 -0
  55. data/spec/asciidoctor/rfc/v2/preamble_spec.rb +140 -0
  56. data/spec/asciidoctor/rfc/v2/quote_spec.rb +24 -0
  57. data/spec/asciidoctor/rfc/v2/references_spec.rb +96 -0
  58. data/spec/asciidoctor/rfc/v2/section_spec.rb +260 -0
  59. data/spec/asciidoctor/rfc/v2/sidebar_spec.rb +32 -0
  60. data/spec/asciidoctor/rfc/v2/table_spec.rb +293 -0
  61. data/spec/asciidoctor/rfc/v2/ulist_spec.rb +96 -0
  62. data/spec/asciidoctor/rfc/v2/workgroup_spec.rb +60 -0
  63. data/spec/asciidoctor/rfc/v3/appendix_spec.rb +130 -0
  64. data/spec/asciidoctor/rfc/v3/area_spec.rb +63 -0
  65. data/spec/asciidoctor/rfc/v3/author_spec.rb +540 -0
  66. data/spec/asciidoctor/rfc/v3/comments_spec.rb +308 -0
  67. data/spec/asciidoctor/rfc/v3/crossref_spec.rb +269 -0
  68. data/spec/asciidoctor/rfc/v3/date_spec.rb +149 -0
  69. data/spec/asciidoctor/rfc/v3/dlist_spec.rb +121 -0
  70. data/spec/asciidoctor/rfc/v3/document_spec.rb +109 -0
  71. data/spec/asciidoctor/rfc/v3/example_spec.rb +34 -0
  72. data/spec/asciidoctor/rfc/v3/front_spec.rb +43 -0
  73. data/spec/asciidoctor/rfc/v3/image_spec.rb +81 -0
  74. data/spec/asciidoctor/rfc/v3/indexterm_spec.rb +69 -0
  75. data/spec/asciidoctor/rfc/v3/inline_formatting_spec.rb +319 -0
  76. data/spec/asciidoctor/rfc/v3/keyword_spec.rb +33 -0
  77. data/spec/asciidoctor/rfc/v3/link_spec.rb +34 -0
  78. data/spec/asciidoctor/rfc/v3/listing_spec.rb +59 -0
  79. data/spec/asciidoctor/rfc/v3/literal_spec.rb +51 -0
  80. data/spec/asciidoctor/rfc/v3/olist_spec.rb +168 -0
  81. data/spec/asciidoctor/rfc/v3/paragraph_spec.rb +73 -0
  82. data/spec/asciidoctor/rfc/v3/preamble_spec.rb +112 -0
  83. data/spec/asciidoctor/rfc/v3/quote_spec.rb +91 -0
  84. data/spec/asciidoctor/rfc/v3/references_spec.rb +147 -0
  85. data/spec/asciidoctor/rfc/v3/section_spec.rb +198 -0
  86. data/spec/asciidoctor/rfc/v3/series_info_spec.rb +151 -0
  87. data/spec/asciidoctor/rfc/v3/sidebar_spec.rb +30 -0
  88. data/spec/asciidoctor/rfc/v3/table_spec.rb +275 -0
  89. data/spec/asciidoctor/rfc/v3/ulist_spec.rb +74 -0
  90. data/spec/asciidoctor/rfc/v3/workgroup_spec.rb +33 -0
  91. data/spec/examples/davies-template-bare-06.adoc +361 -0
  92. data/spec/examples/davies-template-bare-06.xml.orig +426 -0
  93. data/spec/examples/example-v2.adoc +181 -0
  94. data/spec/examples/example-v2.xml +675 -0
  95. data/spec/examples/example-v3.adoc +185 -0
  96. data/spec/examples/example-v3.xml +1009 -0
  97. data/spec/examples/mib-doc-template-xml-06.adoc +596 -0
  98. data/spec/examples/mib-doc-template-xml-06.xml.orig +654 -0
  99. data/spec/examples/rfc1149.md +76 -0
  100. data/spec/examples/rfc1149.md.2.xml +94 -0
  101. data/spec/examples/rfc1149.md.3.xml +93 -0
  102. data/spec/examples/rfc1149.md.adoc +65 -0
  103. data/spec/examples/rfc2100.md +149 -0
  104. data/spec/examples/rfc2100.md.2.xml +169 -0
  105. data/spec/examples/rfc2100.md.3.xml +163 -0
  106. data/spec/examples/rfc2100.md.adoc +136 -0
  107. data/spec/examples/rfc3514.md +203 -0
  108. data/spec/examples/rfc3514.md.2.xml +238 -0
  109. data/spec/examples/rfc3514.md.3.xml +258 -0
  110. data/spec/examples/rfc3514.md.adoc +324 -0
  111. data/spec/examples/rfc5841.md +342 -0
  112. data/spec/examples/rfc5841.md.2.xml +393 -0
  113. data/spec/examples/rfc5841.md.3.xml +449 -0
  114. data/spec/examples/rfc5841.md.adoc +414 -0
  115. data/spec/examples/rfc6350.adoc +3499 -0
  116. data/spec/examples/rfc6350.bib +763 -0
  117. data/spec/examples/rfc748.md +79 -0
  118. data/spec/examples/rfc748.md.2.xml +116 -0
  119. data/spec/examples/rfc748.md.3.xml +109 -0
  120. data/spec/examples/rfc748.md.adoc +80 -0
  121. data/spec/examples/rfc7511.md +257 -0
  122. data/spec/examples/rfc7511.md.2.xml +300 -0
  123. data/spec/examples/rfc7511.md.3.xml +347 -0
  124. data/spec/examples/rfc7511.md.adoc +417 -0
  125. data/spec/spec_helper.rb +115 -5
  126. metadata +274 -9
  127. data/.hound.yml +0 -3
  128. data/README.md +0 -84
  129. data/lib/asciidoctor/rfc.rb +0 -7
  130. data/spec/asciidoctor-rfc/.keep +0 -0
@@ -0,0 +1,112 @@
1
+ module Asciidoctor
2
+ module RFC::V2
3
+ module Table
4
+ # Syntax:
5
+ # [[id]]
6
+ # .Title
7
+ # [suppress-title,align,style]
8
+ # |===
9
+ # |col | col
10
+ # |===
11
+ def table(node)
12
+ has_body = false
13
+ style_value = case node.attr "grid"
14
+ when "all"
15
+ "all"
16
+ when "rows"
17
+ "none" # not supported
18
+ when "cols"
19
+ "full"
20
+ when "none"
21
+ "none"
22
+ else
23
+ "all"
24
+ end
25
+
26
+ warn "asciidoctor: WARNING: grid=rows attribute is not supported on tables" if node.attr("grid") == "rows"
27
+ texttable_attributes = {
28
+ anchor: node.id,
29
+ title: node.title,
30
+ 'suppress-title': node.attr("supress-title") ? true : false,
31
+ align: node.attr("align"),
32
+ style: style_value,
33
+ }
34
+
35
+ noko do |xml|
36
+ xml.texttable **attr_code(texttable_attributes) do |xml_texttable|
37
+ [:head, :body, :foot].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
38
+ has_body = true if tblsec == :body
39
+ end
40
+ warn "asciidoctor: WARNING: tables must have at least one body row" unless has_body
41
+
42
+ # preamble, postamble elements not supported
43
+ table_head node, xml_texttable
44
+ table_body_and_foot node, xml_texttable
45
+ end
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def table_head(node, xml)
52
+ [:head].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
53
+ warn "asciidoctor: WARNING: RFC XML v2 tables only support a single header row" if node.rows[tblsec].size > 1
54
+ widths = table_widths(node)
55
+ node.rows[tblsec].each do |row|
56
+ rowlength = 0
57
+ row.each_with_index do |cell, i|
58
+ warn "asciidoctor: WARNING: RFC XML v2 tables do not support colspan attribute" unless cell.colspan.nil?
59
+ warn "asciidoctor: WARNING: RFC XML v2 tables do not support rowspan attribute" unless cell.rowspan.nil?
60
+ width = if node.option?("autowidth") || i >= widths[:percentage].size || !widths[:named]
61
+ nil
62
+ else
63
+ "#{widths[:percentage][i]}%"
64
+ end
65
+ ttcol_attributes = {
66
+ # NOTE: anchor (ttcol.id) not supported
67
+ align: cell.attr("halign"),
68
+ width: width,
69
+ }
70
+
71
+ rowlength += cell.text.size
72
+ xml.ttcol **attr_code(ttcol_attributes) do |ttcol|
73
+ ttcol << cell.text
74
+ # NOT cell.content: v2 does not permit blocks in cells
75
+ end
76
+ end
77
+ warn "asciidoctor: WARNING: header row of table is longer than 72 ascii characters" if rowlength > 72
78
+ end
79
+ end
80
+ end
81
+
82
+ def table_widths(node)
83
+ percentage_widths = []
84
+ named_widths = false
85
+ node.columns.each do |col|
86
+ percentage_widths << col.attr("colpcwidth")
87
+ named_widths = true if col.attr("width") != 1
88
+ # 1 is the default set value if no width has been given for the column
89
+ # if a columns widths have been set as [1,1,1,1,...], they will be ignored
90
+ end
91
+ { percentage: percentage_widths, named: named_widths }
92
+ end
93
+
94
+ def table_body_and_foot(node, xml)
95
+ [:body, :foot].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
96
+ # NOTE: anchor (tblsec.id) not supported
97
+ node.rows[tblsec].each_with_index do |row, i|
98
+ rowlength = 0
99
+ row.each do |cell|
100
+ rowlength += cell.text.size
101
+ xml.c do |c|
102
+ c << cell.text
103
+ # NOT cell.content: v2 does not permit blocks in cells
104
+ end
105
+ end
106
+ warn "asciidoctor: WARNING: row #{i} of table is longer than 72 ascii characters" if rowlength > 72
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,738 @@
1
+ require "nokogiri"
2
+
3
+ module Asciidoctor
4
+ module RFC::V2
5
+ module Validate
6
+ class << self
7
+ def validate(doc)
8
+ schemadoc = relaxng
9
+ schema = Nokogiri::XML::RelaxNG(schemadoc)
10
+ schema.validate(Nokogiri::XML(doc)).each do |error|
11
+ $stderr.puts "V2 RELAXNG Validation: #{error.message}"
12
+ end
13
+ end
14
+
15
+ def relaxng
16
+ <<~RELAXNG
17
+ <?xml version="1.0" encoding="UTF-8"?>
18
+ <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
19
+ <define name="rfc">
20
+ <element name="rfc">
21
+ <optional>
22
+ <attribute name="number"/>
23
+ </optional>
24
+ <optional>
25
+ <attribute name="obsoletes" a:defaultValue=""/>
26
+ </optional>
27
+ <optional>
28
+ <attribute name="updates" a:defaultValue=""/>
29
+ </optional>
30
+ <optional>
31
+ <attribute name="category">
32
+ <choice>
33
+ <value>std</value>
34
+ <value>bcp</value>
35
+ <value>info</value>
36
+ <value>exp</value>
37
+ <value>historic</value>
38
+ </choice>
39
+ </attribute>
40
+ </optional>
41
+ <optional>
42
+ <attribute name="consensus">
43
+ <choice>
44
+ <value>no</value>
45
+ <value>yes</value>
46
+ </choice>
47
+ </attribute>
48
+ </optional>
49
+ <optional>
50
+ <attribute name="seriesNo"/>
51
+ </optional>
52
+ <optional>
53
+ <attribute name="ipr">
54
+ <choice>
55
+ <value>full2026</value>
56
+ <value>noDerivativeWorks2026</value>
57
+ <value>none</value>
58
+ <value>full3667</value>
59
+ <value>noModification3667</value>
60
+ <value>noDerivatives3667</value>
61
+ <value>full3978</value>
62
+ <value>noModification3978</value>
63
+ <value>noDerivatives3978</value>
64
+ <value>trust200811</value>
65
+ <value>noModificationTrust200811</value>
66
+ <value>noDerivativesTrust200811</value>
67
+ <value>trust200902</value>
68
+ <value>noModificationTrust200902</value>
69
+ <value>noDerivativesTrust200902</value>
70
+ <value>pre5378Trust200902</value>
71
+ </choice>
72
+ </attribute>
73
+ </optional>
74
+ <optional>
75
+ <attribute name="iprExtract">
76
+ <data type="IDREF"/>
77
+ </attribute>
78
+ </optional>
79
+ <optional>
80
+ <attribute name="submissionType" a:defaultValue="IETF">
81
+ <choice>
82
+ <value>IETF</value>
83
+ <value>IAB</value>
84
+ <value>IRTF</value>
85
+ <value>independent</value>
86
+ </choice>
87
+ </attribute>
88
+ </optional>
89
+ <optional>
90
+ <attribute name="docName"/>
91
+ </optional>
92
+ <optional>
93
+ <attribute name="xml:lang" a:defaultValue="en"/>
94
+ </optional>
95
+ <ref name="front"/>
96
+ <ref name="middle"/>
97
+ <optional>
98
+ <ref name="back"/>
99
+ </optional>
100
+ </element>
101
+ </define>
102
+ <define name="front">
103
+ <element name="front">
104
+ <ref name="title"/>
105
+ <oneOrMore>
106
+ <ref name="author"/>
107
+ </oneOrMore>
108
+ <ref name="date"/>
109
+ <zeroOrMore>
110
+ <ref name="area"/>
111
+ </zeroOrMore>
112
+ <zeroOrMore>
113
+ <ref name="workgroup"/>
114
+ </zeroOrMore>
115
+ <zeroOrMore>
116
+ <ref name="keyword"/>
117
+ </zeroOrMore>
118
+ <optional>
119
+ <ref name="abstract"/>
120
+ </optional>
121
+ <zeroOrMore>
122
+ <ref name="note"/>
123
+ </zeroOrMore>
124
+ </element>
125
+ </define>
126
+ <define name="title">
127
+ <element name="title">
128
+ <optional>
129
+ <attribute name="abbrev"/>
130
+ </optional>
131
+ <text/>
132
+ </element>
133
+ </define>
134
+ <define name="author">
135
+ <element name="author">
136
+ <optional>
137
+ <attribute name="initials"/>
138
+ </optional>
139
+ <optional>
140
+ <attribute name="surname"/>
141
+ </optional>
142
+ <optional>
143
+ <attribute name="fullname"/>
144
+ </optional>
145
+ <optional>
146
+ <attribute name="role">
147
+ <value>editor</value>
148
+ </attribute>
149
+ </optional>
150
+ <optional>
151
+ <ref name="organization"/>
152
+ </optional>
153
+ <optional>
154
+ <ref name="address"/>
155
+ </optional>
156
+ </element>
157
+ </define>
158
+ <define name="organization">
159
+ <element name="organization">
160
+ <optional>
161
+ <attribute name="abbrev"/>
162
+ </optional>
163
+ <text/>
164
+ </element>
165
+ </define>
166
+ <define name="address">
167
+ <element name="address">
168
+ <optional>
169
+ <ref name="postal"/>
170
+ </optional>
171
+ <optional>
172
+ <ref name="phone"/>
173
+ </optional>
174
+ <optional>
175
+ <ref name="facsimile"/>
176
+ </optional>
177
+ <optional>
178
+ <ref name="email"/>
179
+ </optional>
180
+ <optional>
181
+ <ref name="uri"/>
182
+ </optional>
183
+ </element>
184
+ </define>
185
+ <define name="postal">
186
+ <element name="postal">
187
+ <oneOrMore>
188
+ <ref name="street"/>
189
+ </oneOrMore>
190
+ <zeroOrMore>
191
+ <choice>
192
+ <ref name="city"/>
193
+ <ref name="region"/>
194
+ <ref name="code"/>
195
+ <ref name="country"/>
196
+ </choice>
197
+ </zeroOrMore>
198
+ </element>
199
+ </define>
200
+ <define name="street">
201
+ <element name="street">
202
+ <text/>
203
+ </element>
204
+ </define>
205
+ <define name="city">
206
+ <element name="city">
207
+ <text/>
208
+ </element>
209
+ </define>
210
+ <define name="region">
211
+ <element name="region">
212
+ <text/>
213
+ </element>
214
+ </define>
215
+ <define name="code">
216
+ <element name="code">
217
+ <text/>
218
+ </element>
219
+ </define>
220
+ <define name="country">
221
+ <element name="country">
222
+ <text/>
223
+ </element>
224
+ </define>
225
+ <define name="phone">
226
+ <element name="phone">
227
+ <text/>
228
+ </element>
229
+ </define>
230
+ <define name="facsimile">
231
+ <element name="facsimile">
232
+ <text/>
233
+ </element>
234
+ </define>
235
+ <define name="email">
236
+ <element name="email">
237
+ <text/>
238
+ </element>
239
+ </define>
240
+ <define name="uri">
241
+ <element name="uri">
242
+ <text/>
243
+ </element>
244
+ </define>
245
+ <define name="date">
246
+ <element name="date">
247
+ <optional>
248
+ <attribute name="day"/>
249
+ </optional>
250
+ <optional>
251
+ <attribute name="month"/>
252
+ </optional>
253
+ <optional>
254
+ <attribute name="year"/>
255
+ </optional>
256
+ <empty/>
257
+ </element>
258
+ </define>
259
+ <define name="area">
260
+ <element name="area">
261
+ <text/>
262
+ </element>
263
+ </define>
264
+ <define name="workgroup">
265
+ <element name="workgroup">
266
+ <text/>
267
+ </element>
268
+ </define>
269
+ <define name="keyword">
270
+ <element name="keyword">
271
+ <text/>
272
+ </element>
273
+ </define>
274
+ <define name="abstract">
275
+ <element name="abstract">
276
+ <oneOrMore>
277
+ <ref name="t"/>
278
+ </oneOrMore>
279
+ </element>
280
+ </define>
281
+ <define name="note">
282
+ <element name="note">
283
+ <attribute name="title"/>
284
+ <oneOrMore>
285
+ <ref name="t"/>
286
+ </oneOrMore>
287
+ </element>
288
+ </define>
289
+ <define name="middle">
290
+ <element name="middle">
291
+ <oneOrMore>
292
+ <ref name="section"/>
293
+ </oneOrMore>
294
+ </element>
295
+ </define>
296
+ <define name="section">
297
+ <element name="section">
298
+ <optional>
299
+ <attribute name="anchor">
300
+ <data type="ID"/>
301
+ </attribute>
302
+ </optional>
303
+ <attribute name="title"/>
304
+ <optional>
305
+ <attribute name="toc" a:defaultValue="default">
306
+ <choice>
307
+ <value>include</value>
308
+ <value>exclude</value>
309
+ <value>default</value>
310
+ </choice>
311
+ </attribute>
312
+ </optional>
313
+ <zeroOrMore>
314
+ <choice>
315
+ <ref name="t"/>
316
+ <ref name="figure"/>
317
+ <ref name="texttable"/>
318
+ <ref name="iref"/>
319
+ </choice>
320
+ </zeroOrMore>
321
+ <zeroOrMore>
322
+ <ref name="section"/>
323
+ </zeroOrMore>
324
+ </element>
325
+ </define>
326
+ <define name="t">
327
+ <element name="t">
328
+ <optional>
329
+ <attribute name="anchor">
330
+ <data type="ID"/>
331
+ </attribute>
332
+ </optional>
333
+ <optional>
334
+ <attribute name="hangText"/>
335
+ </optional>
336
+ <zeroOrMore>
337
+ <choice>
338
+ <text/>
339
+ <ref name="list"/>
340
+ <ref name="figure"/>
341
+ <ref name="xref"/>
342
+ <ref name="eref"/>
343
+ <ref name="iref"/>
344
+ <ref name="cref"/>
345
+ <ref name="spanx"/>
346
+ <ref name="vspace"/>
347
+ </choice>
348
+ </zeroOrMore>
349
+ </element>
350
+ </define>
351
+ <define name="list">
352
+ <element name="list">
353
+ <optional>
354
+ <attribute name="style"/>
355
+ </optional>
356
+ <optional>
357
+ <attribute name="hangIndent"/>
358
+ </optional>
359
+ <optional>
360
+ <attribute name="counter"/>
361
+ </optional>
362
+ <oneOrMore>
363
+ <ref name="t"/>
364
+ </oneOrMore>
365
+ </element>
366
+ </define>
367
+ <define name="xref">
368
+ <element name="xref">
369
+ <attribute name="target">
370
+ <data type="IDREF"/>
371
+ </attribute>
372
+ <optional>
373
+ <attribute name="pageno" a:defaultValue="false">
374
+ <choice>
375
+ <value>true</value>
376
+ <value>false</value>
377
+ </choice>
378
+ </attribute>
379
+ </optional>
380
+ <optional>
381
+ <attribute name="format" a:defaultValue="default">
382
+ <choice>
383
+ <value>counter</value>
384
+ <value>title</value>
385
+ <value>none</value>
386
+ <value>default</value>
387
+ </choice>
388
+ </attribute>
389
+ </optional>
390
+ <text/>
391
+ </element>
392
+ </define>
393
+ <define name="eref">
394
+ <element name="eref">
395
+ <attribute name="target"/>
396
+ <text/>
397
+ </element>
398
+ </define>
399
+ <define name="iref">
400
+ <element name="iref">
401
+ <attribute name="item"/>
402
+ <optional>
403
+ <attribute name="subitem" a:defaultValue=""/>
404
+ </optional>
405
+ <optional>
406
+ <attribute name="primary" a:defaultValue="false">
407
+ <choice>
408
+ <value>true</value>
409
+ <value>false</value>
410
+ </choice>
411
+ </attribute>
412
+ </optional>
413
+ <empty/>
414
+ </element>
415
+ </define>
416
+ <define name="cref">
417
+ <element name="cref">
418
+ <optional>
419
+ <attribute name="anchor">
420
+ <data type="ID"/>
421
+ </attribute>
422
+ </optional>
423
+ <optional>
424
+ <attribute name="source"/>
425
+ </optional>
426
+ <text/>
427
+ </element>
428
+ </define>
429
+ <define name="spanx">
430
+ <element name="spanx">
431
+ <optional>
432
+ <attribute name="xml:space" a:defaultValue="preserve">
433
+ <choice>
434
+ <value>default</value>
435
+ <value>preserve</value>
436
+ </choice>
437
+ </attribute>
438
+ </optional>
439
+ <optional>
440
+ <attribute name="style" a:defaultValue="emph"/>
441
+ </optional>
442
+ <text/>
443
+ </element>
444
+ </define>
445
+ <define name="vspace">
446
+ <element name="vspace">
447
+ <optional>
448
+ <attribute name="blankLines" a:defaultValue="0"/>
449
+ </optional>
450
+ <empty/>
451
+ </element>
452
+ </define>
453
+ <define name="figure">
454
+ <element name="figure">
455
+ <optional>
456
+ <attribute name="anchor">
457
+ <data type="ID"/>
458
+ </attribute>
459
+ </optional>
460
+ <optional>
461
+ <attribute name="title" a:defaultValue=""/>
462
+ </optional>
463
+ <optional>
464
+ <attribute name="suppress-title" a:defaultValue="false">
465
+ <choice>
466
+ <value>true</value>
467
+ <value>false</value>
468
+ </choice>
469
+ </attribute>
470
+ </optional>
471
+ <optional>
472
+ <attribute name="src"/>
473
+ </optional>
474
+ <optional>
475
+ <attribute name="align" a:defaultValue="left">
476
+ <choice>
477
+ <value>left</value>
478
+ <value>center</value>
479
+ <value>right</value>
480
+ </choice>
481
+ </attribute>
482
+ </optional>
483
+ <optional>
484
+ <attribute name="alt" a:defaultValue=""/>
485
+ </optional>
486
+ <optional>
487
+ <attribute name="width" a:defaultValue=""/>
488
+ </optional>
489
+ <optional>
490
+ <attribute name="height" a:defaultValue=""/>
491
+ </optional>
492
+ <zeroOrMore>
493
+ <ref name="iref"/>
494
+ </zeroOrMore>
495
+ <optional>
496
+ <ref name="preamble"/>
497
+ </optional>
498
+ <ref name="artwork"/>
499
+ <optional>
500
+ <ref name="postamble"/>
501
+ </optional>
502
+ </element>
503
+ </define>
504
+ <define name="preamble">
505
+ <element name="preamble">
506
+ <zeroOrMore>
507
+ <choice>
508
+ <text/>
509
+ <ref name="xref"/>
510
+ <ref name="eref"/>
511
+ <ref name="iref"/>
512
+ <ref name="cref"/>
513
+ <ref name="spanx"/>
514
+ </choice>
515
+ </zeroOrMore>
516
+ </element>
517
+ </define>
518
+ <define name="artwork">
519
+ <element name="artwork">
520
+ <optional>
521
+ <attribute name="xml:space" a:defaultValue="preserve">
522
+ <choice>
523
+ <value>default</value>
524
+ <value>preserve</value>
525
+ </choice>
526
+ </attribute>
527
+ </optional>
528
+ <optional>
529
+ <attribute name="name" a:defaultValue=""/>
530
+ </optional>
531
+ <optional>
532
+ <attribute name="type" a:defaultValue=""/>
533
+ </optional>
534
+ <optional>
535
+ <attribute name="src"/>
536
+ </optional>
537
+ <optional>
538
+ <attribute name="align" a:defaultValue="left">
539
+ <choice>
540
+ <value>left</value>
541
+ <value>center</value>
542
+ <value>right</value>
543
+ </choice>
544
+ </attribute>
545
+ </optional>
546
+ <optional>
547
+ <attribute name="alt" a:defaultValue=""/>
548
+ </optional>
549
+ <optional>
550
+ <attribute name="width" a:defaultValue=""/>
551
+ </optional>
552
+ <optional>
553
+ <attribute name="height" a:defaultValue=""/>
554
+ </optional>
555
+ <zeroOrMore>
556
+ <text/>
557
+ </zeroOrMore>
558
+ </element>
559
+ </define>
560
+ <define name="postamble">
561
+ <element name="postamble">
562
+ <zeroOrMore>
563
+ <choice>
564
+ <text/>
565
+ <ref name="xref"/>
566
+ <ref name="eref"/>
567
+ <ref name="iref"/>
568
+ <ref name="cref"/>
569
+ <ref name="spanx"/>
570
+ </choice>
571
+ </zeroOrMore>
572
+ </element>
573
+ </define>
574
+ <define name="texttable">
575
+ <element name="texttable">
576
+ <optional>
577
+ <attribute name="anchor">
578
+ <data type="ID"/>
579
+ </attribute>
580
+ </optional>
581
+ <optional>
582
+ <attribute name="title" a:defaultValue=""/>
583
+ </optional>
584
+ <optional>
585
+ <attribute name="suppress-title" a:defaultValue="false">
586
+ <choice>
587
+ <value>true</value>
588
+ <value>false</value>
589
+ </choice>
590
+ </attribute>
591
+ </optional>
592
+ <optional>
593
+ <attribute name="align" a:defaultValue="center">
594
+ <choice>
595
+ <value>left</value>
596
+ <value>center</value>
597
+ <value>right</value>
598
+ </choice>
599
+ </attribute>
600
+ </optional>
601
+ <optional>
602
+ <attribute name="style" a:defaultValue="full">
603
+ <choice>
604
+ <value>all</value>
605
+ <value>none</value>
606
+ <value>headers</value>
607
+ <value>full</value>
608
+ </choice>
609
+ </attribute>
610
+ </optional>
611
+ <optional>
612
+ <ref name="preamble"/>
613
+ </optional>
614
+ <oneOrMore>
615
+ <ref name="ttcol"/>
616
+ </oneOrMore>
617
+ <zeroOrMore>
618
+ <ref name="c"/>
619
+ </zeroOrMore>
620
+ <optional>
621
+ <ref name="postamble"/>
622
+ </optional>
623
+ </element>
624
+ </define>
625
+ <define name="ttcol">
626
+ <element name="ttcol">
627
+ <optional>
628
+ <attribute name="width"/>
629
+ </optional>
630
+ <optional>
631
+ <attribute name="align" a:defaultValue="left">
632
+ <choice>
633
+ <value>left</value>
634
+ <value>center</value>
635
+ <value>right</value>
636
+ </choice>
637
+ </attribute>
638
+ </optional>
639
+ <text/>
640
+ </element>
641
+ </define>
642
+ <define name="c">
643
+ <element name="c">
644
+ <zeroOrMore>
645
+ <choice>
646
+ <text/>
647
+ <ref name="xref"/>
648
+ <ref name="eref"/>
649
+ <ref name="iref"/>
650
+ <ref name="cref"/>
651
+ <ref name="spanx"/>
652
+ </choice>
653
+ </zeroOrMore>
654
+ </element>
655
+ </define>
656
+ <define name="back">
657
+ <element name="back">
658
+ <zeroOrMore>
659
+ <ref name="references"/>
660
+ </zeroOrMore>
661
+ <zeroOrMore>
662
+ <ref name="section"/>
663
+ </zeroOrMore>
664
+ </element>
665
+ </define>
666
+ <define name="references">
667
+ <element name="references">
668
+ <optional>
669
+ <attribute name="title" a:defaultValue="References"/>
670
+ </optional>
671
+ <oneOrMore>
672
+ <ref name="reference"/>
673
+ </oneOrMore>
674
+ </element>
675
+ </define>
676
+ <define name="reference">
677
+ <element name="reference">
678
+ <attribute name="anchor">
679
+ <data type="ID"/>
680
+ </attribute>
681
+ <optional>
682
+ <attribute name="target"/>
683
+ </optional>
684
+ <ref name="front"/>
685
+ <zeroOrMore>
686
+ <ref name="seriesInfo"/>
687
+ </zeroOrMore>
688
+ <zeroOrMore>
689
+ <ref name="format"/>
690
+ </zeroOrMore>
691
+ <zeroOrMore>
692
+ <ref name="annotation"/>
693
+ </zeroOrMore>
694
+ </element>
695
+ </define>
696
+ <define name="seriesInfo">
697
+ <element name="seriesInfo">
698
+ <attribute name="name"/>
699
+ <attribute name="value"/>
700
+ <empty/>
701
+ </element>
702
+ </define>
703
+ <define name="format">
704
+ <element name="format">
705
+ <optional>
706
+ <attribute name="target"/>
707
+ </optional>
708
+ <attribute name="type"/>
709
+ <optional>
710
+ <attribute name="octets"/>
711
+ </optional>
712
+ <empty/>
713
+ </element>
714
+ </define>
715
+ <define name="annotation">
716
+ <element name="annotation">
717
+ <zeroOrMore>
718
+ <choice>
719
+ <text/>
720
+ <ref name="xref"/>
721
+ <ref name="eref"/>
722
+ <ref name="iref"/>
723
+ <ref name="cref"/>
724
+ <ref name="spanx"/>
725
+ </choice>
726
+ </zeroOrMore>
727
+ </element>
728
+ </define>
729
+ <start>
730
+ <ref name="rfc"/>
731
+ </start>
732
+ </grammar>
733
+ RELAXNG
734
+ end
735
+ end
736
+ end
737
+ end
738
+ end