rfcxml 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/roundtrip.yml +79 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +9 -3
- data/.rubocop_todo.yml +87 -17
- data/Gemfile +4 -2
- data/README.adoc +386 -18
- data/Rakefile +55 -0
- data/lib/rfcxml/v3/abstract.rb +2 -6
- data/lib/rfcxml/v3/address.rb +2 -7
- data/lib/rfcxml/v3/annotation.rb +2 -15
- data/lib/rfcxml/v3/area.rb +1 -1
- data/lib/rfcxml/v3/artset.rb +2 -3
- data/lib/rfcxml/v3/artwork.rb +13 -10
- data/lib/rfcxml/v3/aside.rb +2 -12
- data/lib/rfcxml/v3/author.rb +16 -12
- data/lib/rfcxml/v3/back.rb +2 -5
- data/lib/rfcxml/v3/bcp14.rb +1 -1
- data/lib/rfcxml/v3/blockquote.rb +2 -26
- data/lib/rfcxml/v3/boilerplate.rb +2 -3
- data/lib/rfcxml/v3/br.rb +1 -1
- data/lib/rfcxml/v3/c.rb +2 -7
- data/lib/rfcxml/v3/city.rb +1 -1
- data/lib/rfcxml/v3/cityarea.rb +1 -1
- data/lib/rfcxml/v3/code.rb +1 -1
- data/lib/rfcxml/v3/contact.rb +2 -4
- data/lib/rfcxml/v3/country.rb +1 -1
- data/lib/rfcxml/v3/cref.rb +2 -11
- data/lib/rfcxml/v3/date.rb +4 -4
- data/lib/rfcxml/v3/dd.rb +2 -25
- data/lib/rfcxml/v3/displayreference.rb +1 -1
- data/lib/rfcxml/v3/dl.rb +2 -7
- data/lib/rfcxml/v3/dt.rb +2 -14
- data/lib/rfcxml/v3/email.rb +1 -1
- data/lib/rfcxml/v3/eref.rb +1 -1
- data/lib/rfcxml/v3/extaddr.rb +1 -1
- data/lib/rfcxml/v3/facsimile.rb +1 -1
- data/lib/rfcxml/v3/figure.rb +17 -19
- data/lib/rfcxml/v3/format.rb +1 -1
- data/lib/rfcxml/v3/front.rb +2 -13
- data/lib/rfcxml/v3/iref.rb +4 -3
- data/lib/rfcxml/v3/keyword.rb +1 -1
- data/lib/rfcxml/v3/li.rb +2 -28
- data/lib/rfcxml/v3/link.rb +1 -1
- data/lib/rfcxml/v3/list.rb +3 -4
- data/lib/rfcxml/v3/middle.rb +2 -3
- data/lib/rfcxml/v3/name.rb +2 -14
- data/lib/rfcxml/v3/note.rb +2 -7
- data/lib/rfcxml/v3/ol.rb +5 -4
- data/lib/rfcxml/v3/organization.rb +10 -5
- data/lib/rfcxml/v3/phone.rb +1 -1
- data/lib/rfcxml/v3/pobox.rb +1 -1
- data/lib/rfcxml/v3/postal.rb +2 -12
- data/lib/rfcxml/v3/postal_line.rb +1 -1
- data/lib/rfcxml/v3/postamble.rb +2 -7
- data/lib/rfcxml/v3/preamble.rb +2 -15
- data/lib/rfcxml/v3/refcontent.rb +2 -4
- data/lib/rfcxml/v3/reference.rb +7 -10
- data/lib/rfcxml/v3/referencegroup.rb +2 -3
- data/lib/rfcxml/v3/references.rb +2 -5
- data/lib/rfcxml/v3/region.rb +1 -1
- data/lib/rfcxml/v3/relref.rb +1 -1
- data/lib/rfcxml/v3/rfc.rb +62 -14
- data/lib/rfcxml/v3/section.rb +11 -21
- data/lib/rfcxml/v3/series_info.rb +5 -4
- data/lib/rfcxml/v3/sortingcode.rb +1 -1
- data/lib/rfcxml/v3/sourcecode.rb +13 -9
- data/lib/rfcxml/v3/spanx.rb +1 -1
- data/lib/rfcxml/v3/street.rb +1 -1
- data/lib/rfcxml/v3/strong.rb +6 -8
- data/lib/rfcxml/v3/sub.rb +6 -15
- data/lib/rfcxml/v3/sup.rb +2 -3
- data/lib/rfcxml/v3/table.rb +1 -7
- data/lib/rfcxml/v3/tbody.rb +1 -3
- data/lib/rfcxml/v3/td.rb +23 -26
- data/lib/rfcxml/v3/text.rb +2 -20
- data/lib/rfcxml/v3/texttable.rb +12 -12
- data/lib/rfcxml/v3/tfoot.rb +1 -3
- data/lib/rfcxml/v3/th.rb +1 -3
- data/lib/rfcxml/v3/thead.rb +1 -3
- data/lib/rfcxml/v3/title.rb +3 -4
- data/lib/rfcxml/v3/toc.rb +1 -3
- data/lib/rfcxml/v3/tr.rb +3 -4
- data/lib/rfcxml/v3/tt.rb +5 -19
- data/lib/rfcxml/v3/ttcol.rb +4 -7
- data/lib/rfcxml/v3/u.rb +1 -1
- data/lib/rfcxml/v3/ul.rb +10 -6
- data/lib/rfcxml/v3/uri.rb +1 -1
- data/lib/rfcxml/v3/vspace.rb +1 -1
- data/lib/rfcxml/v3/workgroup.rb +1 -1
- data/lib/rfcxml/v3/xref.rb +2 -3
- data/lib/rfcxml/v3/xref_text.rb +7 -16
- data/lib/rfcxml/v3.rb +100 -2
- data/lib/rfcxml/version.rb +1 -1
- data/lib/rfcxml.rb +3 -4
- data/rfcxml.gemspec +3 -2
- data/scripts/README.md +110 -0
- data/scripts/roundtrip_test.rb +361 -0
- metadata +9 -6
- data/lib/rfcxml/v3/em.rb +0 -14
data/lib/rfcxml/v3/rfc.rb
CHANGED
|
@@ -11,23 +11,36 @@ module Rfcxml
|
|
|
11
11
|
module V3
|
|
12
12
|
class Rfc < Lutaml::Model::Serializable
|
|
13
13
|
attribute :number, :string
|
|
14
|
-
attribute :obsoletes, :string
|
|
15
|
-
attribute :updates, :string
|
|
16
|
-
attribute :category, :string
|
|
14
|
+
attribute :obsoletes, :string
|
|
15
|
+
attribute :updates, :string
|
|
16
|
+
attribute :category, :string,
|
|
17
|
+
values: %w[std bcp exp info historic]
|
|
17
18
|
attribute :mode, :string
|
|
18
|
-
attribute :consensus, :string,
|
|
19
|
+
attribute :consensus, :string,
|
|
20
|
+
values: %w[no yes false true],
|
|
21
|
+
default: -> { "false" }
|
|
19
22
|
attribute :series_no, :string
|
|
20
23
|
attribute :ipr, :string
|
|
21
|
-
attribute :lang,
|
|
24
|
+
attribute :lang, Lutaml::Xml::W3c::XmlLangType
|
|
22
25
|
attribute :ipr_extract, :string
|
|
23
|
-
attribute :submission_type, :string,
|
|
26
|
+
attribute :submission_type, :string,
|
|
27
|
+
values: %w[IETF IAB IRTF independent editorial],
|
|
28
|
+
default: -> { "IETF" }
|
|
24
29
|
attribute :doc_name, :string
|
|
25
|
-
attribute :sort_refs, :string,
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
attribute :sort_refs, :string,
|
|
31
|
+
values: %w[true false],
|
|
32
|
+
default: -> { "false" }
|
|
33
|
+
attribute :sym_refs, :string,
|
|
34
|
+
values: %w[true false],
|
|
35
|
+
default: -> { "true" }
|
|
36
|
+
attribute :toc_include, :string,
|
|
37
|
+
values: %w[true false],
|
|
38
|
+
default: -> { "true" }
|
|
28
39
|
attribute :toc_depth, :string, default: -> { "3" }
|
|
29
40
|
attribute :prep_time, :string
|
|
30
|
-
attribute :index_include, :string,
|
|
41
|
+
attribute :index_include, :string,
|
|
42
|
+
values: %w[true false],
|
|
43
|
+
default: -> { "true" }
|
|
31
44
|
attribute :version, :string
|
|
32
45
|
attribute :scripts, :string, default: -> { "Common,Latin" }
|
|
33
46
|
attribute :expires_date, :string
|
|
@@ -37,11 +50,14 @@ module Rfcxml
|
|
|
37
50
|
attribute :back, Back
|
|
38
51
|
|
|
39
52
|
xml do
|
|
40
|
-
|
|
53
|
+
element "rfc"
|
|
54
|
+
ordered
|
|
41
55
|
|
|
42
56
|
map_attribute "number", to: :number
|
|
43
|
-
map_attribute "obsoletes", to: :obsoletes
|
|
44
|
-
|
|
57
|
+
map_attribute "obsoletes", to: :obsoletes,
|
|
58
|
+
value_map: { to: { empty: :empty } }
|
|
59
|
+
map_attribute "updates", to: :updates,
|
|
60
|
+
value_map: { to: { empty: :empty } }
|
|
45
61
|
map_attribute "category", to: :category
|
|
46
62
|
map_attribute "mode", to: :mode
|
|
47
63
|
map_attribute "consensus", to: :consensus
|
|
@@ -59,12 +75,44 @@ module Rfcxml
|
|
|
59
75
|
map_attribute "version", to: :version
|
|
60
76
|
map_attribute "scripts", to: :scripts
|
|
61
77
|
map_attribute "expiresDate", to: :expires_date
|
|
62
|
-
map_attribute "lang", to: :lang
|
|
78
|
+
map_attribute "lang", to: :lang
|
|
63
79
|
|
|
64
80
|
%w[link front middle back].each do |element|
|
|
65
81
|
map_element element, to: element.to_sym
|
|
66
82
|
end
|
|
67
83
|
end
|
|
84
|
+
|
|
85
|
+
# Override to_xml to fix SVG elements
|
|
86
|
+
# SVG elements need xmlns="http://www.w3.org/2000/svg" attribute
|
|
87
|
+
# lutaml-model doesn't properly output xmlns when serializing SVG
|
|
88
|
+
# and it incorrectly handles <text> elements (treats them as text content)
|
|
89
|
+
def to_xml(options = {})
|
|
90
|
+
xml = super
|
|
91
|
+
return xml unless xml
|
|
92
|
+
|
|
93
|
+
# Post-process to ensure SVG elements have xmlns attribute
|
|
94
|
+
doc = Nokogiri::XML(xml)
|
|
95
|
+
svg_needs_fix = doc.xpath("//svg[not(@xmlns)]").any? ||
|
|
96
|
+
doc.xpath("//svg//*[@xmlns='http://www.w3.org/2000/svg']").any?
|
|
97
|
+
|
|
98
|
+
return xml unless svg_needs_fix
|
|
99
|
+
|
|
100
|
+
doc.xpath("//svg[not(@xmlns)]").each do |svg_elem|
|
|
101
|
+
svg_elem["xmlns"] = "http://www.w3.org/2000/svg"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Remove redundant xmlns from child elements within SVG
|
|
105
|
+
doc.xpath("//svg//*[@xmlns='http://www.w3.org/2000/svg']").each do |child|
|
|
106
|
+
child.delete("xmlns")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Preserve XML declaration if it was in the original output
|
|
110
|
+
if xml.start_with?("<?xml")
|
|
111
|
+
doc.to_xml
|
|
112
|
+
else
|
|
113
|
+
doc.root.to_xml
|
|
114
|
+
end
|
|
115
|
+
end
|
|
68
116
|
end
|
|
69
117
|
end
|
|
70
118
|
end
|
data/lib/rfcxml/v3/section.rb
CHANGED
|
@@ -2,32 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "artset"
|
|
6
|
-
require_relative "artwork"
|
|
7
|
-
require_relative "aside"
|
|
8
|
-
require_relative "author"
|
|
9
|
-
require_relative "blockquote"
|
|
10
|
-
require_relative "contact"
|
|
11
|
-
require_relative "dl"
|
|
12
|
-
require_relative "figure"
|
|
13
|
-
require_relative "iref"
|
|
14
|
-
require_relative "name"
|
|
15
|
-
require_relative "ol"
|
|
16
|
-
require_relative "sourcecode"
|
|
17
|
-
require_relative "text"
|
|
18
|
-
require_relative "table"
|
|
19
|
-
require_relative "texttable"
|
|
20
|
-
require_relative "ul"
|
|
21
|
-
|
|
22
5
|
module Rfcxml
|
|
23
6
|
module V3
|
|
24
7
|
class Section < Lutaml::Model::Serializable
|
|
25
8
|
attribute :anchor, :string
|
|
26
9
|
attribute :pn, :string
|
|
27
10
|
attribute :title, :string
|
|
28
|
-
attribute :numbered, :string,
|
|
29
|
-
|
|
30
|
-
|
|
11
|
+
attribute :numbered, :string,
|
|
12
|
+
values: %w[true false],
|
|
13
|
+
default: -> { "true" }
|
|
14
|
+
attribute :toc, :string,
|
|
15
|
+
values: %w[include exclude default],
|
|
16
|
+
default: -> { "default" }
|
|
17
|
+
attribute :remove_in_rfc, :string,
|
|
18
|
+
values: %w[true false],
|
|
19
|
+
default: -> { "false" }
|
|
31
20
|
attribute :name, Name
|
|
32
21
|
attribute :artset, Artset, collection: true
|
|
33
22
|
attribute :artwork, Artwork, collection: true
|
|
@@ -47,7 +36,8 @@ module Rfcxml
|
|
|
47
36
|
attribute :section, Section, collection: true
|
|
48
37
|
|
|
49
38
|
xml do
|
|
50
|
-
|
|
39
|
+
element "section"
|
|
40
|
+
mixed_content
|
|
51
41
|
|
|
52
42
|
map_attribute "anchor", to: :anchor
|
|
53
43
|
map_attribute "pn", to: :pn
|
|
@@ -10,13 +10,14 @@ module Rfcxml
|
|
|
10
10
|
attribute :ascii_name, :string
|
|
11
11
|
attribute :ascii_value, :string
|
|
12
12
|
attribute :status, :string
|
|
13
|
-
attribute :stream, :string
|
|
13
|
+
attribute :stream, :string,
|
|
14
|
+
values: %w[IETF IAB IRTF independent editorial]
|
|
14
15
|
|
|
15
16
|
xml do
|
|
16
|
-
|
|
17
|
+
element "seriesInfo"
|
|
17
18
|
|
|
18
|
-
map_attribute "name", to: :name
|
|
19
|
-
map_attribute "value", to: :value
|
|
19
|
+
map_attribute "name", to: :name, value_map: { to: { empty: :empty } }
|
|
20
|
+
map_attribute "value", to: :value, value_map: { to: { empty: :empty } }
|
|
20
21
|
map_attribute "asciiName", to: :ascii_name
|
|
21
22
|
map_attribute "asciiValue", to: :ascii_value
|
|
22
23
|
map_attribute "status", to: :status
|
data/lib/rfcxml/v3/sourcecode.rb
CHANGED
|
@@ -8,23 +8,27 @@ module Rfcxml
|
|
|
8
8
|
attribute :content, :string
|
|
9
9
|
attribute :anchor, :string
|
|
10
10
|
attribute :pn, :string
|
|
11
|
-
attribute :name, :string
|
|
12
|
-
attribute :type, :string
|
|
13
|
-
attribute :markers, :string
|
|
11
|
+
attribute :name, :string
|
|
12
|
+
attribute :type, :string
|
|
13
|
+
attribute :markers, :string
|
|
14
14
|
attribute :src, :string
|
|
15
15
|
attribute :original_src, :string
|
|
16
16
|
|
|
17
17
|
xml do
|
|
18
|
-
|
|
18
|
+
element "sourcecode"
|
|
19
|
+
mixed_content
|
|
19
20
|
|
|
20
21
|
map_content to: :content
|
|
21
|
-
map_attribute "anchor", to: :anchor
|
|
22
|
-
|
|
22
|
+
map_attribute "anchor", to: :anchor,
|
|
23
|
+
value_map: { to: { empty: :empty } }
|
|
24
|
+
map_attribute "pn", to: :pn, value_map: { to: { empty: :empty } }
|
|
23
25
|
map_attribute "name", to: :name, value_map: { to: { empty: :empty } }
|
|
24
26
|
map_attribute "type", to: :type, value_map: { to: { empty: :empty } }
|
|
25
|
-
map_attribute "markers", to: :markers
|
|
26
|
-
|
|
27
|
-
map_attribute "
|
|
27
|
+
map_attribute "markers", to: :markers,
|
|
28
|
+
value_map: { to: { empty: :empty } }
|
|
29
|
+
map_attribute "src", to: :src, value_map: { to: { empty: :empty } }
|
|
30
|
+
map_attribute "originalSrc", to: :original_src,
|
|
31
|
+
value_map: { to: { empty: :empty } }
|
|
28
32
|
end
|
|
29
33
|
end
|
|
30
34
|
end
|
data/lib/rfcxml/v3/spanx.rb
CHANGED
data/lib/rfcxml/v3/street.rb
CHANGED
data/lib/rfcxml/v3/strong.rb
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
|
-
require_relative "br"
|
|
5
|
-
require_relative "sup"
|
|
6
|
-
|
|
7
4
|
module Rfcxml
|
|
8
5
|
module V3
|
|
9
6
|
class Strong < Lutaml::Model::Serializable
|
|
@@ -11,17 +8,18 @@ module Rfcxml
|
|
|
11
8
|
attribute :bcp14, Bcp14, collection: true
|
|
12
9
|
attribute :br, Br, collection: true
|
|
13
10
|
attribute :cref, Cref, collection: true
|
|
14
|
-
attribute :em, Em, collection: true
|
|
11
|
+
attribute :em, "Rfcxml::V3::Em", collection: true
|
|
15
12
|
attribute :eref, Eref, collection: true
|
|
16
13
|
attribute :iref, Iref, collection: true
|
|
17
14
|
attribute :relref, Relref, collection: true
|
|
18
|
-
attribute :sub, Sub, collection: true
|
|
19
|
-
attribute :sup, Sup, collection: true
|
|
20
|
-
attribute :tt, Tt, collection: true
|
|
15
|
+
attribute :sub, "Rfcxml::V3::Sub", collection: true
|
|
16
|
+
attribute :sup, "Rfcxml::V3::Sup", collection: true
|
|
17
|
+
attribute :tt, "Rfcxml::V3::Tt", collection: true
|
|
21
18
|
attribute :xref, Xref, collection: true
|
|
22
19
|
|
|
23
20
|
xml do
|
|
24
|
-
|
|
21
|
+
element "strong"
|
|
22
|
+
ordered
|
|
25
23
|
|
|
26
24
|
map_content to: :content
|
|
27
25
|
map_element "bcp14", to: :bcp14
|
data/lib/rfcxml/v3/sub.rb
CHANGED
|
@@ -2,34 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "bcp14"
|
|
6
|
-
require_relative "cref"
|
|
7
|
-
require_relative "em"
|
|
8
|
-
require_relative "eref"
|
|
9
|
-
require_relative "iref"
|
|
10
|
-
require_relative "relref"
|
|
11
|
-
require_relative "strong"
|
|
12
|
-
require_relative "tt"
|
|
13
|
-
require_relative "xref"
|
|
14
|
-
|
|
15
5
|
module Rfcxml
|
|
16
6
|
module V3
|
|
17
7
|
class Sub < Lutaml::Model::Serializable
|
|
18
8
|
attribute :content, :string
|
|
19
9
|
attribute :bcp14, Bcp14, collection: true
|
|
20
10
|
attribute :cref, Cref, collection: true
|
|
21
|
-
attribute :em, Em, collection: true
|
|
11
|
+
attribute :em, "Rfcxml::V3::Em", collection: true
|
|
22
12
|
attribute :eref, Eref, collection: true
|
|
23
13
|
attribute :iref, Iref, collection: true
|
|
24
14
|
attribute :relref, Relref, collection: true
|
|
25
|
-
attribute :strong, Strong, collection: true
|
|
15
|
+
attribute :strong, "Rfcxml::V3::Strong", collection: true
|
|
26
16
|
attribute :sub, Sub, collection: true
|
|
27
|
-
attribute :sup, Sup, collection: true
|
|
28
|
-
attribute :tt, Tt, collection: true
|
|
17
|
+
attribute :sup, "Rfcxml::V3::Sup", collection: true
|
|
18
|
+
attribute :tt, "Rfcxml::V3::Tt", collection: true
|
|
29
19
|
attribute :xref, Xref, collection: true
|
|
30
20
|
|
|
31
21
|
xml do
|
|
32
|
-
|
|
22
|
+
element "sub"
|
|
23
|
+
ordered
|
|
33
24
|
|
|
34
25
|
map_content to: :content
|
|
35
26
|
map_element "bcp14", to: :bcp14
|
data/lib/rfcxml/v3/sup.rb
CHANGED
data/lib/rfcxml/v3/table.rb
CHANGED
|
@@ -2,12 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "iref"
|
|
6
|
-
require_relative "name"
|
|
7
|
-
require_relative "tbody"
|
|
8
|
-
require_relative "tfoot"
|
|
9
|
-
require_relative "thead"
|
|
10
|
-
|
|
11
5
|
module Rfcxml
|
|
12
6
|
module V3
|
|
13
7
|
class Table < Lutaml::Model::Serializable
|
|
@@ -21,7 +15,7 @@ module Rfcxml
|
|
|
21
15
|
attribute :tfoot, Tfoot
|
|
22
16
|
|
|
23
17
|
xml do
|
|
24
|
-
|
|
18
|
+
element "table"
|
|
25
19
|
|
|
26
20
|
map_attribute "align", to: :align
|
|
27
21
|
map_attribute "anchor", to: :anchor
|
data/lib/rfcxml/v3/tbody.rb
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "tr"
|
|
6
|
-
|
|
7
5
|
module Rfcxml
|
|
8
6
|
module V3
|
|
9
7
|
class Tbody < Lutaml::Model::Serializable
|
|
@@ -11,7 +9,7 @@ module Rfcxml
|
|
|
11
9
|
attribute :tr, Tr, collection: true
|
|
12
10
|
|
|
13
11
|
xml do
|
|
14
|
-
|
|
12
|
+
element "tbody"
|
|
15
13
|
|
|
16
14
|
map_attribute "anchor", to: :anchor
|
|
17
15
|
map_element "tr", to: :tr
|
data/lib/rfcxml/v3/td.rb
CHANGED
|
@@ -2,36 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "artset"
|
|
6
|
-
require_relative "artwork"
|
|
7
|
-
require_relative "bcp14"
|
|
8
|
-
require_relative "br"
|
|
9
|
-
require_relative "cref"
|
|
10
|
-
require_relative "dl"
|
|
11
|
-
require_relative "em"
|
|
12
|
-
require_relative "eref"
|
|
13
|
-
require_relative "figure"
|
|
14
|
-
require_relative "iref"
|
|
15
|
-
require_relative "ol"
|
|
16
|
-
require_relative "relref"
|
|
17
|
-
require_relative "sourcecode"
|
|
18
|
-
require_relative "strong"
|
|
19
|
-
require_relative "sub"
|
|
20
|
-
require_relative "sup"
|
|
21
|
-
require_relative "text"
|
|
22
|
-
require_relative "tt"
|
|
23
|
-
require_relative "u"
|
|
24
|
-
require_relative "ul"
|
|
25
|
-
require_relative "xref"
|
|
26
|
-
|
|
27
5
|
module Rfcxml
|
|
28
6
|
module V3
|
|
29
7
|
class Td < Lutaml::Model::Serializable
|
|
30
8
|
attribute :content, :string
|
|
31
9
|
attribute :anchor, :string
|
|
32
|
-
attribute :colspan, :string
|
|
33
|
-
attribute :rowspan, :string
|
|
34
|
-
attribute :align, :string,
|
|
10
|
+
attribute :colspan, :string
|
|
11
|
+
attribute :rowspan, :string
|
|
12
|
+
attribute :align, :string,
|
|
13
|
+
values: %w[left center right]
|
|
14
|
+
|
|
15
|
+
# Normalize empty string colspan/rowspan to nil.
|
|
16
|
+
# Schema default for colspan/rowspan is "1", so empty string should not
|
|
17
|
+
# be serialized as an attribute. This ensures round-trip comparison
|
|
18
|
+
# treats rowspan="" (in source) as equivalent to absent rowspan.
|
|
19
|
+
module ColspanRowspanNormalizer
|
|
20
|
+
def colspan=(value)
|
|
21
|
+
super(value.to_s.empty? ? nil : value)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def rowspan=(value)
|
|
25
|
+
super(value.to_s.empty? ? nil : value)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
prepend ColspanRowspanNormalizer
|
|
30
|
+
|
|
35
31
|
attribute :artset, Artset, collection: true
|
|
36
32
|
attribute :artwork, Artwork, collection: true
|
|
37
33
|
attribute :dl, Dl, collection: true
|
|
@@ -55,7 +51,8 @@ module Rfcxml
|
|
|
55
51
|
attribute :xref, Xref, collection: true
|
|
56
52
|
|
|
57
53
|
xml do
|
|
58
|
-
|
|
54
|
+
element "td"
|
|
55
|
+
mixed_content
|
|
59
56
|
|
|
60
57
|
map_content to: :content
|
|
61
58
|
map_attribute "anchor", to: :anchor
|
data/lib/rfcxml/v3/text.rb
CHANGED
|
@@ -2,27 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "bcp14"
|
|
6
|
-
require_relative "br"
|
|
7
|
-
require_relative "contact"
|
|
8
|
-
require_relative "cref"
|
|
9
|
-
require_relative "em"
|
|
10
|
-
require_relative "eref"
|
|
11
|
-
require_relative "iref"
|
|
12
|
-
require_relative "relref"
|
|
13
|
-
require_relative "spanx"
|
|
14
|
-
require_relative "strong"
|
|
15
|
-
require_relative "sub"
|
|
16
|
-
require_relative "sup"
|
|
17
|
-
require_relative "tt"
|
|
18
|
-
require_relative "u"
|
|
19
|
-
require_relative "vspace"
|
|
20
|
-
require_relative "xref"
|
|
21
|
-
|
|
22
5
|
module Rfcxml
|
|
23
6
|
module V3
|
|
24
|
-
class List < Lutaml::Model::Serializable; end
|
|
25
|
-
|
|
26
7
|
class Text < Lutaml::Model::Serializable
|
|
27
8
|
attribute :content, :string
|
|
28
9
|
attribute :anchor, :string
|
|
@@ -50,7 +31,8 @@ module Rfcxml
|
|
|
50
31
|
attribute :xref, Xref, collection: true
|
|
51
32
|
|
|
52
33
|
xml do
|
|
53
|
-
|
|
34
|
+
element "t"
|
|
35
|
+
mixed_content
|
|
54
36
|
|
|
55
37
|
map_content to: :content
|
|
56
38
|
map_attribute "anchor", to: :anchor
|
data/lib/rfcxml/v3/texttable.rb
CHANGED
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "c"
|
|
6
|
-
require_relative "name"
|
|
7
|
-
require_relative "postamble"
|
|
8
|
-
require_relative "preamble"
|
|
9
|
-
require_relative "ttcol"
|
|
10
|
-
|
|
11
5
|
module Rfcxml
|
|
12
6
|
module V3
|
|
13
7
|
class Texttable < Lutaml::Model::Serializable
|
|
14
8
|
attribute :anchor, :string
|
|
15
|
-
attribute :title, :string
|
|
16
|
-
attribute :suppress_title, :string,
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
attribute :title, :string
|
|
10
|
+
attribute :suppress_title, :string,
|
|
11
|
+
values: %w[true false],
|
|
12
|
+
default: -> { "false" }
|
|
13
|
+
attribute :align, :string,
|
|
14
|
+
values: %w[left center right],
|
|
15
|
+
default: -> { "center" }
|
|
16
|
+
attribute :style, :string,
|
|
17
|
+
values: %w[all none headers full],
|
|
18
|
+
default: -> { "full" }
|
|
19
19
|
attribute :name, Name
|
|
20
20
|
attribute :preamble, Preamble
|
|
21
21
|
attribute :ttcol, Ttcol, collection: true
|
|
@@ -23,10 +23,10 @@ module Rfcxml
|
|
|
23
23
|
attribute :postamble, Postamble
|
|
24
24
|
|
|
25
25
|
xml do
|
|
26
|
-
|
|
26
|
+
element "texttable"
|
|
27
27
|
|
|
28
28
|
map_attribute "anchor", to: :anchor
|
|
29
|
-
map_attribute "title", to: :title
|
|
29
|
+
map_attribute "title", to: :title, value_map: { to: { empty: :empty } }
|
|
30
30
|
map_attribute "suppress-title", to: :suppress_title
|
|
31
31
|
map_attribute "align", to: :align
|
|
32
32
|
map_attribute "style", to: :style
|
data/lib/rfcxml/v3/tfoot.rb
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "tr"
|
|
6
|
-
|
|
7
5
|
module Rfcxml
|
|
8
6
|
module V3
|
|
9
7
|
class Tfoot < Lutaml::Model::Serializable
|
|
@@ -11,7 +9,7 @@ module Rfcxml
|
|
|
11
9
|
attribute :tr, Tr, collection: true
|
|
12
10
|
|
|
13
11
|
xml do
|
|
14
|
-
|
|
12
|
+
element "tfoot"
|
|
15
13
|
|
|
16
14
|
map_attribute "anchor", to: :anchor
|
|
17
15
|
map_element "tr", to: :tr
|
data/lib/rfcxml/v3/th.rb
CHANGED
data/lib/rfcxml/v3/thead.rb
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "tr"
|
|
6
|
-
|
|
7
5
|
module Rfcxml
|
|
8
6
|
module V3
|
|
9
7
|
class Thead < Lutaml::Model::Serializable
|
|
@@ -11,7 +9,7 @@ module Rfcxml
|
|
|
11
9
|
attribute :tr, Tr, collection: true
|
|
12
10
|
|
|
13
11
|
xml do
|
|
14
|
-
|
|
12
|
+
element "thead"
|
|
15
13
|
|
|
16
14
|
map_attribute "anchor", to: :anchor
|
|
17
15
|
map_element "tr", to: :tr
|
data/lib/rfcxml/v3/title.rb
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "br"
|
|
6
|
-
|
|
7
5
|
module Rfcxml
|
|
8
6
|
module V3
|
|
9
7
|
class Title < Lutaml::Model::Serializable
|
|
@@ -13,10 +11,11 @@ module Rfcxml
|
|
|
13
11
|
attribute :br, Br, collection: true
|
|
14
12
|
|
|
15
13
|
xml do
|
|
16
|
-
|
|
14
|
+
element "title"
|
|
17
15
|
|
|
18
16
|
map_content to: :content
|
|
19
|
-
map_attribute "abbrev", to: :abbrev
|
|
17
|
+
map_attribute "abbrev", to: :abbrev,
|
|
18
|
+
value_map: { to: { empty: :empty } }
|
|
20
19
|
map_attribute "ascii", to: :ascii
|
|
21
20
|
map_element "br", to: :br
|
|
22
21
|
end
|
data/lib/rfcxml/v3/toc.rb
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "section"
|
|
6
|
-
|
|
7
5
|
module Rfcxml
|
|
8
6
|
module V3
|
|
9
7
|
class Toc < Lutaml::Model::Serializable
|
|
10
8
|
attribute :section, Section, collection: true
|
|
11
9
|
|
|
12
10
|
xml do
|
|
13
|
-
|
|
11
|
+
element "toc"
|
|
14
12
|
|
|
15
13
|
map_element "section", to: :section
|
|
16
14
|
end
|
data/lib/rfcxml/v3/tr.rb
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
require "lutaml/model"
|
|
4
4
|
|
|
5
|
-
require_relative "td"
|
|
6
|
-
require_relative "th"
|
|
7
|
-
|
|
8
5
|
module Rfcxml
|
|
9
6
|
module V3
|
|
10
7
|
class Tr < Lutaml::Model::Serializable
|
|
@@ -13,7 +10,9 @@ module Rfcxml
|
|
|
13
10
|
attribute :th, Th, collection: true
|
|
14
11
|
|
|
15
12
|
xml do
|
|
16
|
-
|
|
13
|
+
element "tr"
|
|
14
|
+
ordered
|
|
15
|
+
mixed_content
|
|
17
16
|
|
|
18
17
|
map_attribute "anchor", to: :anchor
|
|
19
18
|
map_element "td", to: :td
|