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 +4 -4
- data/.rubocop_todo.yml +15 -6
- data/CLAUDE.md +35 -0
- data/Gemfile +1 -1
- data/lib/oasis/etm/entry.rb +1 -1
- data/lib/oasis/etm/version.rb +1 -1
- data/lib/oasis-etm.rb +3 -1
- data/oasis-etm.gemspec +1 -1
- data/spec/oasis/etm/entry_spec.rb +1 -1
- data/spec/oasis/etm/row_spec.rb +2 -1
- data/spec/oasis/etm/tbody_spec.rb +1 -1
- data/spec/oasis/etm/thead_spec.rb +1 -1
- data/spec/oasis/etm_spec.rb +3 -5
- data/spec/spec_helper.rb +7 -3
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0ff0a0e066cadfe82cad8a4534d64d06dd4428acf13533a7444fa4b3b5da0d7
|
|
4
|
+
data.tar.gz: 6b67373f1ba6ca859c2b3dd168ec29c4823d9508b6a836aa79574fb9a23e22b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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-
|
|
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:
|
|
9
|
+
# Offense count: 1
|
|
10
10
|
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
-
# Configuration parameters:
|
|
12
|
-
|
|
11
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
|
12
|
+
# SupportedStyles: with_first_element, with_fixed_indentation
|
|
13
|
+
Layout/ArrayAlignment:
|
|
13
14
|
Exclude:
|
|
14
|
-
- '
|
|
15
|
+
- 'spec/oasis/etm/row_spec.rb'
|
|
15
16
|
|
|
16
|
-
# Offense count:
|
|
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",
|
|
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"
|
data/lib/oasis/etm/entry.rb
CHANGED
data/lib/oasis/etm/version.rb
CHANGED
data/lib/oasis-etm.rb
CHANGED
data/oasis-etm.gemspec
CHANGED
data/spec/oasis/etm/row_spec.rb
CHANGED
|
@@ -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",
|
|
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
|
|
data/spec/oasis/etm_spec.rb
CHANGED
|
@@ -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)
|
|
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
|
-
|
|
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
|
-
|
|
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 "
|
|
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.
|
|
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-
|
|
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:
|
|
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:
|
|
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
|