oasis-etm 0.2.0 → 0.2.1

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: 23be8f8415df8e3a0c5d31af9c565ed54e25fd715eeb3b1c6ef037723efd097e
4
- data.tar.gz: c8b1345655a9a6c501751ff0df2b57c1677dfb31f616e6de469f55d807f2211f
3
+ metadata.gz: a0ff0a0e066cadfe82cad8a4534d64d06dd4428acf13533a7444fa4b3b5da0d7
4
+ data.tar.gz: 6b67373f1ba6ca859c2b3dd168ec29c4823d9508b6a836aa79574fb9a23e22b0
5
5
  SHA512:
6
- metadata.gz: 7b4cf291505d624c48af4611c65fca22e00fbb9b4f1dd996241c5be56a6c2c76563dd6e76a1f478314153ed546a8afb0abf6992a066397d84c92290f033690cf
7
- data.tar.gz: b3c28b0012a7ff7da24ead1a827337aeb60921141ef263eb8e876eeffd545c31ba1df8eb067181da846ad9e82f224d72c98b9b8b678be29343799b472bf3dda4
6
+ metadata.gz: 8f33fffdf217b01fd8c566e5688d98054feace480e47b55f5c35a840f95780011c0771e5f0eb0cf82a1d22d2efca3abaac0e13fd075f917b9f817c84c81282be
7
+ data.tar.gz: a1dd3a44969806db9d390d977d076c2e3dae4d68e4d215f5a5b8eda3342f1423558321db2448254f2af165d10db1716dbb00ef24ee6de8fcb03b19ef001b9930
data/.rubocop_todo.yml CHANGED
@@ -1,27 +1,36 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2026-04-05 03:49:01 UTC using RuboCop version 1.86.0.
3
+ # on 2026-04-21 10:38:39 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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 8
9
+ # Offense count: 1
10
10
  # This cop supports safe autocorrection (--autocorrect).
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
- Bundler/OrderedGems:
11
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
12
+ # SupportedStyles: with_first_element, with_fixed_indentation
13
+ Layout/ArrayAlignment:
13
14
  Exclude:
14
- - 'Gemfile'
15
+ - 'spec/oasis/etm/row_spec.rb'
15
16
 
16
- # Offense count: 18
17
+ # Offense count: 14
17
18
  # This cop supports safe autocorrection (--autocorrect).
18
19
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
19
20
  # URISchemes: http, https
20
21
  Layout/LineLength:
21
22
  Exclude:
22
23
  - 'spec/oasis/etm/entry_spec.rb'
24
+ - 'spec/oasis/etm/row_spec.rb'
23
25
  - 'spec/oasis/etm_spec.rb'
24
26
 
27
+ # Offense count: 1
28
+ # This cop supports safe autocorrection (--autocorrect).
29
+ # Configuration parameters: AllowInHeredoc.
30
+ Layout/TrailingWhitespace:
31
+ Exclude:
32
+ - 'spec/oasis/etm/row_spec.rb'
33
+
25
34
  # Offense count: 9
26
35
  # Configuration parameters: CountAsOne.
27
36
  RSpec/ExampleLength:
data/CLAUDE.md ADDED
@@ -0,0 +1,35 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Commands
6
+
7
+ ```sh
8
+ bundle install # Install dependencies (uses lutaml-model from GitHub main)
9
+ bundle exec rspec # Run all specs
10
+ bundle exec rspec spec/oasis/etm/table_spec.rb # Run a single spec file
11
+ bundle exec rspec spec/oasis/etm/table_spec.rb:30 # Run a single test by line number
12
+ bundle exec rubocop # Lint
13
+ bundle exec rake # Run specs + rubocop (default task)
14
+ ```
15
+
16
+ ## Architecture
17
+
18
+ This gem implements the OASIS Exchange Table Model (TR 9503:1995) as Ruby objects using `lutaml-model` for XML serialization/deserialization.
19
+
20
+ **Core dependency chain:** All models inherit from `Lutaml::Model::Serializable` and share a common `Oasis::Etm::Namespace` definition (canonical URI: `http://docs.oasis-open.org/ns/oasis-exchange/table`, with `uri_aliases` for `urn:oasis:names:tc:xml:table` and the legacy FPI).
21
+
22
+ **Model hierarchy:** `Table` → `Tgroup` → (`Colspec`, `Thead` → `Row` → `Entry`, `Tbody` → `Row` → `Entry`). Each model declares its XML element, namespace, and attribute/element mappings via the `xml do` DSL block.
23
+
24
+ **Key model behaviors:**
25
+ - `colsep`, `rowsep`, `pgwide` attributes accept both integer (`0`/`1`) and legacy SGML string (`"yes"`/`"no"`) values — typed as `:string` with `values: %w[0 1 yes no]`
26
+ - `Entry` uses `mixed_content` and `collection: true` on its `content` attribute for mixed XML content handling
27
+ - `Table` and `Tgroup` use `ordered` to preserve child element ordering
28
+ - The `Namespace` class (subclass of `Lutaml::Xml::Namespace`) defines `uri_aliases` so all three namespace variants parse correctly; serialization always uses the canonical URI
29
+
30
+ **Spec structure:**
31
+ - `spec/oasis/etm/` — unit specs per model (table, entry, tgroup, etc.)
32
+ - `spec/oasis/etm_spec.rb` — round-trip tests using XML fixture files from `spec/fixtures/{native,isosts,niso-jats}/`
33
+ - Round-trip tests use the Canon gem (`be_analogous_with` matcher) with `spec_friendly` profile for XML comparison
34
+ - Some fixtures contain foreign elements (`<bold>`, `<para>`, `<xref>`) removed via Nokogiri before parsing
35
+ - ISOSTS fixtures normalize FPI namespace to URN before comparison (Canon requirement)
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  gem "canon"
9
- gem "lutaml-model", "~> 0.8.0", github: "lutaml/lutaml-model", branch: "main"
9
+ gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
10
10
  gem "nokogiri"
11
11
  gem "rake", "~> 13.0"
12
12
  gem "rspec", "~> 3.0"
@@ -17,7 +17,7 @@ module Oasis
17
17
  attribute :valign, :string, values: %w[top middle bottom]
18
18
 
19
19
  # Content
20
- attribute :content, :string, raw: true
20
+ attribute :content, :string, raw: true, collection: true
21
21
 
22
22
  xml do
23
23
  element "entry"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Oasis
4
4
  module Etm
5
- VERSION = "0.2.0"
5
+ VERSION = "0.2.1"
6
6
  end
7
7
  end
data/lib/oasis-etm.rb CHANGED
@@ -1 +1,3 @@
1
- require "oasis/etm"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "oasis/etm"
data/oasis-etm.gemspec CHANGED
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
30
30
  end
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
 
33
- spec.add_dependency "lutaml-model"
33
+ spec.add_dependency "lutaml-model", "~> 0.8.0"
34
34
  spec.metadata["rubygems_mfa_required"] = "true"
35
35
  end
@@ -33,7 +33,7 @@ RSpec.describe Oasis::Etm::Entry do
33
33
  end
34
34
 
35
35
  it "parses content" do
36
- expect(entry.content).to eq("Cell content")
36
+ expect(entry.content).to eq(["Cell content"])
37
37
  end
38
38
  end
39
39
 
@@ -19,7 +19,8 @@ RSpec.describe Oasis::Etm::Row do
19
19
 
20
20
  it "parses entries" do
21
21
  expect(row.entries.size).to eq(3)
22
- expect(row.entries.map(&:content)).to eq(["Cell 1", "Cell 2", "Cell 3"])
22
+ expect(row.entries.map(&:content)).to eq([["Cell 1"], ["Cell 2"],
23
+ ["Cell 3"]])
23
24
  end
24
25
  end
25
26
 
@@ -21,7 +21,7 @@ RSpec.describe Oasis::Etm::Tbody do
21
21
  it "parses rows" do
22
22
  expect(tbody.rows.size).to eq(1)
23
23
  expect(tbody.rows.first.entries.size).to eq(3)
24
- expect(tbody.rows.first.entries.first.content).to eq("Cell 1")
24
+ expect(tbody.rows.first.entries.first.content).to eq(["Cell 1"])
25
25
  end
26
26
  end
27
27
 
@@ -21,7 +21,7 @@ RSpec.describe Oasis::Etm::Thead do
21
21
  it "parses rows" do
22
22
  expect(thead.rows.size).to eq(1)
23
23
  expect(thead.rows.first.entries.size).to eq(3)
24
- expect(thead.rows.first.entries.first.content).to eq("Header 1")
24
+ expect(thead.rows.first.entries.first.content).to eq(["Header 1"])
25
25
  end
26
26
  end
27
27
 
@@ -34,7 +34,7 @@ RSpec.describe Oasis::Etm do
34
34
  .gsub("<table", '<table xmlns="http://docs.oasis-open.org/ns/oasis-exchange/table"')
35
35
  .gsub("<title>", '<title xmlns="">')
36
36
 
37
- expect(generated).to be_analogous_with(normalized_xml).with_profile(:spec_friendly)
37
+ expect(generated).to be_analogous_with(normalized_xml)
38
38
  end
39
39
  end
40
40
  end
@@ -69,8 +69,7 @@ RSpec.describe Oasis::Etm do
69
69
  encoding: "utf-8",
70
70
  )
71
71
 
72
- # Use spec_friendly to ignore attribute order and formatting differences
73
- expect(generated).to be_analogous_with(xml_content).with_profile(:spec_friendly)
72
+ expect(generated).to be_analogous_with(xml_content)
74
73
  end
75
74
  end
76
75
  end
@@ -101,8 +100,7 @@ RSpec.describe Oasis::Etm do
101
100
  encoding: "utf-8",
102
101
  )
103
102
 
104
- # Use spec_friendly to ignore attribute order and formatting differences
105
- expect(generated).to be_analogous_with(xml_content).with_profile(:spec_friendly)
103
+ expect(generated).to be_analogous_with(xml_content)
106
104
  end
107
105
  end
108
106
  end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../lib/oasis-etm"
4
- require "nokogiri"
5
- require "canon"
6
4
 
7
5
  # Require all support files
8
6
  Dir[File.join(__dir__, "support", "**", "*.rb")].each do |f|
@@ -21,7 +19,13 @@ RSpec.configure do |config|
21
19
  end
22
20
  end
23
21
 
24
- require "lutaml/model"
22
+ require "nokogiri"
25
23
  Lutaml::Model::Config.configure do |config|
26
24
  config.xml_adapter_type = :nokogiri
27
25
  end
26
+
27
+ require "canon"
28
+ Canon::Config.configure do |config|
29
+ config.xml.match.profile = :spec_friendly
30
+ config.xml.diff.use_color = true
31
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oasis-etm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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-04-05 00:00:00.000000000 Z
11
+ date: 2026-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.8.0
27
27
  description: 'Library for manipulation of OASIS Exchange Table Model XML.
28
28
 
29
29
  '
@@ -39,6 +39,7 @@ files:
39
39
  - ".rspec"
40
40
  - ".rubocop.yml"
41
41
  - ".rubocop_todo.yml"
42
+ - CLAUDE.md
42
43
  - CODE_OF_CONDUCT.md
43
44
  - Gemfile
44
45
  - README.adoc