rfcxml 0.3.0 → 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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/roundtrip.yml +79 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +9 -3
  5. data/.rubocop_todo.yml +86 -20
  6. data/Gemfile +3 -1
  7. data/README.adoc +255 -35
  8. data/Rakefile +55 -0
  9. data/lib/rfcxml/v3/abstract.rb +2 -1
  10. data/lib/rfcxml/v3/address.rb +2 -1
  11. data/lib/rfcxml/v3/annotation.rb +2 -1
  12. data/lib/rfcxml/v3/area.rb +1 -1
  13. data/lib/rfcxml/v3/artset.rb +2 -1
  14. data/lib/rfcxml/v3/artwork.rb +13 -10
  15. data/lib/rfcxml/v3/aside.rb +2 -1
  16. data/lib/rfcxml/v3/author.rb +16 -9
  17. data/lib/rfcxml/v3/back.rb +2 -1
  18. data/lib/rfcxml/v3/bcp14.rb +1 -1
  19. data/lib/rfcxml/v3/blockquote.rb +2 -1
  20. data/lib/rfcxml/v3/boilerplate.rb +2 -1
  21. data/lib/rfcxml/v3/br.rb +1 -1
  22. data/lib/rfcxml/v3/c.rb +2 -1
  23. data/lib/rfcxml/v3/city.rb +1 -1
  24. data/lib/rfcxml/v3/cityarea.rb +1 -1
  25. data/lib/rfcxml/v3/code.rb +1 -1
  26. data/lib/rfcxml/v3/contact.rb +2 -1
  27. data/lib/rfcxml/v3/country.rb +1 -1
  28. data/lib/rfcxml/v3/cref.rb +2 -1
  29. data/lib/rfcxml/v3/date.rb +4 -4
  30. data/lib/rfcxml/v3/dd.rb +2 -1
  31. data/lib/rfcxml/v3/displayreference.rb +1 -1
  32. data/lib/rfcxml/v3/dl.rb +2 -1
  33. data/lib/rfcxml/v3/dt.rb +2 -1
  34. data/lib/rfcxml/v3/email.rb +1 -1
  35. data/lib/rfcxml/v3/eref.rb +1 -1
  36. data/lib/rfcxml/v3/extaddr.rb +1 -1
  37. data/lib/rfcxml/v3/facsimile.rb +1 -1
  38. data/lib/rfcxml/v3/figure.rb +17 -11
  39. data/lib/rfcxml/v3/format.rb +1 -1
  40. data/lib/rfcxml/v3/front.rb +2 -1
  41. data/lib/rfcxml/v3/iref.rb +4 -3
  42. data/lib/rfcxml/v3/keyword.rb +1 -1
  43. data/lib/rfcxml/v3/li.rb +2 -1
  44. data/lib/rfcxml/v3/link.rb +1 -1
  45. data/lib/rfcxml/v3/list.rb +2 -1
  46. data/lib/rfcxml/v3/middle.rb +2 -1
  47. data/lib/rfcxml/v3/name.rb +2 -1
  48. data/lib/rfcxml/v3/note.rb +2 -1
  49. data/lib/rfcxml/v3/ol.rb +5 -2
  50. data/lib/rfcxml/v3/organization.rb +10 -5
  51. data/lib/rfcxml/v3/phone.rb +1 -1
  52. data/lib/rfcxml/v3/pobox.rb +1 -1
  53. data/lib/rfcxml/v3/postal.rb +2 -1
  54. data/lib/rfcxml/v3/postal_line.rb +1 -1
  55. data/lib/rfcxml/v3/postamble.rb +2 -1
  56. data/lib/rfcxml/v3/preamble.rb +2 -1
  57. data/lib/rfcxml/v3/refcontent.rb +2 -1
  58. data/lib/rfcxml/v3/reference.rb +7 -4
  59. data/lib/rfcxml/v3/referencegroup.rb +2 -1
  60. data/lib/rfcxml/v3/references.rb +2 -1
  61. data/lib/rfcxml/v3/region.rb +1 -1
  62. data/lib/rfcxml/v3/relref.rb +1 -1
  63. data/lib/rfcxml/v3/rfc.rb +60 -12
  64. data/lib/rfcxml/v3/section.rb +11 -4
  65. data/lib/rfcxml/v3/series_info.rb +5 -4
  66. data/lib/rfcxml/v3/sortingcode.rb +1 -1
  67. data/lib/rfcxml/v3/sourcecode.rb +13 -9
  68. data/lib/rfcxml/v3/spanx.rb +1 -1
  69. data/lib/rfcxml/v3/street.rb +1 -1
  70. data/lib/rfcxml/v3/strong.rb +2 -1
  71. data/lib/rfcxml/v3/sub.rb +2 -1
  72. data/lib/rfcxml/v3/sup.rb +2 -1
  73. data/lib/rfcxml/v3/table.rb +1 -1
  74. data/lib/rfcxml/v3/tbody.rb +1 -1
  75. data/lib/rfcxml/v3/td.rb +23 -4
  76. data/lib/rfcxml/v3/text.rb +2 -1
  77. data/lib/rfcxml/v3/texttable.rb +12 -6
  78. data/lib/rfcxml/v3/tfoot.rb +1 -1
  79. data/lib/rfcxml/v3/th.rb +1 -1
  80. data/lib/rfcxml/v3/thead.rb +1 -1
  81. data/lib/rfcxml/v3/title.rb +3 -2
  82. data/lib/rfcxml/v3/toc.rb +1 -1
  83. data/lib/rfcxml/v3/tr.rb +3 -1
  84. data/lib/rfcxml/v3/tt.rb +1 -1
  85. data/lib/rfcxml/v3/ttcol.rb +4 -2
  86. data/lib/rfcxml/v3/u.rb +1 -1
  87. data/lib/rfcxml/v3/ul.rb +10 -4
  88. data/lib/rfcxml/v3/uri.rb +1 -1
  89. data/lib/rfcxml/v3/vspace.rb +1 -1
  90. data/lib/rfcxml/v3/workgroup.rb +1 -1
  91. data/lib/rfcxml/v3/xref.rb +2 -1
  92. data/lib/rfcxml/version.rb +1 -1
  93. data/lib/rfcxml.rb +1 -0
  94. data/scripts/README.md +110 -0
  95. data/scripts/roundtrip_test.rb +361 -0
  96. metadata +5 -2
@@ -10,7 +10,8 @@ module Rfcxml
10
10
  include XrefText
11
11
 
12
12
  xml do
13
- root "refcontent"
13
+ element "refcontent"
14
+ ordered
14
15
 
15
16
  map_content to: :content
16
17
  map_element "bcp14", to: :bcp14
@@ -8,8 +8,9 @@ module Rfcxml
8
8
  attribute :anchor, :string
9
9
  attribute :derived_anchor, :string
10
10
  attribute :target, :string
11
- # attribute :quote_title, :string, default: -> { "true" }
12
- attribute :quote_title, :string
11
+ attribute :quote_title, :string,
12
+ values: %w[true false],
13
+ default: -> { "true" }
13
14
  attribute :stream, :string
14
15
  attribute :front, Front
15
16
  attribute :annotation, Annotation, collection: true
@@ -18,11 +19,13 @@ module Rfcxml
18
19
  attribute :series_info, SeriesInfo, collection: true
19
20
 
20
21
  xml do
21
- root "reference", mixed: true
22
+ element "reference"
23
+ mixed_content
22
24
 
23
25
  map_attribute "anchor", to: :anchor
24
26
  map_attribute "derivedAnchor", to: :derived_anchor
25
- map_attribute "target", to: :target
27
+ map_attribute "target", to: :target,
28
+ value_map: { to: { empty: :empty } }
26
29
  map_attribute "quoteTitle", to: :quote_title
27
30
  # map_attribute "quote-title", to: :quote_title
28
31
  map_element "stream", to: :stream
@@ -11,7 +11,8 @@ module Rfcxml
11
11
  attribute :reference, Reference, collection: true
12
12
 
13
13
  xml do
14
- root "referencegroup"
14
+ element "referencegroup"
15
+ ordered
15
16
 
16
17
  map_attribute "anchor", to: :anchor
17
18
  map_attribute "derivedAnchor", to: :derived_anchor
@@ -14,7 +14,8 @@ module Rfcxml
14
14
  attribute :referencegroup, Referencegroup, collection: true
15
15
 
16
16
  xml do
17
- root "references"
17
+ element "references"
18
+ ordered
18
19
 
19
20
  map_attribute "pn", to: :pn
20
21
  map_attribute "anchor", to: :anchor
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :ascii, :string
10
10
 
11
11
  xml do
12
- root "region"
12
+ element "region"
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "ascii", to: :ascii
@@ -14,7 +14,7 @@ module Rfcxml
14
14
  attribute :derived_link, :string
15
15
 
16
16
  xml do
17
- root "relref"
17
+ element "relref"
18
18
 
19
19
  map_content to: :content
20
20
  map_attribute "target", to: :target
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, default: -> { "" }
15
- attribute :updates, :string, default: -> { "" }
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, default: -> { "false" }
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
24
  attribute :lang, Lutaml::Xml::W3c::XmlLangType
22
25
  attribute :ipr_extract, :string
23
- attribute :submission_type, :string, default: -> { "IETF" }
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, default: -> { "false" }
26
- attribute :sym_refs, :string, default: -> { "true" }
27
- attribute :toc_include, :string, default: -> { "true" }
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, default: -> { "true" }
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
- root "rfc"
53
+ element "rfc"
54
+ ordered
41
55
 
42
56
  map_attribute "number", to: :number
43
- map_attribute "obsoletes", to: :obsoletes
44
- map_attribute "updates", to: :updates
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
@@ -65,6 +81,38 @@ module Rfcxml
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
@@ -8,9 +8,15 @@ module Rfcxml
8
8
  attribute :anchor, :string
9
9
  attribute :pn, :string
10
10
  attribute :title, :string
11
- attribute :numbered, :string, default: -> { "true" }
12
- attribute :toc, :string, default: -> { "default" }
13
- attribute :remove_in_rfc, :string, default: -> { "false" }
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" }
14
20
  attribute :name, Name
15
21
  attribute :artset, Artset, collection: true
16
22
  attribute :artwork, Artwork, collection: true
@@ -30,7 +36,8 @@ module Rfcxml
30
36
  attribute :section, Section, collection: true
31
37
 
32
38
  xml do
33
- root "section", mixed: true
39
+ element "section"
40
+ mixed_content
34
41
 
35
42
  map_attribute "anchor", to: :anchor
36
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
- root "seriesInfo"
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
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :ascii, :string
10
10
 
11
11
  xml do
12
- root "sortingcode"
12
+ element "sortingcode"
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "ascii", to: :ascii
@@ -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, default: -> { "" }
12
- attribute :type, :string, default: -> { "" }
13
- attribute :markers, :string, default: -> { "false" }
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
- root "sourcecode"
18
+ element "sourcecode"
19
+ mixed_content
19
20
 
20
21
  map_content to: :content
21
- map_attribute "anchor", to: :anchor
22
- map_attribute "pn", to: :pn
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
- map_attribute "src", to: :src
27
- map_attribute "originalSrc", to: :original_src
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
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :style, :string, default: -> { "emph" }
10
10
 
11
11
  xml do
12
- root "spanx"
12
+ element "spanx"
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "style", to: :style
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :ascii, :string
10
10
 
11
11
  xml do
12
- root "street"
12
+ element "street"
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "ascii", to: :ascii
@@ -18,7 +18,8 @@ module Rfcxml
18
18
  attribute :xref, Xref, collection: true
19
19
 
20
20
  xml do
21
- root "strong"
21
+ element "strong"
22
+ ordered
22
23
 
23
24
  map_content to: :content
24
25
  map_element "bcp14", to: :bcp14
data/lib/rfcxml/v3/sub.rb CHANGED
@@ -19,7 +19,8 @@ module Rfcxml
19
19
  attribute :xref, Xref, collection: true
20
20
 
21
21
  xml do
22
- root "sub"
22
+ element "sub"
23
+ ordered
23
24
 
24
25
  map_content to: :content
25
26
  map_element "bcp14", to: :bcp14
data/lib/rfcxml/v3/sup.rb CHANGED
@@ -6,7 +6,8 @@ module Rfcxml
6
6
  module V3
7
7
  class Sup < Sub
8
8
  xml do
9
- root "sup"
9
+ element "sup"
10
+ ordered
10
11
 
11
12
  map_content to: :content
12
13
  map_element "bcp14", to: :bcp14
@@ -15,7 +15,7 @@ module Rfcxml
15
15
  attribute :tfoot, Tfoot
16
16
 
17
17
  xml do
18
- root "table"
18
+ element "table"
19
19
 
20
20
  map_attribute "align", to: :align
21
21
  map_attribute "anchor", to: :anchor
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :tr, Tr, collection: true
10
10
 
11
11
  xml do
12
- root "tbody"
12
+ element "tbody"
13
13
 
14
14
  map_attribute "anchor", to: :anchor
15
15
  map_element "tr", to: :tr
data/lib/rfcxml/v3/td.rb CHANGED
@@ -7,9 +7,27 @@ module Rfcxml
7
7
  class Td < Lutaml::Model::Serializable
8
8
  attribute :content, :string
9
9
  attribute :anchor, :string
10
- attribute :colspan, :string, default: -> { "1" }
11
- attribute :rowspan, :string, default: -> { "1" }
12
- attribute :align, :string, default: -> { "left" }
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
+
13
31
  attribute :artset, Artset, collection: true
14
32
  attribute :artwork, Artwork, collection: true
15
33
  attribute :dl, Dl, collection: true
@@ -33,7 +51,8 @@ module Rfcxml
33
51
  attribute :xref, Xref, collection: true
34
52
 
35
53
  xml do
36
- root "td"
54
+ element "td"
55
+ mixed_content
37
56
 
38
57
  map_content to: :content
39
58
  map_attribute "anchor", to: :anchor
@@ -31,7 +31,8 @@ module Rfcxml
31
31
  attribute :xref, Xref, collection: true
32
32
 
33
33
  xml do
34
- root "t", mixed: true
34
+ element "t"
35
+ mixed_content
35
36
 
36
37
  map_content to: :content
37
38
  map_attribute "anchor", to: :anchor
@@ -6,10 +6,16 @@ module Rfcxml
6
6
  module V3
7
7
  class Texttable < Lutaml::Model::Serializable
8
8
  attribute :anchor, :string
9
- attribute :title, :string, default: -> { "" }
10
- attribute :suppress_title, :string, default: -> { "false" }
11
- attribute :align, :string, default: -> { "center" }
12
- attribute :style, :string, default: -> { "full" }
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" }
13
19
  attribute :name, Name
14
20
  attribute :preamble, Preamble
15
21
  attribute :ttcol, Ttcol, collection: true
@@ -17,10 +23,10 @@ module Rfcxml
17
23
  attribute :postamble, Postamble
18
24
 
19
25
  xml do
20
- root "texttable"
26
+ element "texttable"
21
27
 
22
28
  map_attribute "anchor", to: :anchor
23
- map_attribute "title", to: :title
29
+ map_attribute "title", to: :title, value_map: { to: { empty: :empty } }
24
30
  map_attribute "suppress-title", to: :suppress_title
25
31
  map_attribute "align", to: :align
26
32
  map_attribute "style", to: :style
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :tr, Tr, collection: true
10
10
 
11
11
  xml do
12
- root "tfoot"
12
+ element "tfoot"
13
13
 
14
14
  map_attribute "anchor", to: :anchor
15
15
  map_element "tr", to: :tr
data/lib/rfcxml/v3/th.rb CHANGED
@@ -5,7 +5,7 @@ module Rfcxml
5
5
  module V3
6
6
  class Th < Td
7
7
  xml do
8
- root "th"
8
+ element "th"
9
9
  end
10
10
  end
11
11
  end
@@ -9,7 +9,7 @@ module Rfcxml
9
9
  attribute :tr, Tr, collection: true
10
10
 
11
11
  xml do
12
- root "thead"
12
+ element "thead"
13
13
 
14
14
  map_attribute "anchor", to: :anchor
15
15
  map_element "tr", to: :tr
@@ -11,10 +11,11 @@ module Rfcxml
11
11
  attribute :br, Br, collection: true
12
12
 
13
13
  xml do
14
- root "title"
14
+ element "title"
15
15
 
16
16
  map_content to: :content
17
- map_attribute "abbrev", to: :abbrev
17
+ map_attribute "abbrev", to: :abbrev,
18
+ value_map: { to: { empty: :empty } }
18
19
  map_attribute "ascii", to: :ascii
19
20
  map_element "br", to: :br
20
21
  end
data/lib/rfcxml/v3/toc.rb CHANGED
@@ -8,7 +8,7 @@ module Rfcxml
8
8
  attribute :section, Section, collection: true
9
9
 
10
10
  xml do
11
- root "toc"
11
+ element "toc"
12
12
 
13
13
  map_element "section", to: :section
14
14
  end
data/lib/rfcxml/v3/tr.rb CHANGED
@@ -10,7 +10,9 @@ module Rfcxml
10
10
  attribute :th, Th, collection: true
11
11
 
12
12
  xml do
13
- root "tr"
13
+ element "tr"
14
+ ordered
15
+ mixed_content
14
16
 
15
17
  map_attribute "anchor", to: :anchor
16
18
  map_element "td", to: :td
data/lib/rfcxml/v3/tt.rb CHANGED
@@ -19,7 +19,7 @@ module Rfcxml
19
19
  attribute :xref, Xref, collection: true
20
20
 
21
21
  xml do
22
- root "tt"
22
+ element "tt"
23
23
 
24
24
  map_content to: :content
25
25
  map_element "bcp14", to: :bcp14
@@ -7,14 +7,16 @@ module Rfcxml
7
7
  class Ttcol < Lutaml::Model::Serializable
8
8
  attribute :content, :string
9
9
  attribute :width, :string
10
- attribute :align, :string, default: -> { "left" }
10
+ attribute :align, :string,
11
+ values: %w[left center right],
12
+ default: -> { "left" }
11
13
  attribute :cref, Cref, collection: true
12
14
  attribute :eref, Eref, collection: true
13
15
  attribute :iref, Iref, collection: true
14
16
  attribute :xref, Xref, collection: true
15
17
 
16
18
  xml do
17
- root "ttcol"
19
+ element "ttcol"
18
20
 
19
21
  map_content to: :content
20
22
  map_attribute "width", to: :width
data/lib/rfcxml/v3/u.rb CHANGED
@@ -12,7 +12,7 @@ module Rfcxml
12
12
  attribute :pn, :string
13
13
 
14
14
  xml do
15
- root "u"
15
+ element "u"
16
16
 
17
17
  map_content to: :content
18
18
  map_attribute "anchor", to: :anchor
data/lib/rfcxml/v3/ul.rb CHANGED
@@ -6,15 +6,21 @@ module Rfcxml
6
6
  module V3
7
7
  class Ul < Lutaml::Model::Serializable
8
8
  attribute :anchor, :string
9
- attribute :spacing, :string, default: -> { "normal" }
10
- attribute :empty, :string, default: -> { "false" }
11
- attribute :bare, :string, default: -> { "false" }
9
+ attribute :spacing, :string,
10
+ values: %w[normal compact],
11
+ default: -> { "normal" }
12
+ attribute :empty, :string,
13
+ values: %w[true false],
14
+ default: -> { "false" }
15
+ attribute :bare, :string,
16
+ values: %w[true false],
17
+ default: -> { "false" }
12
18
  attribute :indent, :string, default: -> { "3" }
13
19
  attribute :pn, :string
14
20
  attribute :li, Li, collection: true
15
21
 
16
22
  xml do
17
- root "ul"
23
+ element "ul"
18
24
 
19
25
  map_attribute "anchor", to: :anchor
20
26
  map_attribute "spacing", to: :spacing
data/lib/rfcxml/v3/uri.rb CHANGED
@@ -8,7 +8,7 @@ module Rfcxml
8
8
  attribute :content, :string
9
9
 
10
10
  xml do
11
- root "uri"
11
+ element "uri"
12
12
 
13
13
  map_content to: :content
14
14
  end
@@ -8,7 +8,7 @@ module Rfcxml
8
8
  attribute :blank_lines, :string, default: -> { "0" }
9
9
 
10
10
  xml do
11
- root "vspace"
11
+ element "vspace"
12
12
 
13
13
  map_attribute "blankLines", to: :blank_lines
14
14
  end
@@ -8,7 +8,7 @@ module Rfcxml
8
8
  attribute :content, :string
9
9
 
10
10
  xml do
11
- root "workgroup"
11
+ element "workgroup"
12
12
 
13
13
  map_content to: :content
14
14
  end
@@ -17,7 +17,8 @@ module Rfcxml
17
17
  include XrefText
18
18
 
19
19
  xml do
20
- root "xref"
20
+ element "xref"
21
+ mixed_content
21
22
 
22
23
  map_content to: :content
23
24
  map_attribute "target", to: :target
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfcxml
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/rfcxml.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/model"
4
+ require "lutaml/xml"
4
5
 
5
6
  Lutaml::Model::Config.configure do |config|
6
7
  config.xml_adapter_type = :nokogiri