rfcxml 0.4.3 → 0.4.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afc99ca4a6eb6ccc3fb1a220ac8a1945df6e823b15b86fd5003761c694e9e7be
4
- data.tar.gz: 853d640f0e92ae96797e4bc79b0960f715e3a1d4bc4cc53c2e0763f62ce70c04
3
+ metadata.gz: a53d83dede12affcc88ca0ae6c147041be6991d34e9591cc917de1f7d8b57882
4
+ data.tar.gz: 225b1a13f2f9da13b602b16537df6ab89209c2cf5221258b2c3921e3d9a5a00a
5
5
  SHA512:
6
- metadata.gz: 15e6b2ba34f404d084620f9c8991733ad794c023773d566508c263d2941fd358b579b4011011d8ef22827398a8e46acf832e0717e8013dc670a1a7ec0269b589
7
- data.tar.gz: '0021048cb9d05a37f21261f8c054cbf9bfc8a234e04fc39b47970efe4c13314126aaf27fa6695aeea3318da19a5a18985a3e58323172da729987705cad1d0328'
6
+ metadata.gz: a4dfd64fb22e1c8e3aa6fbf9828f9b5d124f1e4395fc63813c512aef8ce5dd585f5f46df5c4da998e2ab646b8d60eaf56deb99e24b54e426b84b0170c1599e9e
7
+ data.tar.gz: 519531aabb6b89471c657395ac10c673d608f46f0c9d3235e4e1f31f083391a9e13ecc4cda469a22b9627397f47413751dac3f93de9f79d945a6d2b736adb781
@@ -1,5 +1,7 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
1
+ # Formerly cimas-managed. Now consumer-owned per metanorma/cimas#68
2
+ # (workflow-file conversion from cimas-synced copied stubs to reusable-workflow
3
+ # references). Pins metanorma/ci reusable at @v1 (moving major, three-tier
4
+ # tagging discipline per metanorma/ci#372).
3
5
  name: rake
4
6
 
5
7
  on:
@@ -13,6 +15,6 @@ permissions:
13
15
 
14
16
  jobs:
15
17
  rake:
16
- uses: metanorma/ci/.github/workflows/generic-rake.yml@main
18
+ uses: metanorma/ci/.github/workflows/generic-rake.yml@v1
17
19
  secrets:
18
20
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
@@ -14,6 +14,12 @@ on:
14
14
  repository_dispatch:
15
15
  types: [ do-release ]
16
16
 
17
+ # Least-privilege ceiling for the called rubygems-release.yml: its release job
18
+ # needs contents:write (git tag push) and id-token:write (OIDC Trusted Publishing).
19
+ permissions:
20
+ contents: write
21
+ id-token: write
22
+
17
23
  jobs:
18
24
  release:
19
25
  uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
@@ -34,7 +34,7 @@ jobs:
34
34
 
35
35
  steps:
36
36
  - name: Checkout repository
37
- uses: actions/checkout@v4
37
+ uses: actions/checkout@v6
38
38
 
39
39
  - name: Set up Ruby
40
40
  uses: ruby/setup-ruby@v1
@@ -45,15 +45,15 @@ jobs:
45
45
  - name: Download RFC XML files
46
46
  run: |
47
47
  mkdir -p rfc-xml-source
48
- echo "Downloading RFC XML tarball..."
49
- curl -L -o xmlsource.tar.gz "https://www.rfc-editor.org/in-notes/tar/xmlsource-all.tar.gz"
50
- echo "Extracting..."
51
- tar -xzf xmlsource.tar.gz -C rfc-xml-source
52
- # The tarball extracts to a subdirectory, find it
53
- XML_DIR=$(find rfc-xml-source -name "*.xml" -type f | head -1 | xargs dirname)
54
- echo "XML_DIR=$XML_DIR" >> $GITHUB_ENV
55
- FILE_COUNT=$(find "$XML_DIR" -name "*.xml" -type f | wc -l)
56
- echo "Found $FILE_COUNT XML files in $XML_DIR"
48
+ echo "Syncing published RFC XML files via rsync..."
49
+ # rfc-editor.org retired the bulk tarball; rsync is now the official source.
50
+ # --include='*.xml' --exclude='*' (without --include='*/') limits the transfer
51
+ # to XML files at the module root, which are the published RFCs.
52
+ rsync -az --include='*.xml' --exclude='*' \
53
+ rsync.rfc-editor.org::rfcs/ rfc-xml-source/
54
+ echo "XML_DIR=rfc-xml-source" >> $GITHUB_ENV
55
+ FILE_COUNT=$(find "$XML_DIR" -maxdepth 1 -name "*.xml" -type f | wc -l)
56
+ echo "Found $FILE_COUNT published RFC XML files in $XML_DIR"
57
57
 
58
58
  - name: Run round-trip tests
59
59
  run: |
@@ -62,7 +62,7 @@ jobs:
62
62
 
63
63
  - name: Upload test results
64
64
  if: always()
65
- uses: actions/upload-artifact@v4
65
+ uses: actions/upload-artifact@v7
66
66
  with:
67
67
  name: roundtrip-results
68
68
  path: tmp/roundtrip-results-*/
data/.gitignore CHANGED
@@ -15,3 +15,4 @@
15
15
 
16
16
  Gemfile.lock
17
17
  TODO*
18
+ .claude/worktrees/
data/.rubocop.yml CHANGED
@@ -2,18 +2,30 @@
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
4
  - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ # .rubocop_todo.yml MUST be the last entry. inherit_from is last-wins:
6
+ # if listed before oss-guides, the shared config's stricter Metrics/
7
+ # (MethodLength, BlockLength, etc.) rules override the todo's per-file
8
+ # grandfathering, and the todo becomes inert on those cops. Empirically
9
+ # verified on suma 2026-07-06: with todo listed first, 34 Metrics/* offenses
10
+ # remained; moved last, cleared. Every gem in the metanorma-org fleet
11
+ # already ships a `.rubocop_todo.yml` on its live tree (audited 2026-07-06,
12
+ # 54/54 have it), so this reference is safe to emit unconditionally.
5
13
  - .rubocop_todo.yml
6
14
 
7
- inherit_mode:
8
- merge:
9
- - Exclude
10
-
11
- # local repo-specific modifications
12
- # ...
15
+ # Rubocop plugins enabled centrally so every metanorma-org gem picks them up
16
+ # on cimas sync — best practice belongs at the shared-template layer, not
17
+ # per-repo. Per ronaldtse feedback on metanorma/ci#332.
13
18
  plugins:
14
19
  - rubocop-rspec
15
20
  - rubocop-performance
16
21
  - rubocop-rake
17
22
 
23
+ # local repo-specific modifications
24
+ # ...
25
+
18
26
  AllCops:
19
- TargetRubyVersion: 3.0
27
+ # 3.3 matches the org-wide minimum being pushed via #274 (Raise minimum
28
+ # Ruby version to 3.3 due to EOL of 3.2 on 2026-03-31). Was 3.4 before
29
+ # this commit — 3.4 was above the org's stated minimum and would have
30
+ # applied Rubocop rules that fail-close on gems still targeting 3.3.
31
+ TargetRubyVersion: 3.3
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-05-01 09:55:57 UTC using RuboCop version 1.86.1.
3
+ # on 2026-06-15 14:33:06 UTC using RuboCop version 1.86.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
@@ -11,40 +11,7 @@ Gemspec/RequiredRubyVersion:
11
11
  Exclude:
12
12
  - 'rfcxml.gemspec'
13
13
 
14
- # Offense count: 1
15
- # This cop supports safe autocorrection (--autocorrect).
16
- # Configuration parameters: EnforcedStyleAlignWith.
17
- # SupportedStylesAlignWith: either, start_of_block, start_of_line
18
- Layout/BlockAlignment:
19
- Exclude:
20
- - 'spec/v3/cref_spec.rb'
21
-
22
- # Offense count: 1
23
- # This cop supports safe autocorrection (--autocorrect).
24
- Layout/BlockEndNewline:
25
- Exclude:
26
- - 'spec/v3/cref_spec.rb'
27
-
28
- # Offense count: 4
29
- # This cop supports safe autocorrection (--autocorrect).
30
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
31
- # SupportedHashRocketStyles: key, separator, table
32
- # SupportedColonStyles: key, separator, table
33
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
34
- Layout/HashAlignment:
35
- Exclude:
36
- - 'lib/rfcxml/v3/td.rb'
37
- - 'spec/v3/rfc_pi_spec.rb'
38
-
39
- # Offense count: 2
40
- # This cop supports safe autocorrection (--autocorrect).
41
- # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
42
- # SupportedStylesAlignWith: start_of_line, relative_to_receiver
43
- Layout/IndentationWidth:
44
- Exclude:
45
- - 'spec/v3/cref_spec.rb'
46
-
47
- # Offense count: 28
14
+ # Offense count: 24
48
15
  # This cop supports safe autocorrection (--autocorrect).
49
16
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
50
17
  # URISchemes: http, https
@@ -58,32 +25,20 @@ Layout/LineLength:
58
25
  - 'spec/v3/rfc_pi_spec.rb'
59
26
  - 'spec/v3/td_spec.rb'
60
27
 
61
- # Offense count: 2
62
- # This cop supports safe autocorrection (--autocorrect).
63
- # Configuration parameters: AllowInHeredoc.
64
- Layout/TrailingWhitespace:
65
- Exclude:
66
- - 'spec/v3/rfc_pi_spec.rb'
67
-
68
- # Offense count: 4
69
- Lint/NoReturnInBeginEndBlocks:
70
- Exclude:
71
- - 'scripts/roundtrip_test.rb'
72
-
73
- # Offense count: 6
28
+ # Offense count: 5
74
29
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
75
30
  Metrics/AbcSize:
76
31
  Exclude:
77
32
  - 'lib/rfcxml/v3/rfc.rb'
78
33
  - 'scripts/roundtrip_test.rb'
79
34
 
80
- # Offense count: 3
35
+ # Offense count: 4
81
36
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
82
37
  # AllowedMethods: refine
83
38
  Metrics/BlockLength:
84
39
  Max: 37
85
40
 
86
- # Offense count: 3
41
+ # Offense count: 2
87
42
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
88
43
  Metrics/CyclomaticComplexity:
89
44
  Exclude:
@@ -93,9 +48,9 @@ Metrics/CyclomaticComplexity:
93
48
  # Offense count: 9
94
49
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
95
50
  Metrics/MethodLength:
96
- Max: 50
51
+ Max: 22
97
52
 
98
- # Offense count: 3
53
+ # Offense count: 2
99
54
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
100
55
  Metrics/PerceivedComplexity:
101
56
  Exclude:
@@ -114,12 +69,12 @@ RSpec/DescribeClass:
114
69
  Exclude:
115
70
  - 'spec/v3/document_creation_spec.rb'
116
71
 
117
- # Offense count: 20
72
+ # Offense count: 22
118
73
  # Configuration parameters: CountAsOne.
119
74
  RSpec/ExampleLength:
120
75
  Max: 29
121
76
 
122
- # Offense count: 25
77
+ # Offense count: 32
123
78
  RSpec/MultipleExpectations:
124
79
  Max: 9
125
80
 
@@ -139,14 +94,3 @@ RSpec/SpecFilePathFormat:
139
94
  Security/Open:
140
95
  Exclude:
141
96
  - 'Rakefile'
142
-
143
- # Offense count: 1
144
- # This cop supports safe autocorrection (--autocorrect).
145
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
146
- # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
147
- # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
148
- # FunctionalMethods: let, let!, subject, watch
149
- # AllowedMethods: lambda, proc, it
150
- Style/BlockDelimiters:
151
- Exclude:
152
- - 'spec/v3/cref_spec.rb'
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Abstract < Lutaml::Model::Serializable
8
+ attribute :p, :string, collection: true
9
+
10
+ xml do
11
+ root "abstract"
12
+ namespace Rfcxml::RfcIndex::Namespace
13
+
14
+ map_element "p", to: :p
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Author < Lutaml::Model::Serializable
8
+ attribute :name, :string
9
+ attribute :title, :string
10
+ attribute :organization, :string
11
+ attribute :org_abbrev, :string
12
+
13
+ xml do
14
+ root "author"
15
+ namespace Rfcxml::RfcIndex::Namespace
16
+
17
+ map_element "name", to: :name
18
+ map_element "title", to: :title
19
+ map_element "organization", to: :organization
20
+ map_element "org-abbrev", to: :org_abbrev
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "document_ref"
6
+
7
+ module Rfcxml
8
+ module RfcIndex
9
+ class BcpEntry < Lutaml::Model::Serializable
10
+ attribute :doc_id, :string
11
+ attribute :title, :string
12
+ attribute :is_also, DocumentRef
13
+
14
+ xml do
15
+ root "bcp-entry"
16
+ namespace Rfcxml::RfcIndex::Namespace
17
+
18
+ map_element "doc-id", to: :doc_id
19
+ map_element "title", to: :title
20
+ map_element "is-also", to: :is_also
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Date < Lutaml::Model::Serializable
8
+ attribute :month, :string
9
+ attribute :day, :string
10
+ attribute :year, :string
11
+
12
+ xml do
13
+ root "date"
14
+ namespace Rfcxml::RfcIndex::Namespace
15
+
16
+ map_element "month", to: :month
17
+ map_element "day", to: :day
18
+ map_element "year", to: :year
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class DocumentRef < Lutaml::Model::Serializable
8
+ attribute :doc_id, :string, collection: true
9
+
10
+ xml do
11
+ root "documentRef"
12
+ namespace Rfcxml::RfcIndex::Namespace
13
+
14
+ map_element "doc-id", to: :doc_id
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Format < Lutaml::Model::Serializable
8
+ attribute :file_format, :string, collection: true
9
+
10
+ xml do
11
+ root "format"
12
+ namespace Rfcxml::RfcIndex::Namespace
13
+
14
+ map_element "file-format", to: :file_format
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "document_ref"
6
+
7
+ module Rfcxml
8
+ module RfcIndex
9
+ class FyiEntry < Lutaml::Model::Serializable
10
+ attribute :doc_id, :string
11
+ attribute :title, :string
12
+ attribute :is_also, DocumentRef
13
+
14
+ xml do
15
+ root "fyi-entry"
16
+ namespace Rfcxml::RfcIndex::Namespace
17
+
18
+ map_element "doc-id", to: :doc_id
19
+ map_element "title", to: :title
20
+ map_element "is-also", to: :is_also
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "kw"
6
+
7
+ module Rfcxml
8
+ module RfcIndex
9
+ class Keywords < Lutaml::Model::Serializable
10
+ attribute :kw, Kw, collection: true
11
+
12
+ xml do
13
+ root "keywords"
14
+ namespace Rfcxml::RfcIndex::Namespace
15
+
16
+ map_element "kw", to: :kw
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Kw < Lutaml::Model::Serializable
8
+ attribute :content, :string
9
+
10
+ xml do
11
+ root "kw"
12
+ namespace Rfcxml::RfcIndex::Namespace
13
+
14
+ map_content to: :content
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/xml"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class Namespace < Lutaml::Xml::W3c::XmlNamespace
8
+ uri "https://www.rfc-editor.org/rfc-index"
9
+ element_form_default :qualified
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "author"
6
+ require_relative "date"
7
+ require_relative "format"
8
+ require_relative "keywords"
9
+ require_relative "abstract"
10
+ require_relative "document_ref"
11
+
12
+ module Rfcxml
13
+ module RfcIndex
14
+ class RfcEntry < Lutaml::Model::Serializable
15
+ attribute :doc_id, :string
16
+ attribute :title, :string
17
+ attribute :author, Author, collection: true
18
+ attribute :date, Date
19
+ attribute :format, Format
20
+ attribute :page_count, :string
21
+ attribute :keywords, Keywords
22
+ attribute :abstract, Abstract
23
+ attribute :draft, :string
24
+ attribute :notes, :string
25
+ attribute :obsoletes, DocumentRef
26
+ attribute :obsoleted_by, DocumentRef
27
+ attribute :updates, DocumentRef
28
+ attribute :updated_by, DocumentRef
29
+ attribute :is_also, DocumentRef
30
+ attribute :see_also, DocumentRef
31
+ attribute :current_status, :string
32
+ attribute :publication_status, :string
33
+ attribute :stream, :string
34
+ attribute :area, :string
35
+ attribute :wg_acronym, :string
36
+ attribute :errata_url, :string
37
+ attribute :doi, :string
38
+
39
+ xml do
40
+ root "rfc-entry"
41
+ namespace Rfcxml::RfcIndex::Namespace
42
+ ordered
43
+
44
+ map_element "doc-id", to: :doc_id
45
+ map_element "title", to: :title
46
+ map_element "author", to: :author
47
+ map_element "date", to: :date
48
+ map_element "format", to: :format
49
+ map_element "page-count", to: :page_count
50
+ map_element "keywords", to: :keywords
51
+ map_element "abstract", to: :abstract
52
+ map_element "draft", to: :draft
53
+ map_element "notes", to: :notes
54
+ map_element "obsoletes", to: :obsoletes
55
+ map_element "obsoleted-by", to: :obsoleted_by
56
+ map_element "updates", to: :updates
57
+ map_element "updated-by", to: :updated_by
58
+ map_element "is-also", to: :is_also
59
+ map_element "see-also", to: :see_also
60
+ map_element "current-status", to: :current_status
61
+ map_element "publication-status", to: :publication_status
62
+ map_element "stream", to: :stream
63
+ map_element "area", to: :area
64
+ map_element "wg_acronym", to: :wg_acronym
65
+ map_element "errata-url", to: :errata_url
66
+ map_element "doi", to: :doi
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "namespace"
6
+ require_relative "bcp_entry"
7
+ require_relative "fyi_entry"
8
+ require_relative "rfc_entry"
9
+ require_relative "rfc_not_issued_entry"
10
+ require_relative "std_entry"
11
+
12
+ module Rfcxml
13
+ module RfcIndex
14
+ class RfcIndex < Lutaml::Model::Serializable
15
+ attribute :title, :string
16
+ attribute :bcp_entry, BcpEntry, collection: true
17
+ attribute :fyi_entry, FyiEntry, collection: true
18
+ attribute :rfc_entry, RfcEntry, collection: true
19
+ attribute :rfc_not_issued_entry, RfcNotIssuedEntry, collection: true
20
+ attribute :std_entry, StdEntry, collection: true
21
+
22
+ xml do
23
+ root "rfc-index"
24
+ namespace Rfcxml::RfcIndex::Namespace
25
+ ordered
26
+
27
+ map_attribute "title", to: :title
28
+
29
+ map_element "bcp-entry", to: :bcp_entry
30
+ map_element "fyi-entry", to: :fyi_entry
31
+ map_element "rfc-entry", to: :rfc_entry
32
+ map_element "rfc-not-issued-entry", to: :rfc_not_issued_entry
33
+ map_element "std-entry", to: :std_entry
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ module Rfcxml
6
+ module RfcIndex
7
+ class RfcNotIssuedEntry < Lutaml::Model::Serializable
8
+ attribute :doc_id, :string
9
+
10
+ xml do
11
+ root "rfc-not-issued-entry"
12
+ namespace Rfcxml::RfcIndex::Namespace
13
+
14
+ map_element "doc-id", to: :doc_id
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "lutaml/model"
4
+
5
+ require_relative "document_ref"
6
+
7
+ module Rfcxml
8
+ module RfcIndex
9
+ class StdEntry < Lutaml::Model::Serializable
10
+ attribute :doc_id, :string
11
+ attribute :title, :string
12
+ attribute :is_also, DocumentRef
13
+
14
+ xml do
15
+ root "std-entry"
16
+ namespace Rfcxml::RfcIndex::Namespace
17
+
18
+ map_element "doc-id", to: :doc_id
19
+ map_element "title", to: :title
20
+ map_element "is-also", to: :is_also
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rfcxml
4
+ module RfcIndex
5
+ autoload :Namespace, "#{__dir__}/rfc_index/namespace"
6
+ autoload :RfcIndex, "#{__dir__}/rfc_index/rfc_index"
7
+ autoload :RfcEntry, "#{__dir__}/rfc_index/rfc_entry"
8
+ autoload :StdEntry, "#{__dir__}/rfc_index/std_entry"
9
+ autoload :BcpEntry, "#{__dir__}/rfc_index/bcp_entry"
10
+ autoload :FyiEntry, "#{__dir__}/rfc_index/fyi_entry"
11
+ autoload :RfcNotIssuedEntry, "#{__dir__}/rfc_index/rfc_not_issued_entry"
12
+ autoload :Author, "#{__dir__}/rfc_index/author"
13
+ autoload :Date, "#{__dir__}/rfc_index/date"
14
+ autoload :Format, "#{__dir__}/rfc_index/format"
15
+ autoload :Keywords, "#{__dir__}/rfc_index/keywords"
16
+ autoload :Kw, "#{__dir__}/rfc_index/kw"
17
+ autoload :Abstract, "#{__dir__}/rfc_index/abstract"
18
+ autoload :DocumentRef, "#{__dir__}/rfc_index/document_ref"
19
+ end
20
+ end
@@ -27,13 +27,14 @@ module Rfcxml
27
27
  map_attribute "pn", to: :pn
28
28
  map_attribute "name", to: :name, value_map: { to: { empty: :empty } }
29
29
  map_attribute "type", to: :type, value_map: { to: { empty: :empty } }
30
- map_attribute "src", to: :src
30
+ map_attribute "src", to: :src, value_map: { to: { empty: :empty } }
31
31
  map_attribute "align", to: :align
32
32
  map_attribute "alt", to: :alt, value_map: { to: { empty: :empty } }
33
33
  map_attribute "width", to: :width, value_map: { to: { empty: :empty } }
34
34
  map_attribute "height", to: :height,
35
35
  value_map: { to: { empty: :empty } }
36
- map_attribute "originalSrc", to: :original_src
36
+ map_attribute "originalSrc", to: :original_src,
37
+ value_map: { to: { empty: :empty } }
37
38
  end
38
39
  end
39
40
  end
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Blockquote < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :anchor, :string
10
10
  attribute :pn, :string
11
11
  attribute :cite, :string
@@ -34,7 +34,7 @@ module Rfcxml
34
34
 
35
35
  xml do
36
36
  element "blockquote"
37
- ordered
37
+ mixed_content
38
38
 
39
39
  map_content to: :content
40
40
  map_attribute "anchor", to: :anchor
data/lib/rfcxml/v3/c.rb CHANGED
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class C < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :cref, Cref, collection: true
10
10
  attribute :eref, Eref, collection: true
11
11
  attribute :iref, Iref, collection: true
@@ -14,7 +14,7 @@ module Rfcxml
14
14
 
15
15
  xml do
16
16
  element "c"
17
- ordered
17
+ mixed_content
18
18
 
19
19
  map_content to: :content
20
20
  map_element "cref", to: :cref
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Cref < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :anchor, :string
10
10
  attribute :source, :string
11
11
  attribute :display, :string, default: -> { "true" }
@@ -21,7 +21,7 @@ module Rfcxml
21
21
 
22
22
  xml do
23
23
  element "cref"
24
- ordered
24
+ mixed_content
25
25
 
26
26
  map_content to: :content
27
27
  map_attribute "anchor", to: :anchor
data/lib/rfcxml/v3/dd.rb CHANGED
@@ -10,6 +10,7 @@ module Rfcxml
10
10
  attribute :pn, :string
11
11
  attribute :artset, Artset, collection: true
12
12
  attribute :artwork, Artwork, collection: true
13
+ attribute :blockquote, Blockquote, collection: true
13
14
  attribute :dl, Dl, collection: true
14
15
  attribute :figure, Figure, collection: true
15
16
  attribute :ol, Ol, collection: true
@@ -41,8 +42,9 @@ module Rfcxml
41
42
  map_attribute "anchor", to: :anchor
42
43
  map_attribute "pn", to: :pn
43
44
 
44
- %w[artset artwork aside dl figure ol sourcecode t table ul bcp14 br
45
- cref em eref iref relref strong sub sup tt u xref].each do |element|
45
+ %w[artset artwork blockquote aside dl figure ol sourcecode t table ul
46
+ bcp14 br cref em eref iref relref strong sub sup tt u
47
+ xref].each do |element|
46
48
  map_element element, to: element.to_sym
47
49
  end
48
50
  end
data/lib/rfcxml/v3/dt.rb CHANGED
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Dt < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :anchor, :string
10
10
  attribute :pn, :string
11
11
  attribute :bcp14, Bcp14, collection: true
@@ -23,7 +23,7 @@ module Rfcxml
23
23
 
24
24
  xml do
25
25
  element "dt"
26
- ordered
26
+ mixed_content
27
27
 
28
28
  map_content to: :content
29
29
  map_attribute "anchor", to: :anchor
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Postamble < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :cref, Cref, collection: true
10
10
  attribute :eref, Eref, collection: true
11
11
  attribute :iref, Iref, collection: true
@@ -14,7 +14,7 @@ module Rfcxml
14
14
 
15
15
  xml do
16
16
  element "postamble"
17
- ordered
17
+ mixed_content
18
18
 
19
19
  map_content to: :content
20
20
  map_element "cref", to: :cref
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Preamble < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :bcp14, Bcp14, collection: true
10
10
  attribute :cref, Cref, collection: true
11
11
  attribute :em, Em, collection: true
@@ -22,7 +22,7 @@ module Rfcxml
22
22
 
23
23
  xml do
24
24
  element "preamble"
25
- ordered
25
+ mixed_content
26
26
 
27
27
  map_content to: :content
28
28
  map_element "bcp14", to: :bcp14
@@ -5,13 +5,13 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Refcontent < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :bcp14, Bcp14, collection: true
10
10
  include XrefText
11
11
 
12
12
  xml do
13
13
  element "refcontent"
14
- ordered
14
+ mixed_content
15
15
 
16
16
  map_content to: :content
17
17
  map_element "bcp14", to: :bcp14
@@ -4,7 +4,7 @@ require "lutaml/model"
4
4
  module Rfcxml
5
5
  module V3
6
6
  class Strong < Lutaml::Model::Serializable
7
- attribute :content, :string
7
+ attribute :content, :string, collection: true
8
8
  attribute :bcp14, Bcp14, collection: true
9
9
  attribute :br, Br, collection: true
10
10
  attribute :cref, Cref, collection: true
@@ -19,7 +19,7 @@ module Rfcxml
19
19
 
20
20
  xml do
21
21
  element "strong"
22
- ordered
22
+ mixed_content
23
23
 
24
24
  map_content to: :content
25
25
  map_element "bcp14", to: :bcp14
data/lib/rfcxml/v3/sub.rb CHANGED
@@ -5,7 +5,7 @@ require "lutaml/model"
5
5
  module Rfcxml
6
6
  module V3
7
7
  class Sub < Lutaml::Model::Serializable
8
- attribute :content, :string
8
+ attribute :content, :string, collection: true
9
9
  attribute :bcp14, Bcp14, collection: true
10
10
  attribute :cref, Cref, collection: true
11
11
  attribute :em, "Rfcxml::V3::Em", collection: true
@@ -20,7 +20,7 @@ module Rfcxml
20
20
 
21
21
  xml do
22
22
  element "sub"
23
- ordered
23
+ mixed_content
24
24
 
25
25
  map_content to: :content
26
26
  map_element "bcp14", to: :bcp14
data/lib/rfcxml/v3/sup.rb CHANGED
@@ -7,7 +7,7 @@ module Rfcxml
7
7
  class Sup < Sub
8
8
  xml do
9
9
  element "sup"
10
- ordered
10
+ mixed_content
11
11
 
12
12
  map_content to: :content
13
13
  map_element "bcp14", to: :bcp14
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfcxml
4
- VERSION = "0.4.3"
4
+ VERSION = "0.4.5"
5
5
  end
data/lib/rfcxml.rb CHANGED
@@ -3,9 +3,10 @@
3
3
  require "lutaml/model"
4
4
  require "lutaml/xml"
5
5
 
6
- Lutaml::Model::Config.configure do |config|
7
- config.xml_adapter_type = :nokogiri
8
- end
6
+ # No require-time adapter configuration: assigning xml_adapter_type here
7
+ # globally clobbered the host application's adapter selection mid-process
8
+ # (e.g. a parse already in flight on a different adapter, lutaml-model
9
+ # #871). lutaml-model resolves an adapter on demand when none is pinned.
9
10
 
10
11
  module Rfcxml
11
12
  class Error < StandardError; end
@@ -14,3 +15,4 @@ module Rfcxml
14
15
  end
15
16
 
16
17
  require_relative "rfcxml/v3"
18
+ require_relative "rfcxml/rfc_index"
data/rfcxml.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.required_ruby_version = ">= 3.2.0"
30
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
31
31
 
32
32
  spec.add_dependency "lutaml-model", "~> 0.8.0"
33
33
  spec.add_dependency "nokogiri"
@@ -120,63 +120,82 @@ class RoundTripTester
120
120
  end
121
121
  end
122
122
 
123
- def perform_test(filepath, basename)
124
- # Read input
125
- input = begin
126
- File.read(filepath)
127
- rescue StandardError => e
128
- return build_error_result(basename, "Read", e)
129
- end
123
+ def root_element_name(xml)
124
+ xml.each_line do |line|
125
+ if (m = line.match(/<([\w:.-]+)[\s>]/))
126
+ next if m[1] == "xml"
130
127
 
131
- # Parse
132
- parsed = begin
133
- Rfcxml::V3::Rfc.from_xml(input)
134
- rescue StandardError => e
135
- return build_error_result(basename, "Parse", e)
128
+ return m[1].sub(/^.*:/, "")
129
+ end
136
130
  end
131
+ nil
132
+ end
137
133
 
138
- # Serialize
139
- output = begin
140
- parsed.to_xml(pretty: true, declaration: true, encoding: "utf-8")
141
- rescue StandardError => e
142
- return build_error_result(basename, "Serialize", e)
143
- end
134
+ def perform_test(filepath, basename)
135
+ input = read_input(filepath, basename)
136
+ return input if input.key?(:status)
144
137
 
145
- # Compare using Canon DOM diff with explicit match options
146
- # Using DOM diff with attribute_order: ignore and attribute_values: normalize
147
- # handles round-trip differences correctly
148
- comparison = begin
149
- Canon::Comparison.equivalent?(
150
- output,
151
- input,
152
- diff_algorithm: :dom,
153
- format: :xml,
154
- match: {
155
- attribute_order: :ignore,
156
- attribute_values: :normalize,
157
- text_content: :normalize,
158
- structural_whitespace: :ignore,
159
- },
160
- verbose: true,
161
- )
162
- rescue StandardError => e
163
- return build_error_result(basename, "Compare", e)
164
- end
138
+ parsed = parse_input(input[:xml], basename)
139
+ return parsed if parsed.key?(:status)
165
140
 
166
- # Check result
141
+ output = serialize(parsed[:model], basename)
142
+ return output if output.key?(:status)
143
+
144
+ compare_and_build_result(output[:xml], input[:xml], filepath, basename)
145
+ end
146
+
147
+ def read_input(filepath, basename)
148
+ { xml: File.read(filepath) }
149
+ rescue StandardError => e
150
+ build_error_result(basename, "Read", e)
151
+ end
152
+
153
+ def parse_input(xml, basename)
154
+ { model: model_class_for(xml).from_xml(xml) }
155
+ rescue StandardError => e
156
+ build_error_result(basename, "Parse", e)
157
+ end
158
+
159
+ def serialize(model, basename)
160
+ { xml: model.to_xml(pretty: true, declaration: true, encoding: "utf-8") }
161
+ rescue StandardError => e
162
+ build_error_result(basename, "Serialize", e)
163
+ end
164
+
165
+ def model_class_for(xml)
166
+ root_element_name(xml) == "rfc-index" ? Rfcxml::RfcIndex::RfcIndex : Rfcxml::V3::Rfc
167
+ end
168
+
169
+ def compare_and_build_result(output, input, filepath, basename)
170
+ comparison = Canon::Comparison.equivalent?(
171
+ output, input,
172
+ diff_algorithm: :dom, format: :xml,
173
+ match: {
174
+ attribute_order: :ignore,
175
+ attribute_values: :normalize,
176
+ text_content: :normalize,
177
+ structural_whitespace: :ignore,
178
+ },
179
+ verbose: true
180
+ )
181
+ build_comparison_result(comparison, output, filepath, basename)
182
+ rescue StandardError => e
183
+ build_error_result(basename, "Compare", e)
184
+ end
185
+
186
+ def build_comparison_result(comparison, output, filepath, basename)
167
187
  equivalent = comparison.respond_to?(:equivalent?) ? comparison.equivalent? : comparison
188
+ return pass_result(basename) if equivalent
168
189
 
169
- if equivalent
170
- # Pass - write empty marker file
171
- write_pass_marker(basename)
172
- { file: basename, status: :pass }
173
- else
174
- # Fail - write detailed report and source
175
- differences = extract_differences(comparison)
176
- write_fail_report(basename, filepath, differences)
177
- write_source_output(basename, output)
178
- { file: basename, status: :fail, differences: differences }
179
- end
190
+ differences = extract_differences(comparison)
191
+ write_fail_report(basename, filepath, differences)
192
+ write_source_output(basename, output)
193
+ { file: basename, status: :fail, differences: differences }
194
+ end
195
+
196
+ def pass_result(basename)
197
+ write_pass_marker(basename)
198
+ { file: basename, status: :pass }
180
199
  end
181
200
 
182
201
  def build_error_result(basename, phase, error)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfcxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-05-01 00:00:00.000000000 Z
11
+ date: 2026-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -60,6 +60,21 @@ files:
60
60
  - bin/console
61
61
  - bin/setup
62
62
  - lib/rfcxml.rb
63
+ - lib/rfcxml/rfc_index.rb
64
+ - lib/rfcxml/rfc_index/abstract.rb
65
+ - lib/rfcxml/rfc_index/author.rb
66
+ - lib/rfcxml/rfc_index/bcp_entry.rb
67
+ - lib/rfcxml/rfc_index/date.rb
68
+ - lib/rfcxml/rfc_index/document_ref.rb
69
+ - lib/rfcxml/rfc_index/format.rb
70
+ - lib/rfcxml/rfc_index/fyi_entry.rb
71
+ - lib/rfcxml/rfc_index/keywords.rb
72
+ - lib/rfcxml/rfc_index/kw.rb
73
+ - lib/rfcxml/rfc_index/namespace.rb
74
+ - lib/rfcxml/rfc_index/rfc_entry.rb
75
+ - lib/rfcxml/rfc_index/rfc_index.rb
76
+ - lib/rfcxml/rfc_index/rfc_not_issued_entry.rb
77
+ - lib/rfcxml/rfc_index/std_entry.rb
63
78
  - lib/rfcxml/v3.rb
64
79
  - lib/rfcxml/v3/abstract.rb
65
80
  - lib/rfcxml/v3/address.rb
@@ -170,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
185
  requirements:
171
186
  - - ">="
172
187
  - !ruby/object:Gem::Version
173
- version: 3.2.0
188
+ version: 3.3.0
174
189
  required_rubygems_version: !ruby/object:Gem::Requirement
175
190
  requirements:
176
191
  - - ">="