sts 0.6.4 → 0.6.6
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/TODO.sts-refactor/00-overview.md +9 -8
- data/TODO.sts-refactor/03-namespace-coupling.md +30 -7
- data/TODO.sts-refactor/09-autoload-cleanup.md +48 -83
- data/TODO.sts-refactor/11-duplicate-models.md +32 -2
- data/lib/sts/iso_sts/array.rb +1 -1
- data/lib/sts/iso_sts/attrib.rb +72 -0
- data/lib/sts/iso_sts/body.rb +1 -1
- data/lib/sts/iso_sts/boxed_text.rb +71 -0
- data/lib/sts/iso_sts/disp_quote.rb +55 -0
- data/lib/sts/iso_sts/sec.rb +2 -2
- data/lib/sts/iso_sts/table_wrap_foot.rb +1 -1
- data/lib/sts/iso_sts.rb +3 -3
- data/lib/sts/version.rb +1 -1
- metadata +5 -4
- data/lib/sts/iso_sts/mathml2/math.rb +0 -68
- data/lib/sts/iso_sts/mathml2.rb +0 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 201840881c86c036233c5bb1305bf176bbe6bf4ca0f43a22e370105cac0ed54f
|
|
4
|
+
data.tar.gz: 5845dd5fb849611a4a11bf173af68b3c226cf5c807d09bb721cf09cecdc8544b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20d4010381ed9daf225ecf13afc922b5cf338ec62318b24ee22554163885c815aa5db22257be600262fe8be9f7f8668a0569805e5a201db35b98a84e1fbfa982
|
|
7
|
+
data.tar.gz: c4078992f02ab4a9e6640e750d2f54b29136b187a58b9e42cc21e9a2cc76b7049c6e25f9b823e0827f2851468e3f0dcc618271526880ae3121be3f2fc5512d69
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|---|------|----------|----------|--------------|
|
|
20
20
|
| 01 | `01-mathml-delegation.md` | Anti-Pattern Fix | DONE | — |
|
|
21
21
|
| 02 | `02-type-resolution.md` | Anti-Pattern Fix | DONE | — |
|
|
22
|
-
| 03 | `03-namespace-coupling.md` | Architecture | IN PROGRESS (63→
|
|
22
|
+
| 03 | `03-namespace-coupling.md` | Architecture | IN PROGRESS (63→11 refs) | 01, 02 |
|
|
23
23
|
| 04 | `04-register-versioning.md` | Architecture | HIGH | 01, 02 |
|
|
24
24
|
| 05 | `05-missing-elements.md` | Feature Gap | MOSTLY DONE | 04 |
|
|
25
25
|
| 06 | `06-missing-attributes.md` | Feature Gap | DONE | 04 |
|
|
@@ -166,7 +166,7 @@ grep -r "method_missing|respond_to_missing|Object.const_get|\.send" lib/
|
|
|
166
166
|
- ~~Expand StringName usage (in contrib, element-citation, related-article — NISO STS 1.2)~~ → DONE: added to name-alternatives; already in person-group and mixed-citation
|
|
167
167
|
|
|
168
168
|
### Architectural Items (High Effort)
|
|
169
|
-
- `03-namespace-coupling.md` — IN PROGRESS: 63→
|
|
169
|
+
- `03-namespace-coupling.md` — IN PROGRESS: 63→11 IsoSts→NisoSts references
|
|
170
170
|
remaining (issue #40). ISOSTS.xsd governs content models and all non-`@id`
|
|
171
171
|
attributes; the `@id` follows the 86948b9 convention.
|
|
172
172
|
- `04-register-versioning.md` — Version the models via lutaml-model Registers
|
|
@@ -193,12 +193,13 @@ the **NISO** XSD and applied the result to IsoSts.
|
|
|
193
193
|
|
|
194
194
|
## Next Action
|
|
195
195
|
Two independent tracks:
|
|
196
|
-
1. Finish `03` — the
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
1. Finish `03` — the 11 remaining refs split across five recursive roots
|
|
197
|
+
(`ElementCitation`, `PersonGroup`, `Collab`, `Source`, `TermDisplay`) and
|
|
198
|
+
five child-bearing roots. `DispQuote` and `BoxedText` themselves are now
|
|
199
|
+
IsoSts classes. The first 15 high-reuse dependency leaves are modelled,
|
|
200
|
+
reducing the unresolved closures to 78–84 not-yet-modelled ISOSTS elements
|
|
201
|
+
before existing IsoSts boundaries. The remaining work still needs an
|
|
202
|
+
architecture decision for the recursive content core.
|
|
202
203
|
2. The remaining schema-conformance follow-up above — the 7 spurious attributes
|
|
203
204
|
on 5 models and the 6 classes without `@id`. (The dropped-attribute data loss
|
|
204
205
|
is now fixed.)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
**Priority**: HIGH
|
|
4
4
|
**Category**: Architecture
|
|
5
5
|
**Estimated Effort**: High
|
|
6
|
-
**Status**: Partially done — 63 →
|
|
6
|
+
**Status**: Partially done — 63 → 11 references (GitHub issue #40)
|
|
7
7
|
|
|
8
8
|
## Problem
|
|
9
9
|
|
|
@@ -12,7 +12,11 @@ independent of NisoSts (ADR 2026-05-07): ISOSTS is frozen legacy, NISO STS
|
|
|
12
12
|
evolves, so coupling them violates OCP.
|
|
13
13
|
|
|
14
14
|
PR #31 reduced this from 157 to 63 references. Issue #40 reduced it further,
|
|
15
|
-
from 63 to 16.
|
|
15
|
+
from 63 to 16. The `IsoSts::DispQuote` / `IsoSts::BoxedText` addition then
|
|
16
|
+
reduced it from 16 to 13 (Body#disp_quote, Sec#disp_quote, Sec#boxed_text).
|
|
17
|
+
The `IsoSts::Attrib` addition then reduced it from 13 to 11
|
|
18
|
+
(Array#attrib, TableWrapFoot#attrib) and filled the omission in DispQuote /
|
|
19
|
+
BoxedText from PR #48.
|
|
16
20
|
|
|
17
21
|
## Content models from ISOSTS.xsd; `@id` from the 86948b9 convention
|
|
18
22
|
|
|
@@ -69,6 +73,24 @@ Non-`@id` attribute lists must be **generated** from the XSD, never hand-read:
|
|
|
69
73
|
- **3 Niso-only child refs deleted** — `std-meta` from `Front` and
|
|
70
74
|
`editing-instruction` from `Body` and `Sec`. Neither element exists in
|
|
71
75
|
ISOSTS.xsd, so adding IsoSts equivalents would incorrectly expand the schema.
|
|
76
|
+
- **`DispQuote` and `BoxedText` added** — modelled from ISOSTS.xsd (not copied
|
|
77
|
+
from NisoSts, which disagrees: `NisoSts::DispQuote` lacks `xml_lang` and
|
|
78
|
+
`title`; `NisoSts::BoxedText` carries `form_type`/`is_form` that ISOSTS does
|
|
79
|
+
not define). Children limited to existing IsoSts types; omitted children
|
|
80
|
+
(`speech`, `statement`, `verse-group`, `address`, `alternatives`,
|
|
81
|
+
`array`, `chem-struct-wrap`, `fig-group`, `media`, `supplementary-material`,
|
|
82
|
+
`table-wrap`, `table-wrap-group`, `disp-formula-group`, `mml:math`,
|
|
83
|
+
`related-article`, `related-object`, `glossary`) are tracked below.
|
|
84
|
+
`BoxedText#sts_object_id` (not `:object_id`) follows the `NisoSts::Graphic`
|
|
85
|
+
convention to avoid clashing with `Object#object_id`. 3 refs.
|
|
86
|
+
- **`Attrib` added** — mixed-content class modelled from ISOSTS.xsd with the
|
|
87
|
+
25 inline-element children that have IsoSts types today. Fills the
|
|
88
|
+
`attrib` gap left in `DispQuote` and `BoxedText` from the prior bullet.
|
|
89
|
+
2 refs (`Array#attrib`, `TableWrapFoot#attrib`). Omitted inline children
|
|
90
|
+
(`inline-supplementary-material`, `related-article`, `related-object`,
|
|
91
|
+
`element-citation`, `overline`, `roman`, `sans-serif`, `alternatives`,
|
|
92
|
+
`private-char`, `chem-struct`, `mml:math`, `target`, `tbx:entailedTerm`)
|
|
93
|
+
tracked below.
|
|
72
94
|
|
|
73
95
|
### Why classes and not plain `:string`
|
|
74
96
|
|
|
@@ -79,12 +101,13 @@ round-trip. For a scalar, `render_empty: :empty` recovers it; for a collection
|
|
|
79
101
|
to `[]`, destroying the information at parse time before any render option
|
|
80
102
|
applies. Content-only classes round-trip every case.
|
|
81
103
|
|
|
82
|
-
## Remaining —
|
|
104
|
+
## Remaining — 11 refs
|
|
83
105
|
|
|
84
|
-
**
|
|
85
|
-
`Source`, `
|
|
86
|
-
|
|
87
|
-
|
|
106
|
+
**5 refs to 5 recursive roots**: `ElementCitation`, `PersonGroup`, `Collab`,
|
|
107
|
+
`Source`, `TermDisplay`. Each reaches the same 78–79-element
|
|
108
|
+
mutually-recursive core before existing IsoSts boundaries (`sec` → `p` →
|
|
109
|
+
`disp-quote` → `p`). `DispQuote`, `BoxedText`, and `Attrib` are now IsoSts
|
|
110
|
+
classes and no longer in this list.
|
|
88
111
|
|
|
89
112
|
**8 refs to 5 child-bearing roots**, now measured after the first dependency
|
|
90
113
|
layer: `attrib` (:1082) reaches 78 not-yet-modelled ISOSTS elements before
|
|
@@ -1,88 +1,53 @@
|
|
|
1
1
|
# 09: Autoload and Require Cleanup
|
|
2
2
|
|
|
3
|
+
**Status**: Refreshed 2026-07-26. Most items done; remaining items noted below.
|
|
3
4
|
**Priority**: LOW
|
|
4
5
|
**Category**: Cleanup
|
|
5
|
-
**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
6
|
+
**Files Affected**: `lib/sts.rb`, `lib/sts/iso_sts.rb`, `lib/sts/niso_sts.rb`
|
|
7
|
+
|
|
8
|
+
## Done
|
|
9
|
+
|
|
10
|
+
- **Moxml monkey-patch removed entirely** — upstream fix in moxml aa58888.
|
|
11
|
+
No code lives in `lib/sts.rb` patching `Moxml::Adapter::Nokogiri`.
|
|
12
|
+
- **`lib/sts/mathml.rb` deleted** (commit 9e977a5) — Presentation MathML
|
|
13
|
+
unified on the mml gem (`Mml::V3::Math` for NisoSts, `Mml::V2::Math` for
|
|
14
|
+
IsoSts/TbxIsoTml per the host-binding fix in PR #45).
|
|
15
|
+
- **`lib/sts/iso_sts/mathml2/` deleted** (this change) — dead-code hack file
|
|
16
|
+
that violated multiple anti-pattern rules. `IsoSts::Mathml2::Math` is gone.
|
|
17
|
+
- **`lib/sts/content_groups/` deleted** — was dead code (the only caller,
|
|
18
|
+
`IsoSts::ContentGroups::HighlightElements`, was itself dead).
|
|
19
|
+
- **`lib/sts/tbx_iso_tml/fn.rb` and `fn_group.rb` deleted** (PR #47) —
|
|
20
|
+
duplicates of `NisoSts::Fn` / `NisoSts::FnGroup` with conflicting Ruby
|
|
21
|
+
attribute names.
|
|
22
|
+
- **Autoload registry is 1:1 with the directory tree** for both `iso_sts/`
|
|
23
|
+
and `niso_sts/`.
|
|
24
|
+
- **`require_relative` is forbidden in `lib/`** — enforced by the
|
|
25
|
+
strengthened `spec/anti_patterns_spec.rb` (this change).
|
|
26
|
+
|
|
27
|
+
## Current autoload conventions
|
|
28
|
+
|
|
29
|
+
- Top-level: `lib/sts.rb` declares `autoload` for each top-level namespace
|
|
30
|
+
(`IsoSts`, `NisoSts`, `TbxIsoTml`, `Namespaces`, `Profiles`, `VERSION`).
|
|
31
|
+
- Each namespace's `lib/sts/<namespace>.rb` file declares `autoload` for
|
|
32
|
+
every class in that namespace, organised by category with leading
|
|
33
|
+
comments. Alphabetical order within each category block.
|
|
34
|
+
- External gems are eagerly required at the top of `lib/sts.rb`
|
|
35
|
+
(`require "lutaml/model"`, `require "mml"`). Internal code never uses
|
|
36
|
+
`require` or `require_relative`.
|
|
37
|
+
|
|
38
|
+
## Remaining items
|
|
39
|
+
|
|
40
|
+
- **`lib/sts/iso_sts.rb:3` has `require "mml"`** — redundant with the
|
|
41
|
+
top-level require in `lib/sts.rb:4`. Can be removed once verified no
|
|
42
|
+
load-order issue exists. Low priority.
|
|
43
|
+
- **Verify no implicit load-order deps remain** — the autoload system
|
|
44
|
+
should resolve all references lazily. If a circular dependency emerges,
|
|
45
|
+
it usually indicates a misnamed constant or a missing autoload entry.
|
|
46
|
+
|
|
47
|
+
## Verification
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bundle exec rspec spec/anti_patterns_spec.rb # catches require_relative,
|
|
51
|
+
# internal require, etc.
|
|
52
|
+
bundle exec rake # full suite
|
|
44
53
|
```
|
|
45
|
-
lib/
|
|
46
|
-
├── sts.rb # Top-level: requires, Moxml patch (documented)
|
|
47
|
-
├── sts/
|
|
48
|
-
│ ├── namespaces.rb # Namespace constants
|
|
49
|
-
│ ├── mathml.rb # MathML wrapper (after TODO 01 fix)
|
|
50
|
-
│ ├── mathml/ # MathML-specific types (if needed)
|
|
51
|
-
│ ├── base/ # Shared base types (after TODO 03)
|
|
52
|
-
│ │ ├── text/ # Bold, Italic, Sub, Sup
|
|
53
|
-
│ │ ├── struct/ # Section, Paragraph, List
|
|
54
|
-
│ │ ├── meta/ # Title, Label, Caption
|
|
55
|
-
│ │ └── refs/ # Xref, BiblioRef
|
|
56
|
-
│ ├── iso_sts/ # ISOSTS namespace
|
|
57
|
-
│ │ ├── iso_sts.rb # Autoload declarations
|
|
58
|
-
│ │ ├── v1_1/ # ISOSTS v1.1 classes
|
|
59
|
-
│ │ └── content_groups/ # Content group helpers
|
|
60
|
-
│ ├── niso_sts/ # NISO STS namespace
|
|
61
|
-
│ │ ├── niso_sts.rb # Autoload declarations
|
|
62
|
-
│ │ ├── v1_0/ # NISO STS 1.0 classes
|
|
63
|
-
│ │ ├── v1_2/ # NISO STS 1.2 classes
|
|
64
|
-
│ │ ├── content_groups/ # Content group helpers
|
|
65
|
-
│ │ ├── mml_content/ # MathML content elements
|
|
66
|
-
│ │ └── xi.rb, ali.rb # Namespace modules
|
|
67
|
-
│ ├── tbx_iso_tml/ # TBX namespace
|
|
68
|
-
│ │ ├── tbx_iso_tml.rb # Autoload declarations
|
|
69
|
-
│ │ └── ...
|
|
70
|
-
│ ├── content_groups/ # Shared content group helpers
|
|
71
|
-
│ │ └── helpers.rb # After TODO 02 fix
|
|
72
|
-
│ └── profiles/ # ISO/IEC validation layer (after TODO 08)
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Dependencies
|
|
76
|
-
|
|
77
|
-
- `01-mathml-delegation.md` — MathML wrapper location
|
|
78
|
-
- `03-namespace-coupling.md` — base types directory structure
|
|
79
|
-
- `04-register-versioning.md` — versioned subdirectories
|
|
80
|
-
|
|
81
|
-
## TODO Checklist
|
|
82
|
-
|
|
83
|
-
- [x] Document Moxml monkey-patch with rationale (removed entirely — upstream fix in moxml aa58888)
|
|
84
|
-
- [x] Audit autoload entries for alphabetical order
|
|
85
|
-
- [x] After refactoring: remove orphaned files (deleted content_groups dead code)
|
|
86
|
-
- [ ] After refactoring: verify no implicit load-order deps
|
|
87
|
-
- [x] After refactoring: clean up unused requires
|
|
88
|
-
- [x] Verify `bundle exec rake` passes cleanly
|
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
# 11: Duplicate Model Resolution
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Status**: REJECTED (2026-07-26) — kept for historical context.
|
|
4
|
+
**Priority**: N/A
|
|
4
5
|
**Category**: Architecture
|
|
5
|
-
**Estimated Effort**:
|
|
6
|
+
**Estimated Effort**: N/A
|
|
6
7
|
**Files Affected**: `lib/sts/iso_sts/`, `lib/sts/niso_sts/`
|
|
7
8
|
|
|
9
|
+
## Why rejected
|
|
10
|
+
|
|
11
|
+
The "Resolution Strategy" below proposes a `Sts::Base::*` three-tier class
|
|
12
|
+
hierarchy that both `IsoSts` and `NisoSts` inherit from. This contradicts:
|
|
13
|
+
|
|
14
|
+
- The 2026-05-07 ADR on namespace independence.
|
|
15
|
+
- `TODO.sts-refactor/03-namespace-coupling.md` "Rejected" section.
|
|
16
|
+
- The project-global memory `architecture-namespace-independence`:
|
|
17
|
+
"NEVER create shared `Sts::Base` classes that both namespaces inherit from".
|
|
18
|
+
|
|
19
|
+
The schemas genuinely diverge — `IsoSts::Fig` has `title`/`alternatives` that
|
|
20
|
+
`NisoSts::Figure` lacks; `IsoSts::Ref` has `nlm-citation`/`citation-alternatives`
|
|
21
|
+
that `NisoSts::Reference` lacks. A shared base would fight the schemas and
|
|
22
|
+
violate the Open/Closed Principle.
|
|
23
|
+
|
|
24
|
+
The "duplicate" classes between IsoSts and NisoSts are intentional: each
|
|
25
|
+
namespace must have its own complete, independent set of model classes
|
|
26
|
+
modelled from its own schema (ISOSTS.xsd vs NISO-STS-extended-1.xsd). The
|
|
27
|
+
correct way to reduce the duplication appearance is to finish TODO 03
|
|
28
|
+
(model IsoSts classes from ISOSTS.xsd, replacing NisoSts references),
|
|
29
|
+
not to share base types.
|
|
30
|
+
|
|
31
|
+
The rest of this document is preserved for reference only. **Do not implement
|
|
32
|
+
the proposals below.**
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Original problem statement (rejected)
|
|
37
|
+
|
|
8
38
|
## Problem
|
|
9
39
|
|
|
10
40
|
Many model classes exist in both `Sts::IsoSts` and `Sts::NisoSts` with the same XML element name but potentially different attributes. This creates:
|
data/lib/sts/iso_sts/array.rb
CHANGED
|
@@ -11,7 +11,7 @@ module Sts
|
|
|
11
11
|
attribute :originator, :string
|
|
12
12
|
attribute :label, ::Sts::IsoSts::Label
|
|
13
13
|
attribute :table, ::Sts::IsoSts::Table
|
|
14
|
-
attribute :attrib, ::Sts::
|
|
14
|
+
attribute :attrib, ::Sts::IsoSts::Attrib, collection: true
|
|
15
15
|
attribute :permissions, ::Sts::IsoSts::Permissions, collection: true
|
|
16
16
|
|
|
17
17
|
xml do
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sts
|
|
4
|
+
module IsoSts
|
|
5
|
+
class Attrib < Lutaml::Model::Serializable
|
|
6
|
+
attribute :id, :string
|
|
7
|
+
attribute :specific_use, :string
|
|
8
|
+
attribute :xml_lang, :string
|
|
9
|
+
attribute :content, :string, collection: true
|
|
10
|
+
attribute :email, ::Sts::IsoSts::Email, collection: true
|
|
11
|
+
attribute :ext_link, ::Sts::IsoSts::ExtLink, collection: true
|
|
12
|
+
attribute :uri, ::Sts::IsoSts::Uri, collection: true
|
|
13
|
+
attribute :mixed_citation, ::Sts::IsoSts::MixedCitation, collection: true
|
|
14
|
+
attribute :std, ::Sts::IsoSts::Std, collection: true
|
|
15
|
+
attribute :bold, ::Sts::IsoSts::Bold, collection: true
|
|
16
|
+
attribute :italic, ::Sts::IsoSts::Italic, collection: true
|
|
17
|
+
attribute :monospace, ::Sts::IsoSts::Monospace, collection: true
|
|
18
|
+
attribute :num, ::Sts::IsoSts::Num, collection: true
|
|
19
|
+
attribute :sc, ::Sts::IsoSts::Sc, collection: true
|
|
20
|
+
attribute :strike, ::Sts::IsoSts::Strike, collection: true
|
|
21
|
+
attribute :underline, ::Sts::IsoSts::Underline, collection: true
|
|
22
|
+
attribute :inline_graphic, ::Sts::IsoSts::InlineGraphic, collection: true
|
|
23
|
+
attribute :inline_formula, ::Sts::IsoSts::InlineFormula, collection: true
|
|
24
|
+
attribute :abbrev, ::Sts::IsoSts::Abbrev, collection: true
|
|
25
|
+
attribute :milestone_end, ::Sts::IsoSts::MilestoneEnd, collection: true
|
|
26
|
+
attribute :milestone_start, ::Sts::IsoSts::MilestoneStart,
|
|
27
|
+
collection: true
|
|
28
|
+
attribute :named_content, ::Sts::IsoSts::NamedContent, collection: true
|
|
29
|
+
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
30
|
+
attribute :fn, ::Sts::IsoSts::Fn, collection: true
|
|
31
|
+
attribute :xref, ::Sts::IsoSts::Xref, collection: true
|
|
32
|
+
attribute :std_ref, ::Sts::IsoSts::StdRef, collection: true
|
|
33
|
+
attribute :sub, ::Sts::IsoSts::Sub, collection: true
|
|
34
|
+
attribute :sup, ::Sts::IsoSts::Sup, collection: true
|
|
35
|
+
|
|
36
|
+
xml do # rubocop:disable Metrics/BlockLength
|
|
37
|
+
element "attrib"
|
|
38
|
+
mixed_content
|
|
39
|
+
|
|
40
|
+
map_attribute "id", to: :id
|
|
41
|
+
map_attribute "specific-use", to: :specific_use
|
|
42
|
+
map_attribute "xml:lang", to: :xml_lang
|
|
43
|
+
|
|
44
|
+
map_content to: :content
|
|
45
|
+
map_element "email", to: :email
|
|
46
|
+
map_element "ext-link", to: :ext_link
|
|
47
|
+
map_element "uri", to: :uri
|
|
48
|
+
map_element "mixed-citation", to: :mixed_citation
|
|
49
|
+
map_element "std", to: :std
|
|
50
|
+
map_element "bold", to: :bold
|
|
51
|
+
map_element "italic", to: :italic
|
|
52
|
+
map_element "monospace", to: :monospace
|
|
53
|
+
map_element "num", to: :num
|
|
54
|
+
map_element "sc", to: :sc
|
|
55
|
+
map_element "strike", to: :strike
|
|
56
|
+
map_element "underline", to: :underline
|
|
57
|
+
map_element "inline-graphic", to: :inline_graphic
|
|
58
|
+
map_element "inline-formula", to: :inline_formula
|
|
59
|
+
map_element "abbrev", to: :abbrev
|
|
60
|
+
map_element "milestone-end", to: :milestone_end
|
|
61
|
+
map_element "milestone-start", to: :milestone_start
|
|
62
|
+
map_element "named-content", to: :named_content
|
|
63
|
+
map_element "styled-content", to: :styled_content
|
|
64
|
+
map_element "fn", to: :fn
|
|
65
|
+
map_element "xref", to: :xref
|
|
66
|
+
map_element "std-ref", to: :std_ref
|
|
67
|
+
map_element "sub", to: :sub
|
|
68
|
+
map_element "sup", to: :sup
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
data/lib/sts/iso_sts/body.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Sts
|
|
|
22
22
|
attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
|
|
23
23
|
attribute :array, ::Sts::IsoSts::Array, collection: true
|
|
24
24
|
attribute :ref_list, ::Sts::IsoSts::RefList, collection: true
|
|
25
|
-
attribute :disp_quote, ::Sts::
|
|
25
|
+
attribute :disp_quote, ::Sts::IsoSts::DispQuote, collection: true
|
|
26
26
|
|
|
27
27
|
xml do
|
|
28
28
|
element "body"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sts
|
|
4
|
+
module IsoSts
|
|
5
|
+
class BoxedText < Lutaml::Model::Serializable
|
|
6
|
+
attribute :id, :string
|
|
7
|
+
attribute :position, :string
|
|
8
|
+
attribute :orientation, :string
|
|
9
|
+
attribute :specific_use, :string
|
|
10
|
+
attribute :xml_lang, :string
|
|
11
|
+
attribute :content_type, :string
|
|
12
|
+
attribute :originator, :string
|
|
13
|
+
attribute :sts_object_id, ::Sts::IsoSts::ObjectId, collection: true
|
|
14
|
+
attribute :label, ::Sts::IsoSts::Label
|
|
15
|
+
attribute :caption, ::Sts::IsoSts::Caption
|
|
16
|
+
attribute :paragraph, ::Sts::IsoSts::Paragraph, collection: true
|
|
17
|
+
attribute :list, ::Sts::IsoSts::List, collection: true
|
|
18
|
+
attribute :def_list, ::Sts::IsoSts::DefList, collection: true
|
|
19
|
+
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote,
|
|
20
|
+
collection: true
|
|
21
|
+
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample,
|
|
22
|
+
collection: true
|
|
23
|
+
attribute :preformat, ::Sts::IsoSts::Preformat, collection: true
|
|
24
|
+
attribute :fig, ::Sts::IsoSts::Fig, collection: true
|
|
25
|
+
attribute :graphic, ::Sts::IsoSts::Graphic, collection: true
|
|
26
|
+
attribute :disp_formula, ::Sts::IsoSts::DispFormula, collection: true
|
|
27
|
+
attribute :disp_quote, ::Sts::IsoSts::DispQuote, collection: true
|
|
28
|
+
attribute :boxed_text, ::Sts::IsoSts::BoxedText, collection: true
|
|
29
|
+
attribute :sec, ::Sts::IsoSts::Sec, collection: true
|
|
30
|
+
attribute :term_sec, ::Sts::IsoSts::TermSec, collection: true
|
|
31
|
+
attribute :fn_group, ::Sts::IsoSts::FnGroup, collection: true
|
|
32
|
+
attribute :ref_list, ::Sts::IsoSts::RefList, collection: true
|
|
33
|
+
attribute :attrib, ::Sts::IsoSts::Attrib, collection: true
|
|
34
|
+
attribute :permissions, ::Sts::IsoSts::Permissions, collection: true
|
|
35
|
+
|
|
36
|
+
xml do # rubocop:disable Metrics/BlockLength
|
|
37
|
+
element "boxed-text"
|
|
38
|
+
ordered
|
|
39
|
+
|
|
40
|
+
map_attribute "id", to: :id
|
|
41
|
+
map_attribute "position", to: :position
|
|
42
|
+
map_attribute "orientation", to: :orientation
|
|
43
|
+
map_attribute "specific-use", to: :specific_use
|
|
44
|
+
map_attribute "xml:lang", to: :xml_lang
|
|
45
|
+
map_attribute "content-type", to: :content_type
|
|
46
|
+
map_attribute "originator", to: :originator
|
|
47
|
+
|
|
48
|
+
map_element "object-id", to: :sts_object_id
|
|
49
|
+
map_element "label", to: :label
|
|
50
|
+
map_element "caption", to: :caption
|
|
51
|
+
map_element "p", to: :paragraph
|
|
52
|
+
map_element "list", to: :list
|
|
53
|
+
map_element "def-list", to: :def_list
|
|
54
|
+
map_element "non-normative-note", to: :non_normative_note
|
|
55
|
+
map_element "non-normative-example", to: :non_normative_example
|
|
56
|
+
map_element "preformat", to: :preformat
|
|
57
|
+
map_element "fig", to: :fig
|
|
58
|
+
map_element "graphic", to: :graphic
|
|
59
|
+
map_element "disp-formula", to: :disp_formula
|
|
60
|
+
map_element "disp-quote", to: :disp_quote
|
|
61
|
+
map_element "boxed-text", to: :boxed_text
|
|
62
|
+
map_element "sec", to: :sec
|
|
63
|
+
map_element "term-sec", to: :term_sec
|
|
64
|
+
map_element "fn-group", to: :fn_group
|
|
65
|
+
map_element "ref-list", to: :ref_list
|
|
66
|
+
map_element "attrib", to: :attrib
|
|
67
|
+
map_element "permissions", to: :permissions
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Sts
|
|
4
|
+
module IsoSts
|
|
5
|
+
class DispQuote < Lutaml::Model::Serializable
|
|
6
|
+
attribute :id, :string
|
|
7
|
+
attribute :content_type, :string
|
|
8
|
+
attribute :specific_use, :string
|
|
9
|
+
attribute :xml_lang, :string
|
|
10
|
+
attribute :originator, :string
|
|
11
|
+
attribute :label, ::Sts::IsoSts::Label
|
|
12
|
+
attribute :title, ::Sts::IsoSts::Title
|
|
13
|
+
attribute :paragraph, ::Sts::IsoSts::Paragraph, collection: true
|
|
14
|
+
attribute :list, ::Sts::IsoSts::List, collection: true
|
|
15
|
+
attribute :def_list, ::Sts::IsoSts::DefList, collection: true
|
|
16
|
+
attribute :non_normative_note, ::Sts::IsoSts::NonNormativeNote,
|
|
17
|
+
collection: true
|
|
18
|
+
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample,
|
|
19
|
+
collection: true
|
|
20
|
+
attribute :preformat, ::Sts::IsoSts::Preformat, collection: true
|
|
21
|
+
attribute :fig, ::Sts::IsoSts::Fig, collection: true
|
|
22
|
+
attribute :graphic, ::Sts::IsoSts::Graphic, collection: true
|
|
23
|
+
attribute :disp_formula, ::Sts::IsoSts::DispFormula, collection: true
|
|
24
|
+
attribute :disp_quote, ::Sts::IsoSts::DispQuote, collection: true
|
|
25
|
+
attribute :attrib, ::Sts::IsoSts::Attrib, collection: true
|
|
26
|
+
attribute :permissions, ::Sts::IsoSts::Permissions, collection: true
|
|
27
|
+
|
|
28
|
+
xml do
|
|
29
|
+
element "disp-quote"
|
|
30
|
+
ordered
|
|
31
|
+
|
|
32
|
+
map_attribute "id", to: :id
|
|
33
|
+
map_attribute "content-type", to: :content_type
|
|
34
|
+
map_attribute "specific-use", to: :specific_use
|
|
35
|
+
map_attribute "xml:lang", to: :xml_lang
|
|
36
|
+
map_attribute "originator", to: :originator
|
|
37
|
+
|
|
38
|
+
map_element "label", to: :label
|
|
39
|
+
map_element "title", to: :title
|
|
40
|
+
map_element "p", to: :paragraph
|
|
41
|
+
map_element "list", to: :list
|
|
42
|
+
map_element "def-list", to: :def_list
|
|
43
|
+
map_element "non-normative-note", to: :non_normative_note
|
|
44
|
+
map_element "non-normative-example", to: :non_normative_example
|
|
45
|
+
map_element "preformat", to: :preformat
|
|
46
|
+
map_element "fig", to: :fig
|
|
47
|
+
map_element "graphic", to: :graphic
|
|
48
|
+
map_element "disp-formula", to: :disp_formula
|
|
49
|
+
map_element "disp-quote", to: :disp_quote
|
|
50
|
+
map_element "attrib", to: :attrib
|
|
51
|
+
map_element "permissions", to: :permissions
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
data/lib/sts/iso_sts/sec.rb
CHANGED
|
@@ -33,9 +33,9 @@ module Sts
|
|
|
33
33
|
attribute :uri, ::Sts::IsoSts::Uri, collection: true
|
|
34
34
|
attribute :sec, ::Sts::IsoSts::Sec, collection: true
|
|
35
35
|
attribute :term_sec, ::Sts::IsoSts::TermSec, collection: true
|
|
36
|
-
attribute :disp_quote, ::Sts::
|
|
36
|
+
attribute :disp_quote, ::Sts::IsoSts::DispQuote, collection: true
|
|
37
37
|
attribute :fn, ::Sts::IsoSts::Fn, collection: true
|
|
38
|
-
attribute :boxed_text, ::Sts::
|
|
38
|
+
attribute :boxed_text, ::Sts::IsoSts::BoxedText, collection: true
|
|
39
39
|
|
|
40
40
|
xml do # rubocop:disable Metrics/BlockLength
|
|
41
41
|
element "sec"
|
|
@@ -10,7 +10,7 @@ module Sts
|
|
|
10
10
|
attribute :non_normative_example, ::Sts::IsoSts::NonNormativeExample
|
|
11
11
|
attribute :fn_group, ::Sts::IsoSts::FnGroup
|
|
12
12
|
attribute :fn, ::Sts::IsoSts::Fn
|
|
13
|
-
attribute :attrib, ::Sts::
|
|
13
|
+
attribute :attrib, ::Sts::IsoSts::Attrib
|
|
14
14
|
attribute :permissions, ::Sts::IsoSts::Permissions
|
|
15
15
|
|
|
16
16
|
xml do
|
data/lib/sts/iso_sts.rb
CHANGED
|
@@ -88,6 +88,8 @@ module Sts
|
|
|
88
88
|
autoload :Label, "#{__dir__}/iso_sts/label"
|
|
89
89
|
autoload :Title, "#{__dir__}/iso_sts/title"
|
|
90
90
|
autoload :Bold, "#{__dir__}/iso_sts/bold"
|
|
91
|
+
autoload :BoxedText, "#{__dir__}/iso_sts/boxed_text"
|
|
92
|
+
autoload :DispQuote, "#{__dir__}/iso_sts/disp_quote"
|
|
91
93
|
autoload :Italic, "#{__dir__}/iso_sts/italic"
|
|
92
94
|
autoload :Monospace, "#{__dir__}/iso_sts/monospace"
|
|
93
95
|
autoload :NamedContent, "#{__dir__}/iso_sts/named_content"
|
|
@@ -99,6 +101,7 @@ module Sts
|
|
|
99
101
|
# Shared model foundations
|
|
100
102
|
autoload :Abbrev, "#{__dir__}/iso_sts/abbrev"
|
|
101
103
|
autoload :Annotation, "#{__dir__}/iso_sts/annotation"
|
|
104
|
+
autoload :Attrib, "#{__dir__}/iso_sts/attrib"
|
|
102
105
|
autoload :Country, "#{__dir__}/iso_sts/country"
|
|
103
106
|
autoload :Day, "#{__dir__}/iso_sts/day"
|
|
104
107
|
autoload :Etal, "#{__dir__}/iso_sts/etal"
|
|
@@ -155,8 +158,5 @@ module Sts
|
|
|
155
158
|
autoload :AnnexType, "#{__dir__}/iso_sts/annex_type"
|
|
156
159
|
autoload :FnGroup, "#{__dir__}/iso_sts/fn_group"
|
|
157
160
|
autoload :Fn, "#{__dir__}/iso_sts/fn"
|
|
158
|
-
|
|
159
|
-
# MathML2 wrapper
|
|
160
|
-
autoload :Mathml2, "#{__dir__}/iso_sts/mathml2"
|
|
161
161
|
end
|
|
162
162
|
end
|
data/lib/sts/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sts
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bigdecimal
|
|
@@ -127,9 +127,11 @@ files:
|
|
|
127
127
|
- lib/sts/iso_sts/app.rb
|
|
128
128
|
- lib/sts/iso_sts/app_group.rb
|
|
129
129
|
- lib/sts/iso_sts/array.rb
|
|
130
|
+
- lib/sts/iso_sts/attrib.rb
|
|
130
131
|
- lib/sts/iso_sts/back.rb
|
|
131
132
|
- lib/sts/iso_sts/body.rb
|
|
132
133
|
- lib/sts/iso_sts/bold.rb
|
|
134
|
+
- lib/sts/iso_sts/boxed_text.rb
|
|
133
135
|
- lib/sts/iso_sts/break.rb
|
|
134
136
|
- lib/sts/iso_sts/caption.rb
|
|
135
137
|
- lib/sts/iso_sts/col.rb
|
|
@@ -145,6 +147,7 @@ files:
|
|
|
145
147
|
- lib/sts/iso_sts/def_item.rb
|
|
146
148
|
- lib/sts/iso_sts/def_list.rb
|
|
147
149
|
- lib/sts/iso_sts/disp_formula.rb
|
|
150
|
+
- lib/sts/iso_sts/disp_quote.rb
|
|
148
151
|
- lib/sts/iso_sts/doc_number.rb
|
|
149
152
|
- lib/sts/iso_sts/doc_ref.rb
|
|
150
153
|
- lib/sts/iso_sts/doc_type.rb
|
|
@@ -174,8 +177,6 @@ files:
|
|
|
174
177
|
- lib/sts/iso_sts/list_item.rb
|
|
175
178
|
- lib/sts/iso_sts/long_desc.rb
|
|
176
179
|
- lib/sts/iso_sts/lpage.rb
|
|
177
|
-
- lib/sts/iso_sts/mathml2.rb
|
|
178
|
-
- lib/sts/iso_sts/mathml2/math.rb
|
|
179
180
|
- lib/sts/iso_sts/meta_date.rb
|
|
180
181
|
- lib/sts/iso_sts/milestone_end.rb
|
|
181
182
|
- lib/sts/iso_sts/milestone_start.rb
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "nokogiri"
|
|
4
|
-
|
|
5
|
-
module Sts
|
|
6
|
-
module IsoSts
|
|
7
|
-
module Mathml2
|
|
8
|
-
class Math < Lutaml::Model::Serializable
|
|
9
|
-
attribute :id, :string
|
|
10
|
-
attribute :display, :string
|
|
11
|
-
attribute :content, :string, collection: true
|
|
12
|
-
xml do
|
|
13
|
-
namespace ::Sts::Namespaces::MathmlNamespace
|
|
14
|
-
element "math"
|
|
15
|
-
mixed_content
|
|
16
|
-
map_attribute :id, to: :id
|
|
17
|
-
map_attribute :display, to: :display
|
|
18
|
-
map_content to: :content
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
MATH_NS = "http://www.w3.org/1998/Math/MathML"
|
|
22
|
-
|
|
23
|
-
def to_xml(*)
|
|
24
|
-
@original_xml || %{<math xmlns="#{MATH_NS}"/>}
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def self.from_xml(input)
|
|
28
|
-
input_str = input.respond_to?(:read) ? input.read : input.to_s
|
|
29
|
-
|
|
30
|
-
doc = parse_with_namespace(input_str)
|
|
31
|
-
math_element = find_math_element(doc)
|
|
32
|
-
return new if math_element.nil?
|
|
33
|
-
|
|
34
|
-
math = new
|
|
35
|
-
math.id = math_element["id"]
|
|
36
|
-
math.display = math_element["display"]
|
|
37
|
-
math.content = extract_inner_content(math_element)
|
|
38
|
-
math.instance_variable_set(:@original_xml, math_element.to_xml)
|
|
39
|
-
math
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def self.parse_with_namespace(xml_str)
|
|
43
|
-
# Detect namespace-prefixed math elements and wrap to resolve prefixes
|
|
44
|
-
if xml_str.include?("<mml:") || xml_str.match?(/<\w+:math[\s>]/)
|
|
45
|
-
wrapped = "<wrapper xmlns:mml=\"#{MATH_NS}\">#{xml_str}</wrapper>"
|
|
46
|
-
Nokogiri::XML(wrapped)
|
|
47
|
-
else
|
|
48
|
-
Nokogiri::XML(xml_str)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
private_class_method :parse_with_namespace
|
|
52
|
-
|
|
53
|
-
def self.find_math_element(doc)
|
|
54
|
-
doc.at_xpath("//math[@xmlns='#{MATH_NS}']") ||
|
|
55
|
-
doc.at_xpath(".//mml:math", "mml" => MATH_NS) ||
|
|
56
|
-
doc.at_xpath(".//*[local-name()='math']")
|
|
57
|
-
end
|
|
58
|
-
private_class_method :find_math_element
|
|
59
|
-
|
|
60
|
-
def self.extract_inner_content(math_element)
|
|
61
|
-
content = math_element.children.to_xml
|
|
62
|
-
content.empty? ? nil : content
|
|
63
|
-
end
|
|
64
|
-
private_class_method :extract_inner_content
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|