rfcxml 0.2.0 → 0.3.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +30 -8
  3. data/Gemfile +6 -4
  4. data/README.adoc +166 -18
  5. data/lib/rfcxml/v3/abstract.rb +0 -5
  6. data/lib/rfcxml/v3/address.rb +0 -6
  7. data/lib/rfcxml/v3/annotation.rb +0 -14
  8. data/lib/rfcxml/v3/artset.rb +0 -2
  9. data/lib/rfcxml/v3/artwork.rb +3 -3
  10. data/lib/rfcxml/v3/aside.rb +0 -11
  11. data/lib/rfcxml/v3/author.rb +0 -3
  12. data/lib/rfcxml/v3/back.rb +0 -4
  13. data/lib/rfcxml/v3/blockquote.rb +5 -46
  14. data/lib/rfcxml/v3/boilerplate.rb +0 -2
  15. data/lib/rfcxml/v3/c.rb +0 -6
  16. data/lib/rfcxml/v3/contact.rb +0 -3
  17. data/lib/rfcxml/v3/cref.rb +0 -10
  18. data/lib/rfcxml/v3/dd.rb +5 -47
  19. data/lib/rfcxml/v3/dl.rb +0 -6
  20. data/lib/rfcxml/v3/dt.rb +5 -25
  21. data/lib/rfcxml/v3/figure.rb +5 -15
  22. data/lib/rfcxml/v3/front.rb +0 -12
  23. data/lib/rfcxml/v3/li.rb +5 -50
  24. data/lib/rfcxml/v3/list.rb +1 -3
  25. data/lib/rfcxml/v3/middle.rb +0 -2
  26. data/lib/rfcxml/v3/name.rb +0 -13
  27. data/lib/rfcxml/v3/note.rb +0 -6
  28. data/lib/rfcxml/v3/ol.rb +0 -2
  29. data/lib/rfcxml/v3/postal.rb +0 -11
  30. data/lib/rfcxml/v3/postamble.rb +0 -6
  31. data/lib/rfcxml/v3/preamble.rb +0 -14
  32. data/lib/rfcxml/v3/refcontent.rb +0 -3
  33. data/lib/rfcxml/v3/reference.rb +0 -6
  34. data/lib/rfcxml/v3/referencegroup.rb +0 -2
  35. data/lib/rfcxml/v3/references.rb +0 -4
  36. data/lib/rfcxml/v3/rfc.rb +6 -6
  37. data/lib/rfcxml/v3/section.rb +0 -17
  38. data/lib/rfcxml/v3/sourcecode.rb +2 -2
  39. data/lib/rfcxml/v3/strong.rb +4 -7
  40. data/lib/rfcxml/v3/sub.rb +4 -14
  41. data/lib/rfcxml/v3/sup.rb +0 -2
  42. data/lib/rfcxml/v3/table.rb +0 -6
  43. data/lib/rfcxml/v3/tbody.rb +0 -2
  44. data/lib/rfcxml/v3/td.rb +5 -43
  45. data/lib/rfcxml/v3/text.rb +0 -19
  46. data/lib/rfcxml/v3/texttable.rb +0 -6
  47. data/lib/rfcxml/v3/tfoot.rb +0 -2
  48. data/lib/rfcxml/v3/th.rb +0 -2
  49. data/lib/rfcxml/v3/thead.rb +0 -2
  50. data/lib/rfcxml/v3/title.rb +0 -2
  51. data/lib/rfcxml/v3/toc.rb +0 -2
  52. data/lib/rfcxml/v3/tr.rb +0 -3
  53. data/lib/rfcxml/v3/tt.rb +4 -18
  54. data/lib/rfcxml/v3/ttcol.rb +0 -5
  55. data/lib/rfcxml/v3/ul.rb +0 -2
  56. data/lib/rfcxml/v3/xref.rb +2 -3
  57. data/lib/rfcxml/v3/xref_text.rb +7 -16
  58. data/lib/rfcxml/v3.rb +100 -2
  59. data/lib/rfcxml/version.rb +1 -1
  60. data/lib/rfcxml.rb +2 -4
  61. data/rfcxml.gemspec +4 -17
  62. metadata +10 -94
  63. data/lib/rfcxml/v3/em.rb +0 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5efe8a260bf98e3225ba28754c0fac980f1efb22d074086857215da8d3fda2e9
4
- data.tar.gz: ab5895433c94c49a1f0f53a477d95a770713bdd43f6e5d52840a4008c9bd4ab0
3
+ metadata.gz: 53aebb436f8ea53c627fba3203b2fa9f0186b8f7ac0f4ffd794d2426728172ed
4
+ data.tar.gz: 7cac09e19781c1bbb31820aaa40bbc7df7f8cb35b7306fbc87496429cf1e7135
5
5
  SHA512:
6
- metadata.gz: 2b96f27d45079fddbe254816477f7ca6d7a36e70271fbc54abe3d2d7aaafb27fd1dad991471dbbc847c5e3932f4d5f60bbd4c8aa72fc9718532fb89d123076a2
7
- data.tar.gz: d50e0ecc6b2325dd398c2e43669e21d5ecca7437f083c894cea95f9710f2e5c4014fd37b5f92bae46db88949183e571ae08f43886dfd799ddea622e8c67587c9
6
+ metadata.gz: ea24ee3e3386a8907be82e4a54e6616900b75ec4143ff4bad0e6d79a6d6da8215d7350e778f8f07850156f4789ab010ebc5d0d82533fbaa3a6503496b3a50589
7
+ data.tar.gz: 3f3a69b7bfd73af3b56fac723256aabcc820c81b572003381ede682f41a0f84535f007465d0368a9644163f930673722f14817800b2e15986eeffcb3529c51c8
data/.rubocop_todo.yml CHANGED
@@ -1,20 +1,42 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-07 10:02:25 UTC using RuboCop version 1.69.2.
3
+ # on 2026-03-18 06:11:32 UTC using RuboCop version 1.85.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Severity, Include.
11
- # Include: **/*.gemspec
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ Gemspec/RequireMFA:
12
+ Exclude:
13
+ - 'rfcxml.gemspec'
14
+
15
+ # Offense count: 1
12
16
  Gemspec/RequiredRubyVersion:
13
17
  Exclude:
14
18
  - 'rfcxml.gemspec'
15
19
 
16
- # Offense count: 6
17
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
18
- # AllowedMethods: refine
19
- Metrics/BlockLength:
20
- Max: 34
20
+ # Offense count: 1
21
+ # This cop supports safe autocorrection (--autocorrect).
22
+ # Configuration parameters: EnforcedStyle.
23
+ # SupportedStyles: normal, indented_internal_methods
24
+ Layout/IndentationConsistency:
25
+ Exclude:
26
+ - 'rfcxml.gemspec'
27
+
28
+ # Offense count: 1
29
+ # This cop supports safe autocorrection (--autocorrect).
30
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
31
+ # URISchemes: http, https
32
+ Layout/LineLength:
33
+ Exclude:
34
+ - 'lib/rfcxml/v3/li.rb'
35
+
36
+ # Offense count: 2
37
+ # This cop supports safe autocorrection (--autocorrect).
38
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
39
+ # SupportedStyles: single_quotes, double_quotes
40
+ Style/StringLiterals:
41
+ Exclude:
42
+ - 'rfcxml.gemspec'
data/Gemfile CHANGED
@@ -2,11 +2,13 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- # Specify your gem's dependencies in rfcxml.gemspec
5
+ # Specify your gem's dependencies in genericode.gemspec
6
6
  gemspec
7
7
 
8
+ gem "canon"
9
+ gem "lutaml-model", github: "lutaml/lutaml-model", ref: "main"
10
+ gem "nokogiri"
8
11
  gem "rake", "~> 13.0"
9
-
10
12
  gem "rspec", "~> 3.0"
11
-
12
- gem "rubocop", "~> 1.21"
13
+ gem "rubocop"
14
+ gem "rubocop-performance"
data/README.adoc CHANGED
@@ -1,8 +1,27 @@
1
1
  = RFC XML Ruby library
2
2
 
3
- The `rfcxml` library is a parser and generator for RFC XML documents. It is
4
- intended to be used to parse and generate RFC XML v3 documents.
3
+ The `rfcxml` library is a parser and generator for RFC XML v3 documents.
4
+ It provides bidirectional XML serialization using the lutaml-model framework,
5
+ enabling perfect round-trips with namespace preservation.
5
6
 
7
+ == Features
8
+
9
+ - Parse RFC XML v3 documents into Ruby objects
10
+ - Generate RFC XML v3 documents from Ruby objects
11
+ - Perfect round-trip preservation (namespaces, `xml:lang`, etc.)
12
+ - Full support for all RFC XML v3 elements
13
+ - Built on lutaml-model for declarative XML mapping
14
+
15
+ == Requirements
16
+
17
+ - Ruby >= 3.2.0
18
+ - lutaml-model ~> 0.8.0 (required for namespace preservation and `xml:lang` support)
19
+
20
+ The lutaml-model 0.8.0 dependency provides:
21
+
22
+ - Automatic namespace declaration preservation (`xmlns:*` attributes)
23
+ - Built-in `Lutaml::Xml::W3c::XmlLangType` for `xml:lang` attribute handling
24
+ - Perfect XML round-trip support
6
25
 
7
26
  == Installation
8
27
 
@@ -27,47 +46,176 @@ Or install it yourself as:
27
46
  $ gem install rfcxml
28
47
  ----
29
48
 
49
+ == Usage
30
50
 
51
+ === Parsing an RFC XML document
31
52
 
32
- == Usage
53
+ [source,ruby]
54
+ ----
55
+ require 'rfcxml'
33
56
 
34
- To parse an RFC XML document:
57
+ # Parse from file
58
+ xml = File.read('rfc8650.xml')
59
+ rfc = Rfcxml::V3::Rfc.from_xml(xml)
60
+
61
+ # Access document attributes
62
+ puts rfc.number # => "8650"
63
+ puts rfc.category # => "std"
64
+ puts rfc.submission_type # => "IETF"
65
+
66
+ # Access front matter
67
+ puts rfc.front.title.to_s
68
+ rfc.front.author.each do |author|
69
+ puts author.fullname
70
+ end
71
+
72
+ # Access sections
73
+ rfc.middle.section.each do |section|
74
+ puts section.name
75
+ end
76
+ ----
77
+
78
+ === Generating RFC XML
35
79
 
36
80
  [source,ruby]
37
81
  ----
38
82
  require 'rfcxml'
39
83
 
40
- rfc = Rfcxml::Document.new(File.read('rfc.xml'))
41
- puts rfc.title
42
- puts rfc.abstract
43
- puts rfc.sections
84
+ # Create a new RFC document
85
+ rfc = Rfcxml::V3::Rfc.new(
86
+ number: "1234",
87
+ category: "info",
88
+ submission_type: "IETF"
89
+ )
90
+
91
+ # Build front matter
92
+ rfc.front = Rfcxml::V3::Front.new(
93
+ title: Rfcxml::V3::Title.new(content: "My RFC Title"),
94
+ author: [
95
+ Rfcxml::V3::Author.new(
96
+ fullname: "John Doe",
97
+ email: "john@example.com"
98
+ )
99
+ ]
100
+ )
101
+
102
+ # Build middle section
103
+ rfc.middle = Rfcxml::V3::Middle.new(
104
+ section: [
105
+ Rfcxml::V3::Section.new(
106
+ name: Rfcxml::V3::Name.new(content: "Introduction"),
107
+ t: [
108
+ Rfcxml::V3::T.new(content: "This is the introduction.")
109
+ ]
110
+ )
111
+ ]
112
+ )
113
+
114
+ # Serialize to XML
115
+ xml = rfc.to_xml(pretty: true, declaration: true, encoding: "utf-8")
116
+ puts xml
44
117
  ----
45
118
 
46
- To generate an RFC XML document:
119
+ === Round-trip preservation
120
+
121
+ The library preserves all XML structure during round-trips:
47
122
 
48
123
  [source,ruby]
49
124
  ----
50
125
  require 'rfcxml'
51
126
 
52
- rfc = Rfcxml::Document.new
53
- rfc.title = 'An RFC Title'
54
- rfc.abstract = 'An RFC Abstract'
55
- rfc.sections = [
56
- Rfcxml::Section.new('Section 1', 'This is the first section'),
57
- Rfcxml::Section.new('Section 2', 'This is the second section')
58
- ]
127
+ # Parse
128
+ input = File.read('rfc.xml')
129
+ rfc = Rfcxml::V3::Rfc.from_xml(input)
130
+
131
+ # Serialize back
132
+ output = rfc.to_xml(pretty: true, declaration: true, encoding: "utf-8")
59
133
 
60
- puts rfc.to_xml
134
+ # The output preserves:
135
+ # - xml:lang attribute
136
+ # - xmlns:* namespace declarations (e.g., xmlns:xi for XInclude)
137
+ # - All element structure and content
61
138
  ----
62
139
 
140
+ == Document Structure
141
+
142
+ The RFC XML v3 structure maps to these Ruby classes:
143
+
144
+ [cols="2,3"]
145
+ |===
146
+ | Ruby Class | XML Element
147
+
148
+ | `Rfcxml::V3::Rfc` | `<rfc>` (root)
149
+ | `Rfcxml::V3::Front` | `<front>`
150
+ | `Rfcxml::V3::Middle` | `<middle>`
151
+ | `Rfcxml::V3::Back` | `<back>`
152
+ | `Rfcxml::V3::Title` | `<title>`
153
+ | `Rfcxml::V3::Author` | `<author>`
154
+ | `Rfcxml::V3::Section` | `<section>`
155
+ | `Rfcxml::V3::T` | `<t>`
156
+ | `Rfcxml::V3::List` | `<ul>`, `<ol>`, `<dl>`
157
+ | `Rfcxml::V3::Figure` | `<figure>`
158
+ | `Rfcxml::V3::Table` | `<table>`
159
+ | `Rfcxml::V3::References` | `<references>`
160
+ | `Rfcxml::V3::Reference` | `<reference>`
161
+ |===
162
+
163
+ == Serialization Options
164
+
165
+ The `to_xml` method supports these options:
166
+
167
+ [cols="1,1,3"]
168
+ |===
169
+ | Option | Default | Description
170
+
171
+ | `:pretty` | `false` | Pretty-print XML with indentation
172
+ | `:declaration` | `false` | Include XML declaration
173
+ | `:encoding` | `"utf-8"` | Set encoding in XML declaration
174
+ | `:omit_doctype` | `false` | Omit DOCTYPE declaration
175
+ |===
63
176
 
177
+ Example:
178
+
179
+ [source,ruby]
180
+ ----
181
+ xml = rfc.to_xml(
182
+ pretty: true,
183
+ declaration: true,
184
+ encoding: "utf-8"
185
+ )
186
+ ----
187
+
188
+ == Development
189
+
190
+ After checking out the repo, run:
191
+
192
+ [source]
193
+ ----
194
+ $ bundle install
195
+ $ bundle exec rake
196
+ ----
197
+
198
+ This runs tests + linting. To run tests only:
199
+
200
+ [source]
201
+ ----
202
+ $ bundle exec rake spec
203
+ ----
204
+
205
+ == Architecture
206
+
207
+ The library uses lutaml-model for XML serialization:
208
+
209
+ - All elements inherit from `Lutaml::Model::Serializable`
210
+ - Attributes are declared with `attribute` class method
211
+ - XML mapping is defined in `xml do ... end` block
212
+ - Circular references use string class names (e.g., `"Rfcxml::V3::Section"`)
64
213
 
65
214
  == Contributing
66
215
 
67
216
  Bug reports and pull requests are welcome on GitHub at
68
217
  https://github.com/metanorma/rfcxml.
69
218
 
70
-
71
219
  == Copyright and license
72
220
 
73
221
  The gem is available as open source under the terms of the BSD 2-clause license.
@@ -2,11 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "dl"
6
- require_relative "ol"
7
- require_relative "text"
8
- require_relative "ul"
9
-
10
5
  module Rfcxml
11
6
  module V3
12
7
  class Abstract < Lutaml::Model::Serializable
@@ -2,12 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "email"
6
- require_relative "facsimile"
7
- require_relative "phone"
8
- require_relative "postal"
9
- require_relative "uri"
10
-
11
5
  module Rfcxml
12
6
  module V3
13
7
  class Address < Lutaml::Model::Serializable
@@ -2,20 +2,6 @@
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 "spanx"
12
- require_relative "strong"
13
- require_relative "sub"
14
- require_relative "sup"
15
- require_relative "tt"
16
- require_relative "u"
17
- require_relative "xref"
18
-
19
5
  module Rfcxml
20
6
  module V3
21
7
  class Annotation < Lutaml::Model::Serializable
@@ -2,8 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "artwork"
6
-
7
5
  module Rfcxml
8
6
  module V3
9
7
  class Artset < Lutaml::Model::Serializable
@@ -23,11 +23,11 @@ module Rfcxml
23
23
  map_content to: :content
24
24
  map_attribute "anchor", to: :anchor
25
25
  map_attribute "pn", to: :pn
26
- map_attribute "name", to: :name
27
- map_attribute "type", to: :type
26
+ map_attribute "name", to: :name, value_map: { to: { empty: :empty } }
27
+ map_attribute "type", to: :type, value_map: { to: { empty: :empty } }
28
28
  map_attribute "src", to: :src
29
29
  map_attribute "align", to: :align
30
- map_attribute "alt", to: :alt
30
+ map_attribute "alt", to: :alt, value_map: { to: { empty: :empty } }
31
31
  map_attribute "width", to: :width
32
32
  map_attribute "height", to: :height
33
33
  map_attribute "originalSrc", to: :original_src
@@ -2,17 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "artset"
6
- require_relative "artwork"
7
- require_relative "blockquote"
8
- require_relative "dl"
9
- require_relative "figure"
10
- require_relative "iref"
11
- require_relative "ol"
12
- require_relative "text"
13
- require_relative "table"
14
- require_relative "ul"
15
-
16
5
  module Rfcxml
17
6
  module V3
18
7
  class Aside < Lutaml::Model::Serializable
@@ -2,9 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "address"
6
- require_relative "organization"
7
-
8
5
  module Rfcxml
9
6
  module V3
10
7
  class Author < Lutaml::Model::Serializable
@@ -2,10 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "displayreference"
6
- require_relative "references"
7
- require_relative "section"
8
-
9
5
  module Rfcxml
10
6
  module V3
11
7
  class Back < Lutaml::Model::Serializable
@@ -2,33 +2,8 @@
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
- class Ol < Lutaml::Model::Serializable; end
30
- class Dl < Lutaml::Model::Serializable; end
31
-
32
7
  class Blockquote < Lutaml::Model::Serializable
33
8
  attribute :content, :string
34
9
  attribute :anchor, :string
@@ -65,27 +40,11 @@ module Rfcxml
65
40
  map_attribute "pn", to: :pn
66
41
  map_attribute "cite", to: :cite
67
42
  map_attribute "quotedFrom", to: :quoted_from
68
- map_element "artset", to: :artset
69
- map_element "artwork", to: :artwork
70
- map_element "dl", to: :dl
71
- map_element "figure", to: :figure
72
- map_element "ol", to: :ol
73
- map_element "sourcecode", to: :sourcecode
74
- map_element "t", to: :t
75
- map_element "ul", to: :ul
76
- map_element "bcp14", to: :bcp14
77
- map_element "br", to: :br
78
- map_element "cref", to: :cref
79
- map_element "em", to: :em
80
- map_element "eref", to: :eref
81
- map_element "iref", to: :iref
82
- map_element "relref", to: :relref
83
- map_element "strong", to: :strong
84
- map_element "sub", to: :sub
85
- map_element "sup", to: :sup
86
- map_element "tt", to: :tt
87
- map_element "u", to: :u
88
- map_element "xref", to: :xref
43
+
44
+ %w[artset artwork dl figure ol sourcecode t ul bcp14 br cref em eref
45
+ iref relref strong sub sup tt u xref].each do |element|
46
+ map_element element, to: element.to_sym
47
+ end
89
48
  end
90
49
  end
91
50
  end
@@ -2,8 +2,6 @@
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 Boilerplate < Lutaml::Model::Serializable
data/lib/rfcxml/v3/c.rb CHANGED
@@ -2,12 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "cref"
6
- require_relative "eref"
7
- require_relative "iref"
8
- require_relative "spanx"
9
- require_relative "xref"
10
-
11
5
  module Rfcxml
12
6
  module V3
13
7
  class C < Lutaml::Model::Serializable
@@ -2,9 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "address"
6
- require_relative "organization"
7
-
8
5
  module Rfcxml
9
6
  module V3
10
7
  class Contact < Lutaml::Model::Serializable
@@ -2,16 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "br"
6
- require_relative "em"
7
- require_relative "eref"
8
- require_relative "relref"
9
- require_relative "strong"
10
- require_relative "sub"
11
- require_relative "sup"
12
- require_relative "tt"
13
- require_relative "xref"
14
-
15
5
  module Rfcxml
16
6
  module V3
17
7
  class Cref < Lutaml::Model::Serializable
data/lib/rfcxml/v3/dd.rb CHANGED
@@ -2,30 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "artset"
6
- require_relative "artwork"
7
- require_relative "aside"
8
- require_relative "bcp14"
9
- require_relative "br"
10
- require_relative "cref"
11
- require_relative "dl"
12
- require_relative "em"
13
- require_relative "eref"
14
- require_relative "figure"
15
- require_relative "iref"
16
- require_relative "ol"
17
- require_relative "relref"
18
- require_relative "sourcecode"
19
- require_relative "strong"
20
- require_relative "sub"
21
- require_relative "sup"
22
- require_relative "text"
23
- require_relative "table"
24
- require_relative "tt"
25
- require_relative "u"
26
- require_relative "ul"
27
- require_relative "xref"
28
-
29
5
  module Rfcxml
30
6
  module V3
31
7
  class Dd < Lutaml::Model::Serializable
@@ -63,29 +39,11 @@ module Rfcxml
63
39
  map_content to: :content
64
40
  map_attribute "anchor", to: :anchor
65
41
  map_attribute "pn", to: :pn
66
- map_element "artset", to: :artset
67
- map_element "artwork", to: :artwork
68
- map_element "aside", to: :aside
69
- map_element "dl", to: :dl
70
- map_element "figure", to: :figure
71
- map_element "ol", to: :ol
72
- map_element "sourcecode", to: :sourcecode
73
- map_element "t", to: :t
74
- map_element "table", to: :table
75
- map_element "ul", to: :ul
76
- map_element "bcp14", to: :bcp14
77
- map_element "br", to: :br
78
- map_element "cref", to: :cref
79
- map_element "em", to: :em
80
- map_element "eref", to: :eref
81
- map_element "iref", to: :iref
82
- map_element "relref", to: :relref
83
- map_element "strong", to: :strong
84
- map_element "sub", to: :sub
85
- map_element "sup", to: :sup
86
- map_element "tt", to: :tt
87
- map_element "u", to: :u
88
- map_element "xref", to: :xref
42
+
43
+ %w[artset artwork aside dl figure ol sourcecode t table ul bcp14 br
44
+ cref em eref iref relref strong sub sup tt u xref].each do |element|
45
+ map_element element, to: element.to_sym
46
+ end
89
47
  end
90
48
  end
91
49
  end
data/lib/rfcxml/v3/dl.rb CHANGED
@@ -2,14 +2,8 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "dd"
6
- require_relative "dt"
7
-
8
5
  module Rfcxml
9
6
  module V3
10
- # class Dd < Lutaml::Model::Serializable; end
11
- # class Dt < Lutaml::Model::Serializable; end
12
-
13
7
  class Dl < Lutaml::Model::Serializable
14
8
  attribute :anchor, :string
15
9
  attribute :spacing, :string, default: -> { "normal" }
data/lib/rfcxml/v3/dt.rb CHANGED
@@ -2,19 +2,6 @@
2
2
 
3
3
  require "lutaml/model"
4
4
 
5
- require_relative "bcp14"
6
- require_relative "br"
7
- require_relative "cref"
8
- require_relative "em"
9
- require_relative "eref"
10
- require_relative "iref"
11
- require_relative "relref"
12
- require_relative "strong"
13
- require_relative "sub"
14
- require_relative "sup"
15
- require_relative "tt"
16
- require_relative "xref"
17
-
18
5
  module Rfcxml
19
6
  module V3
20
7
  class Dt < Lutaml::Model::Serializable
@@ -40,18 +27,11 @@ module Rfcxml
40
27
  map_content to: :content
41
28
  map_attribute "anchor", to: :anchor
42
29
  map_attribute "pn", to: :pn
43
- map_element "bcp14", to: :bcp14
44
- map_element "br", to: :br
45
- map_element "cref", to: :cref
46
- map_element "em", to: :em
47
- map_element "eref", to: :eref
48
- map_element "iref", to: :iref
49
- map_element "relref", to: :relref
50
- map_element "strong", to: :strong
51
- map_element "sub", to: :sub
52
- map_element "sup", to: :sup
53
- map_element "tt", to: :tt
54
- map_element "xref", to: :xref
30
+
31
+ %w[bcp14 br cref em eref iref relref strong sub sup tt
32
+ xref].each do |element|
33
+ map_element element, to: element.to_sym
34
+ end
55
35
  end
56
36
  end
57
37
  end