sts 0.6.11 → 0.6.13

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 (137) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +5 -3
  3. data/.github/workflows/release.yml +6 -10
  4. data/Gemfile +1 -0
  5. data/README.adoc +42 -0
  6. data/TODO.sts-refactor/00-overview.md +11 -19
  7. data/TODO.sts-refactor/03-namespace-coupling.md +40 -39
  8. data/TODO.sts-refactor/08-isoiec-profile.md +4 -4
  9. data/TODO.sts-refactor/10-test-coverage.md +2 -1
  10. data/lib/sts/iso_sts/addr_line.rb +77 -0
  11. data/lib/sts/iso_sts/address.rb +40 -0
  12. data/lib/sts/iso_sts/aff.rb +87 -0
  13. data/lib/sts/iso_sts/aff_alternatives.rb +18 -0
  14. data/lib/sts/iso_sts/alternatives.rb +45 -0
  15. data/lib/sts/iso_sts/anonymous.rb +19 -0
  16. data/lib/sts/iso_sts/article_title.rb +92 -0
  17. data/lib/sts/iso_sts/attrib.rb +30 -1
  18. data/lib/sts/iso_sts/author_comment.rb +32 -0
  19. data/lib/sts/iso_sts/award_id.rb +69 -0
  20. data/lib/sts/iso_sts/back.rb +0 -2
  21. data/lib/sts/iso_sts/bio.rb +111 -0
  22. data/lib/sts/iso_sts/body.rb +0 -2
  23. data/lib/sts/iso_sts/boxed_text.rb +51 -13
  24. data/lib/sts/iso_sts/chapter_title.rb +56 -0
  25. data/lib/sts/iso_sts/chem_struct.rb +102 -0
  26. data/lib/sts/iso_sts/chem_struct_wrap.rb +60 -0
  27. data/lib/sts/iso_sts/collab.rb +118 -0
  28. data/lib/sts/iso_sts/comment.rb +94 -0
  29. data/lib/sts/iso_sts/conf_date.rb +24 -0
  30. data/lib/sts/iso_sts/conf_loc.rb +24 -0
  31. data/lib/sts/iso_sts/conf_name.rb +24 -0
  32. data/lib/sts/iso_sts/conf_sponsor.rb +24 -0
  33. data/lib/sts/iso_sts/content_language.rb +0 -4
  34. data/lib/sts/iso_sts/contrib.rb +74 -0
  35. data/lib/sts/iso_sts/contrib_group.rb +45 -0
  36. data/lib/sts/iso_sts/custom_meta.rb +0 -1
  37. data/lib/sts/iso_sts/custom_meta_group.rb +2 -0
  38. data/lib/sts/iso_sts/date.rb +28 -0
  39. data/lib/sts/iso_sts/date_in_citation.rb +32 -0
  40. data/lib/sts/iso_sts/degrees.rb +24 -0
  41. data/lib/sts/iso_sts/disp_formula_group.rb +43 -0
  42. data/lib/sts/iso_sts/disp_quote.rb +50 -12
  43. data/lib/sts/iso_sts/element_citation.rb +203 -0
  44. data/lib/sts/iso_sts/elocation_id.rb +24 -0
  45. data/lib/sts/iso_sts/fig_group.rb +50 -0
  46. data/lib/sts/iso_sts/funding_source.rb +85 -0
  47. data/lib/sts/iso_sts/given_names.rb +20 -0
  48. data/lib/sts/iso_sts/glossary.rb +91 -0
  49. data/lib/sts/iso_sts/glyph_data.rb +32 -0
  50. data/lib/sts/iso_sts/glyph_ref.rb +17 -0
  51. data/lib/sts/iso_sts/gov.rb +52 -0
  52. data/lib/sts/iso_sts/graphic.rb +0 -2
  53. data/lib/sts/iso_sts/inline_supplementary_material.rb +78 -0
  54. data/lib/sts/iso_sts/isbn.rb +22 -0
  55. data/lib/sts/iso_sts/issn.rb +22 -0
  56. data/lib/sts/iso_sts/issue_id.rb +26 -0
  57. data/lib/sts/iso_sts/issue_part.rb +24 -0
  58. data/lib/sts/iso_sts/issue_title.rb +24 -0
  59. data/lib/sts/iso_sts/journal_id.rb +24 -0
  60. data/lib/sts/iso_sts/language.rb +0 -4
  61. data/lib/sts/iso_sts/license.rb +2 -1
  62. data/lib/sts/iso_sts/license_p.rb +90 -29
  63. data/lib/sts/iso_sts/media.rb +64 -0
  64. data/lib/sts/iso_sts/meta_name.rb +3 -0
  65. data/lib/sts/iso_sts/meta_value.rb +53 -6
  66. data/lib/sts/iso_sts/mixed_citation.rb +9 -9
  67. data/lib/sts/iso_sts/monospace.rb +2 -0
  68. data/lib/sts/iso_sts/name.rb +32 -0
  69. data/lib/sts/iso_sts/name_alternatives.rb +20 -0
  70. data/lib/sts/iso_sts/on_behalf_of.rb +50 -0
  71. data/lib/sts/iso_sts/open_access.rb +28 -0
  72. data/lib/sts/iso_sts/overline.rb +99 -0
  73. data/lib/sts/iso_sts/part_title.rb +56 -0
  74. data/lib/sts/iso_sts/patent.rb +26 -0
  75. data/lib/sts/iso_sts/person_group.rb +44 -0
  76. data/lib/sts/iso_sts/prefix.rb +24 -0
  77. data/lib/sts/iso_sts/price.rb +46 -0
  78. data/lib/sts/iso_sts/private_char.rb +28 -0
  79. data/lib/sts/iso_sts/ref.rb +8 -5
  80. data/lib/sts/iso_sts/related_article.rb +191 -0
  81. data/lib/sts/iso_sts/related_object.rb +182 -0
  82. data/lib/sts/iso_sts/role.rb +52 -0
  83. data/lib/sts/iso_sts/roman.rb +99 -0
  84. data/lib/sts/iso_sts/sans_serif.rb +99 -0
  85. data/lib/sts/iso_sts/sc.rb +2 -0
  86. data/lib/sts/iso_sts/series.rb +52 -0
  87. data/lib/sts/iso_sts/size.rb +24 -0
  88. data/lib/sts/iso_sts/source.rb +58 -0
  89. data/lib/sts/iso_sts/speaker.rb +42 -0
  90. data/lib/sts/iso_sts/speech.rb +34 -0
  91. data/lib/sts/iso_sts/standard_ref.rb +2 -0
  92. data/lib/sts/iso_sts/statement.rb +40 -0
  93. data/lib/sts/iso_sts/strike.rb +2 -0
  94. data/lib/sts/iso_sts/string_name.rb +36 -0
  95. data/lib/sts/iso_sts/subtitle.rb +96 -0
  96. data/lib/sts/iso_sts/suffix.rb +24 -0
  97. data/lib/sts/iso_sts/supplement.rb +73 -0
  98. data/lib/sts/iso_sts/supplementary_material.rb +108 -0
  99. data/lib/sts/iso_sts/surname.rb +20 -0
  100. data/lib/sts/iso_sts/table_wrap_group.rb +44 -0
  101. data/lib/sts/iso_sts/target.rb +52 -0
  102. data/lib/sts/iso_sts/term_display.rb +81 -0
  103. data/lib/sts/iso_sts/term_head.rb +27 -13
  104. data/lib/sts/iso_sts/term_sec.rb +1 -1
  105. data/lib/sts/iso_sts/textual_form.rb +56 -0
  106. data/lib/sts/iso_sts/trans_source.rb +58 -0
  107. data/lib/sts/iso_sts/trans_title.rb +96 -0
  108. data/lib/sts/iso_sts/underline.rb +2 -0
  109. data/lib/sts/iso_sts/uri.rb +2 -0
  110. data/lib/sts/iso_sts/verse_group.rb +38 -0
  111. data/lib/sts/iso_sts/verse_line.rb +69 -0
  112. data/lib/sts/iso_sts/volume_id.rb +26 -0
  113. data/lib/sts/iso_sts/volume_series.rb +24 -0
  114. data/lib/sts/iso_sts.rb +94 -9
  115. data/lib/sts/niso_sts/app.rb +6 -0
  116. data/lib/sts/niso_sts/element_citation.rb +1 -2
  117. data/lib/sts/niso_sts/mixed_citation.rb +1 -2
  118. data/lib/sts/niso_sts/nlm_citation.rb +1 -2
  119. data/lib/sts/niso_sts/preformat.rb +16 -0
  120. data/lib/sts/niso_sts/section.rb +1 -2
  121. data/lib/sts/niso_sts/sup.rb +14 -0
  122. data/lib/sts/niso_sts/term.rb +15 -2
  123. data/lib/sts/niso_sts/title.rb +2 -0
  124. data/lib/sts/profiles/iso_iec/constraints.rb +14 -11
  125. data/lib/sts/profiles/iso_iec/id_scheme.rb +64 -0
  126. data/lib/sts/profiles/iso_iec/validator.rb +25 -0
  127. data/lib/sts/profiles/iso_iec.rb +1 -0
  128. data/lib/sts/profiles.rb +26 -0
  129. data/lib/sts/tbx_iso_tml/bold.rb +6 -0
  130. data/lib/sts/tbx_iso_tml/definition.rb +4 -0
  131. data/lib/sts/tbx_iso_tml/example.rb +14 -0
  132. data/lib/sts/tbx_iso_tml/italic.rb +6 -0
  133. data/lib/sts/tbx_iso_tml/lang_set.rb +3 -1
  134. data/lib/sts/tbx_iso_tml/note.rb +10 -0
  135. data/lib/sts/version.rb +1 -1
  136. data/lib/sts.rb +4 -0
  137. metadata +83 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8ec7f2054e0a0f1d755836c5a17049c1a051500385431eac39add4e6f11c1e67
4
- data.tar.gz: 202e00365cc1709cf582381b6dc039b3a9e20b27626b38918eed595899399079
3
+ metadata.gz: b7fc8c56a463652a173d2473cef72ac5ba96998ef2c5e3a0ce516b0cf1f03769
4
+ data.tar.gz: 6a167d48f3b24b8c5a89f71a66094ac701fa01fb447133ec7dd06cce51caa373
5
5
  SHA512:
6
- metadata.gz: 9ec40f2942d952cdc9ca29cf4d7d71796bba929091dc1395737cb3c8c088b3d9a2b4714596db5fcb645433a07e43729168397b3dafc9e7b6bf3d53236bc10207
7
- data.tar.gz: fac7161add1b4ccbf01ddd89b9528e70f517622bda3c85ad759c51b109b2c92b87405735265acc77ff8d0827195d01bef627095d9332e929f511a9f06bcbdc60
6
+ metadata.gz: 706ec97a8f69aa3b2c8d5c434ca677f6a0d6d6f7a97daed709cb40597e83f2b559617189405924cdfd0f2e88a5a0800a6dfd5312f387d2a12f491d2ca1df6f94
7
+ data.tar.gz: 681d7914725db8d7b881df2adcdb4b4dd6e573bd9d0b4d3e9a71dd781cd113be731d562cd026db839baacef84af4bf3909666d5075a20ec5d144587f2917a369
@@ -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,21 +14,17 @@ 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
20
26
  with:
21
27
  next_version: ${{ github.event.inputs.next_version }}
22
- # Explicit release_command needed since metanorma/ci#314 deprecated
23
- # `bundler_cache` (hardcoded to false) — the reusable's release job no
24
- # longer runs `bundle install` implicitly via ruby/setup-ruby, so the
25
- # default `bundle exec rake release` fires against uninstalled gems.
26
- # Surfaced by kwkwan on metanorma-plugin-lutaml#285. Deeper fix
27
- # (bundle install inside rubygems-release.yml's release job) tracked
28
- # separately.
29
- release_command: |
30
- bundle install
31
- bundle exec rake release
32
28
  secrets:
33
29
  rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
34
30
  pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
data/Gemfile CHANGED
@@ -7,6 +7,7 @@ gemspec
7
7
 
8
8
  gem "canon"
9
9
  gem "lutaml-model", "~> 0.8.0"
10
+ gem "nokogiri"
10
11
  gem "rake"
11
12
  gem "rspec"
12
13
  gem "rubocop"
data/README.adoc CHANGED
@@ -194,6 +194,48 @@ sts = Sts::NisoSts::Standard.from_xml(xml_with_tbx)
194
194
  sts = Sts::IsoSts::Standard.from_xml(xml_with_tbx)
195
195
  ----
196
196
 
197
+ === ISO/IEC usage profile
198
+
199
+ ISO/IEC NISO STS is not a separate schema. It is a usage profile -- a constraint layer on top of NISO STS covering which elements are required, which attribute values are allowed, and the conventions ISO and IEC follow.
200
+
201
+ So profiles do not change parsing. Parse the document first, then validate it against a profile:
202
+
203
+ [source,ruby]
204
+ ----
205
+ require 'sts'
206
+
207
+ doc = Sts::NisoSts::Standard.from_xml(xml)
208
+ errors = Sts::Profiles.validator(:iso_iec).validate(doc)
209
+ # => ["ISO/IEC profile requires <body>"]
210
+ ----
211
+
212
+ `validate` returns an array of message strings, empty when the document satisfies the profile. It checks document structure and `<std-meta>`/`<std-ident>` metadata. The validator targets NISO STS documents (`Sts::NisoSts::Standard`).
213
+
214
+ ==== Checking the semantic ID scheme
215
+
216
+ Annex F of the NISO STS 1.2 IEC/ISO Coding Guidelines tabulates two ID schemes, one for ISO and one for IEC. Pass `id_scheme` to check ids against one of them:
217
+
218
+ [source,ruby]
219
+ ----
220
+ Sts::Profiles.validator(:iso_iec, id_scheme: :iso).validate(doc)
221
+ # => ["<fig> id 'fig-1' does not follow the iso ID scheme (expected prefix 'fig_')"]
222
+ ----
223
+
224
+ [cols="1,1,1"]
225
+ |===
226
+ | Element | ISO (Annex F.2) | IEC (Annex F.1)
227
+
228
+ | `sec` | `sec_` | `sec-`
229
+ | `term-sec` | `sec_` | `con-`
230
+ | `fig` | `fig_` | `fig-`
231
+ | `table-wrap` | `tab_` | `tab-`
232
+ | `disp-formula` | `formula_` | `for-`
233
+ |===
234
+
235
+ This check is off by default, and deliberately so. Annex F warns that "IDs generated in OSD are arbitrary" and that it is "not recommended to base any exploitation of ISO or IEC XML on semantic IDs". The schemes describe legacy content and the traditional publication chain, not a rule every document follows. Real documents bear this out -- `ISO_13849-1_2008-12_en_TBX.xml` matches the IEC scheme for figures, tables and formulae but uses a `sub-` prefix for sections. Turn the check on only when you know your documents come from a chain that uses semantic ids.
236
+
237
+ Elements outside the table are never checked. Passing an unknown profile raises `Sts::Profiles::UnknownProfileError`; an unknown `id_scheme` raises `ArgumentError`.
238
+
197
239
  == Architecture principles
198
240
 
199
241
  === Namespace independence
@@ -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→6 refs) | 01, 02 |
22
+ | 03 | `03-namespace-coupling.md` | Architecture | DONE (63→0 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,9 +166,9 @@ 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→6 IsoSts→NisoSts references
170
- remaining (issue #40). ISOSTS.xsd governs content models and all non-`@id`
171
- attributes; the `@id` follows the 86948b9 convention.
169
+ - `03-namespace-coupling.md` — DONE: 63→0 IsoSts→NisoSts references
170
+ (issue #40). ISOSTS.xsd governs content models and all non-`@id` attributes;
171
+ the `@id` follows the 86948b9 convention.
172
172
  - `04-register-versioning.md` — Version the models via lutaml-model Registers
173
173
  - `11-duplicate-models.md` — 44 overlapping element resolution (depends on 03)
174
174
 
@@ -184,22 +184,14 @@ the **NISO** XSD and applied the result to IsoSts.
184
184
  name. (`meta-date` was NOT lossy — it already maps `type`.)
185
185
  - **Not a bug — the conventional `@id`.** IsoSts models carry an `@id` that
186
186
  ISOSTS does not itself define; this is the deliberate 86948b9 convention
187
- (NISO-XSD-verified), not dead surface.
187
+ (NISO-XSD-verified), not dead surface. All 220 registered IsoSts models now
188
+ expose and map it.
188
189
  - **Remaining follow-up (separate change).** 7 spurious attributes on 5 models
189
190
  (model carries an attr ISOSTS does not define: `graphic` `type`, `body`/`back`
190
- `content-type`, `content-language`/`language` extras), and the 6 classes left
191
- without `@id` in 86948b9 (`monospace`, `sc`, `strike`, `underline`, `uri`,
192
- `standard_ref`).
191
+ `content-type`, `content-language`/`language` extras).
193
192
 
194
193
  ## Next Action
195
- Two independent tracks:
196
- 1. Finish `03` — the 6 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.
203
- 2. The remaining schema-conformance follow-up above — the 7 spurious attributes
204
- on 5 models and the 6 classes without `@id`. (The dropped-attribute data loss
205
- is now fixed.)
194
+ `03` is complete: the 90-model closure removes every IsoSts→NisoSts reference.
195
+ Continue with the remaining schema-conformance follow-up above: the 7 spurious
196
+ attributes on 5 models. (The dropped-attribute data loss and mandatory `@id`
197
+ surface are 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 references (GitHub issue #40)
6
+ **Status**: Complete — 63 → 0 references (GitHub issue #40)
7
7
 
8
8
  ## Problem
9
9
 
@@ -18,7 +18,8 @@ The `IsoSts::Attrib` addition then reduced it from 13 to 11
18
18
  (Array#attrib, TableWrapFoot#attrib) and filled the omission in DispQuote /
19
19
  BoxedText from PR #48. The License/TermHead/CustomMetaGroup closure then
20
20
  reduced it from 11 to 6 (Permissions#license, DefList#term_head, and
21
- IsoMeta/RegMeta/NatMeta#custom_meta_group).
21
+ IsoMeta/RegMeta/NatMeta#custom_meta_group). The full recursive closure then
22
+ removed the final 6 references.
22
23
 
23
24
  ## Content models from ISOSTS.xsd; `@id` from the 86948b9 convention
24
25
 
@@ -46,7 +47,7 @@ Non-`@id` attribute lists must be **generated** from the XSD, never hand-read:
46
47
  `version` on `tex-math` and `specific-use` on `pub-id` sit after long
47
48
  `xs:enumeration` blocks and are invisible to a truncated read.
48
49
 
49
- ## Done in issue #40 — 47 refs removed, 46 classes added
50
+ ## Done in issue #40 — 63 refs removed, 136 classes added
50
51
 
51
52
  - **14 `xs:string` elements** (`originator`, `doc-type`, `doc-number`,
52
53
  `part-number`, `version`, `suppl-type`, `suppl-number`, `suppl-version`,
@@ -78,25 +79,25 @@ Non-`@id` attribute lists must be **generated** from the XSD, never hand-read:
78
79
  - **`DispQuote` and `BoxedText` added** — modelled from ISOSTS.xsd (not copied
79
80
  from NisoSts, which disagrees: `NisoSts::DispQuote` lacks `xml_lang` and
80
81
  `title`; `NisoSts::BoxedText` carries `form_type`/`is_form` that ISOSTS does
81
- not define). Children limited to existing IsoSts types; omitted children
82
- (`speech`, `statement`, `verse-group`, `address`, `alternatives`,
83
- `array`, `chem-struct-wrap`, `fig-group`, `media`, `supplementary-material`,
84
- `table-wrap`, `table-wrap-group`, `disp-formula-group`, `mml:math`,
85
- `related-article`, `related-object`, `glossary`) are tracked below.
82
+ not define). Their first pass was limited to existing IsoSts child types.
86
83
  `BoxedText#sts_object_id` (not `:object_id`) follows the `NisoSts::Graphic`
87
84
  convention to avoid clashing with `Object#object_id`. 3 refs.
88
85
  - **`Attrib` added** — mixed-content class modelled from ISOSTS.xsd with the
89
- 25 inline-element children that have IsoSts types today. Fills the
86
+ 25 inline-element children that had IsoSts types at the time. It fills the
90
87
  `attrib` gap left in `DispQuote` and `BoxedText` from the prior bullet.
91
- 2 refs (`Array#attrib`, `TableWrapFoot#attrib`). Omitted inline children
92
- (`inline-supplementary-material`, `related-article`, `related-object`,
93
- `element-citation`, `overline`, `roman`, `sans-serif`, `alternatives`,
94
- `private-char`, `chem-struct`, `mml:math`, `target`, `tbx:entailedTerm`)
95
- tracked below.
88
+ 2 refs (`Array#attrib`, `TableWrapFoot#attrib`).
96
89
  - **License / TermHead / CustomMetaGroup closure added** — `License`,
97
90
  `LicenseP`, `TermHead`, `CustomMetaGroup`, `CustomMeta`, `MetaName`, and
98
91
  `MetaValue` modelled from ISOSTS.xsd. 5 refs (`Permissions#license`,
99
92
  `DefList#term_head`, `IsoMeta/RegMeta/NatMeta#custom_meta_group`).
93
+ - **90-model full closure completed** — 80 models are new and 10 earlier
94
+ bounded models are expanded to their complete content models. All direct
95
+ and transitive ISOSTS elements needed by `disp-quote`, `boxed-text`,
96
+ `person-group`, `collab`, `source`, `article-title`, and the bounded
97
+ metadata roots now close through IsoSts, TBX, and MathML types. Every model
98
+ uses the exact ISOSTS attributes and child cardinalities plus the mandatory
99
+ project `@id` surface; none uses `required: true`. This removes the final
100
+ 6 refs from `MixedCitation`, `Ref`, and `TermSec`.
100
101
 
101
102
  ### Why classes and not plain `:string`
102
103
 
@@ -107,26 +108,26 @@ round-trip. For a scalar, `render_empty: :empty` recovers it; for a collection
107
108
  to `[]`, destroying the information at parse time before any render option
108
109
  applies. Content-only classes round-trip every case.
109
110
 
110
- ## Remaining — 6 refs
111
-
112
- **5 refs to 5 recursive roots**: `ElementCitation`, `PersonGroup`, `Collab`,
113
- `Source`, `TermDisplay`. Each reaches the same 78–79-element
114
- mutually-recursive core before existing IsoSts boundaries (`sec` → `p` →
115
- `disp-quote` → `p`). `DispQuote`, `BoxedText`, `Attrib`, `License`,
116
- `TermHead`, and `CustomMetaGroup` are now IsoSts classes and no longer in
117
- this list. The remaining 6 are the recursive roots — see
118
- `TODO.roadmap/04-issue-40-recursive-roots.md` for the strategy.
119
-
120
- **8 refs to 5 child-bearing roots**, now measured after the first dependency
121
- layer: `attrib` (:1082) reaches 78 not-yet-modelled ISOSTS elements before
122
- existing IsoSts boundaries, `term-head` (:4308) reaches 79, `article-title`
123
- reaches 78, `license` → `license-p` (:51) reaches 84, and
124
- `custom-meta-group` → `custom-meta` reaches 82. They converge on the same
125
- recursive content core as the deep roots, so none is another bounded model
126
- batch. `publisher` was the only exception: its four-element closure
127
- (`publisher`, `publisher-name`, `publisher-loc`, `email`) is complete.
128
- The Niso `Attrib` class is only 17 lines because it omits all 37 ISOSTS child
129
- types; copying it would silently drop valid ISO content rather than decouple it.
111
+ ## Complete — 0 refs
112
+
113
+ The final 6 references were `Ref#element_citation`, four `MixedCitation`
114
+ children (`person_group`, `collab`, `source`, and `article_title`), and
115
+ `TermSec#term_display`. Their complete recursive and bounded closures are now
116
+ modelled in IsoSts.
117
+
118
+ The earlier four bounded roots had a combined 12-element closure before
119
+ existing IsoSts boundaries:
120
+
121
+ - `TermHead` — 1 ref in `DefList`; only `term-head` was needed.
122
+ - `CustomMetaGroup` — 3 refs in `IsoMeta`, `NatMeta`, and `RegMeta`; its
123
+ 4-element closure is `custom-meta-group`, `custom-meta`, `meta-name`, and
124
+ `meta-value`.
125
+ - `License` — 1 ref in `Permissions`; its 6-element closure is `license`,
126
+ `license-p`, `award-id`, `funding-source`, `open-access`, and `price`.
127
+ - `TermDisplay` — 1 ref in `TermSec`; only `term-display` was needed.
128
+
129
+ All four closures are now modelled in IsoSts and all six host references point
130
+ to their IsoSts types.
130
131
 
131
132
  ## Rejected: three-tier `Sts::Base` hierarchy
132
133
 
@@ -140,7 +141,7 @@ That draft also targeted `lib/sts/iso_sts/content_groups/highlight_elements.rb`
140
141
  and "194+ references" to emphasis types. That file was deleted as dead code; the
141
142
  real work was metadata types, not highlight elements.
142
143
 
143
- ## Naming trap (for the deferred work)
144
+ ## Naming trap
144
145
 
145
146
  A mechanical `s/NisoSts::/IsoSts::/` is wrong. Nine elements already have
146
147
  different class names per namespace, so a blind rename creates `IsoSts::Section`
@@ -156,13 +157,13 @@ Remap child references by **XML element name**, not class name.
156
157
  ## Scope boundary
157
158
 
158
159
  Independence from NisoSts is not independence in general: `lib/sts/iso_sts/`
159
- still references 6 `TbxIsoTml` types directly, and much of the deferred closure
160
- reaches `TbxIsoTml`/MathML. Those are shared namespaces, outside this ADR.
160
+ still references 6 `TbxIsoTml` types directly, and the completed closure reaches
161
+ `TbxIsoTml`/MathML. Those are shared namespaces, outside this ADR.
161
162
 
162
163
  ## Verification
163
164
 
164
- 1. `grep -rho "Sts::NisoSts::" lib/sts/iso_sts/ | wc -l` → `16`
165
+ 1. `grep -rho "Sts::NisoSts::" lib/sts/iso_sts/ | wc -l` → `0`
165
166
  2. Every *non-`@id`* attribute on an IsoSts model traces to a line in
166
167
  `ISOSTS.xsd`; `@id` follows the 86948b9 convention
167
- 3. Autoload registry 1:1 with the directory (131/131)
168
+ 3. Autoload registry 1:1 with the directory (220/220)
168
169
  4. `bundle exec rspec` green; `bundle exec rubocop` clean
@@ -158,12 +158,12 @@ lib/sts/profiles/
158
158
  ## TODO Checklist
159
159
 
160
160
  - [x] Extract ISO/IEC constraints from Guidelines ed.2.1
161
- - [ ] Extract IEC-specific constraints
161
+ - [x] Extract IEC-specific constraints
162
162
  - [x] Design validator architecture
163
163
  - [x] Implement constraint constants module
164
164
  - [x] Implement basic structural validator
165
- - [ ] Implement ID scheme validator
165
+ - [x] Implement ID scheme validator
166
166
  - [x] Implement metadata validator (originator, doc-type validation)
167
- - [ ] Add profile selection to parsing API
167
+ - [x] Add profile selection to parsing API
168
168
  - [x] Write specs for validation
169
- - [ ] Document usage
169
+ - [x] Document usage
@@ -157,7 +157,8 @@ All other TODOs feed into this — add tests as features are implemented.
157
157
  - [x] Add unit tests for new elements (ProcessingMeta, Code, Legend, InlineMedia, TableWrapGroup, DefHead)
158
158
  - [x] Add unit tests for attribute additions (Title, Caption, Label, ExtLink, AwardId, DefItem)
159
159
  - [x] Add unit tests for Index and TOC hierarchy elements
160
- - [ ] Add schema validation tests
160
+ - [x] Add schema validation tests (whole-document, NISO Extended XSD + ISOSTS.xsd;
161
+ Interchange and NISO STS 1.2 not covered — neither schema is vendored)
161
162
  - [ ] Add versioning tests (after TODO 04)
162
163
  - [x] Add profile validation tests (after TODO 08)
163
164
  - [x] Set up coverage tracking
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class AddrLine < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :content_type, :string
8
+ attribute :specific_use, :string
9
+ attribute :xml_lang, :string
10
+ attribute :content, :string, collection: true
11
+ attribute :bold, ::Sts::IsoSts::Bold, collection: true
12
+ attribute :italic, ::Sts::IsoSts::Italic, collection: true
13
+ attribute :monospace, ::Sts::IsoSts::Monospace, collection: true
14
+ attribute :num, ::Sts::IsoSts::Num, collection: true
15
+ attribute :overline, ::Sts::IsoSts::Overline, collection: true
16
+ attribute :roman, ::Sts::IsoSts::Roman, collection: true
17
+ attribute :sans_serif, ::Sts::IsoSts::SansSerif, collection: true
18
+ attribute :sc, ::Sts::IsoSts::Sc, collection: true
19
+ attribute :strike, ::Sts::IsoSts::Strike, collection: true
20
+ attribute :underline, ::Sts::IsoSts::Underline, collection: true
21
+ attribute :alternatives, ::Sts::IsoSts::Alternatives, collection: true
22
+ attribute :inline_graphic, ::Sts::IsoSts::InlineGraphic, collection: true
23
+ attribute :private_char, ::Sts::IsoSts::PrivateChar, collection: true
24
+ attribute :chem_struct, ::Sts::IsoSts::ChemStruct, collection: true
25
+ attribute :inline_formula, ::Sts::IsoSts::InlineFormula, collection: true
26
+ attribute :abbrev, ::Sts::IsoSts::Abbrev, collection: true
27
+ attribute :milestone_end, ::Sts::IsoSts::MilestoneEnd, collection: true
28
+ attribute :milestone_start, ::Sts::IsoSts::MilestoneStart,
29
+ collection: true
30
+ attribute :named_content, ::Sts::IsoSts::NamedContent, collection: true
31
+ attribute :styled_content, ::Sts::IsoSts::StyledContent, collection: true
32
+ attribute :sub, ::Sts::IsoSts::Sub, collection: true
33
+ attribute :sup, ::Sts::IsoSts::Sup, collection: true
34
+ attribute :country, ::Sts::IsoSts::Country, collection: true
35
+ attribute :fax, ::Sts::IsoSts::Fax, collection: true
36
+ attribute :institution, ::Sts::IsoSts::Institution, collection: true
37
+ attribute :phone, ::Sts::IsoSts::Phone, collection: true
38
+
39
+ xml do # rubocop:disable Metrics/BlockLength
40
+ element "addr-line"
41
+ mixed_content
42
+
43
+ map_attribute "id", to: :id
44
+ map_attribute "content-type", to: :content_type
45
+ map_attribute "specific-use", to: :specific_use
46
+ map_attribute "xml:lang", to: :xml_lang
47
+ map_content to: :content
48
+ map_element "bold", to: :bold
49
+ map_element "italic", to: :italic
50
+ map_element "monospace", to: :monospace
51
+ map_element "num", to: :num
52
+ map_element "overline", to: :overline
53
+ map_element "roman", to: :roman
54
+ map_element "sans-serif", to: :sans_serif
55
+ map_element "sc", to: :sc
56
+ map_element "strike", to: :strike
57
+ map_element "underline", to: :underline
58
+ map_element "alternatives", to: :alternatives
59
+ map_element "inline-graphic", to: :inline_graphic
60
+ map_element "private-char", to: :private_char
61
+ map_element "chem-struct", to: :chem_struct
62
+ map_element "inline-formula", to: :inline_formula
63
+ map_element "abbrev", to: :abbrev
64
+ map_element "milestone-end", to: :milestone_end
65
+ map_element "milestone-start", to: :milestone_start
66
+ map_element "named-content", to: :named_content
67
+ map_element "styled-content", to: :styled_content
68
+ map_element "sub", to: :sub
69
+ map_element "sup", to: :sup
70
+ map_element "country", to: :country
71
+ map_element "fax", to: :fax
72
+ map_element "institution", to: :institution
73
+ map_element "phone", to: :phone
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class Address < 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 :addr_line, ::Sts::IsoSts::AddrLine, collection: true
12
+ attribute :country, ::Sts::IsoSts::Country, collection: true
13
+ attribute :fax, ::Sts::IsoSts::Fax, collection: true
14
+ attribute :institution, ::Sts::IsoSts::Institution, collection: true
15
+ attribute :phone, ::Sts::IsoSts::Phone, collection: true
16
+ attribute :email, ::Sts::IsoSts::Email, collection: true
17
+ attribute :ext_link, ::Sts::IsoSts::ExtLink, collection: true
18
+ attribute :uri, ::Sts::IsoSts::Uri, collection: true
19
+
20
+ xml do
21
+ element "address"
22
+ ordered
23
+
24
+ map_attribute "id", to: :id
25
+ map_attribute "content-type", to: :content_type
26
+ map_attribute "specific-use", to: :specific_use
27
+ map_attribute "xml:lang", to: :xml_lang
28
+ map_attribute "originator", to: :originator
29
+ map_element "addr-line", to: :addr_line
30
+ map_element "country", to: :country
31
+ map_element "fax", to: :fax
32
+ map_element "institution", to: :institution
33
+ map_element "phone", to: :phone
34
+ map_element "email", to: :email
35
+ map_element "ext-link", to: :ext_link
36
+ map_element "uri", to: :uri
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class Aff < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :content_type, :string
8
+ attribute :rid, :string
9
+ attribute :specific_use, :string
10
+ attribute :xml_lang, :string
11
+ attribute :content, :string, collection: true
12
+ attribute :addr_line, ::Sts::IsoSts::AddrLine, collection: true
13
+ attribute :country, ::Sts::IsoSts::Country, collection: true
14
+ attribute :fax, ::Sts::IsoSts::Fax, collection: true
15
+ attribute :institution, ::Sts::IsoSts::Institution, collection: true
16
+ attribute :phone, ::Sts::IsoSts::Phone, collection: true
17
+ attribute :email, ::Sts::IsoSts::Email, collection: true
18
+ attribute :ext_link, ::Sts::IsoSts::ExtLink, collection: true
19
+ attribute :uri, ::Sts::IsoSts::Uri, collection: true
20
+ attribute :inline_supplementary_material, ::Sts::IsoSts::InlineSupplementaryMaterial,
21
+ collection: true
22
+ attribute :related_article, ::Sts::IsoSts::RelatedArticle,
23
+ collection: true
24
+ attribute :related_object, ::Sts::IsoSts::RelatedObject, collection: true
25
+ attribute :break, ::Sts::IsoSts::Break, collection: true
26
+ attribute :bold, ::Sts::IsoSts::Bold, collection: true
27
+ attribute :italic, ::Sts::IsoSts::Italic, collection: true
28
+ attribute :monospace, ::Sts::IsoSts::Monospace, collection: true
29
+ attribute :num, ::Sts::IsoSts::Num, collection: true
30
+ attribute :overline, ::Sts::IsoSts::Overline, collection: true
31
+ attribute :roman, ::Sts::IsoSts::Roman, collection: true
32
+ attribute :sans_serif, ::Sts::IsoSts::SansSerif, collection: true
33
+ attribute :sc, ::Sts::IsoSts::Sc, collection: true
34
+ attribute :strike, ::Sts::IsoSts::Strike, collection: true
35
+ attribute :underline, ::Sts::IsoSts::Underline, collection: true
36
+ attribute :label, ::Sts::IsoSts::Label, collection: true
37
+ attribute :fn, ::Sts::IsoSts::Fn, collection: true
38
+ attribute :target, ::Sts::IsoSts::Target, collection: true
39
+ attribute :entailed_term, ::Sts::TbxIsoTml::EntailedTerm, collection: true
40
+ attribute :xref, ::Sts::IsoSts::Xref, collection: true
41
+ attribute :sub, ::Sts::IsoSts::Sub, collection: true
42
+ attribute :sup, ::Sts::IsoSts::Sup, collection: true
43
+
44
+ xml do # rubocop:disable Metrics/BlockLength
45
+ element "aff"
46
+ mixed_content
47
+
48
+ map_attribute "id", to: :id
49
+ map_attribute "content-type", to: :content_type
50
+ map_attribute "rid", to: :rid
51
+ map_attribute "specific-use", to: :specific_use
52
+ map_attribute "xml:lang", to: :xml_lang
53
+ map_content to: :content
54
+ map_element "addr-line", to: :addr_line
55
+ map_element "country", to: :country
56
+ map_element "fax", to: :fax
57
+ map_element "institution", to: :institution
58
+ map_element "phone", to: :phone
59
+ map_element "email", to: :email
60
+ map_element "ext-link", to: :ext_link
61
+ map_element "uri", to: :uri
62
+ map_element "inline-supplementary-material",
63
+ to: :inline_supplementary_material
64
+ map_element "related-article", to: :related_article
65
+ map_element "related-object", to: :related_object
66
+ map_element "break", to: :break
67
+ map_element "bold", to: :bold
68
+ map_element "italic", to: :italic
69
+ map_element "monospace", to: :monospace
70
+ map_element "num", to: :num
71
+ map_element "overline", to: :overline
72
+ map_element "roman", to: :roman
73
+ map_element "sans-serif", to: :sans_serif
74
+ map_element "sc", to: :sc
75
+ map_element "strike", to: :strike
76
+ map_element "underline", to: :underline
77
+ map_element "label", to: :label
78
+ map_element "fn", to: :fn
79
+ map_element "target", to: :target
80
+ map_element "entailedTerm", to: :entailed_term
81
+ map_element "xref", to: :xref
82
+ map_element "sub", to: :sub
83
+ map_element "sup", to: :sup
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class AffAlternatives < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :aff, ::Sts::IsoSts::Aff, collection: true
8
+
9
+ xml do
10
+ element "aff-alternatives"
11
+ ordered
12
+
13
+ map_attribute "id", to: :id
14
+ map_element "aff", to: :aff
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class Alternatives < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :originator, :string
8
+ attribute :array, ::Sts::IsoSts::Array, collection: true
9
+ attribute :chem_struct, ::Sts::IsoSts::ChemStruct, collection: true
10
+ attribute :graphic, ::Sts::IsoSts::Graphic, collection: true
11
+ attribute :inline_graphic, ::Sts::IsoSts::InlineGraphic, collection: true
12
+ attribute :inline_supplementary_material, ::Sts::IsoSts::InlineSupplementaryMaterial,
13
+ collection: true
14
+ attribute :media, ::Sts::IsoSts::Media, collection: true
15
+ attribute :preformat, ::Sts::IsoSts::Preformat, collection: true
16
+ attribute :private_char, ::Sts::IsoSts::PrivateChar, collection: true
17
+ attribute :supplementary_material, ::Sts::IsoSts::SupplementaryMaterial,
18
+ collection: true
19
+ attribute :table, ::Sts::IsoSts::Table, collection: true
20
+ attribute :textual_form, ::Sts::IsoSts::TextualForm, collection: true
21
+ attribute :math, ::Mml::V2::Math, collection: true
22
+
23
+ xml do
24
+ element "alternatives"
25
+ ordered
26
+
27
+ map_attribute "id", to: :id
28
+ map_attribute "originator", to: :originator
29
+ map_element "array", to: :array
30
+ map_element "chem-struct", to: :chem_struct
31
+ map_element "graphic", to: :graphic
32
+ map_element "inline-graphic", to: :inline_graphic
33
+ map_element "inline-supplementary-material",
34
+ to: :inline_supplementary_material
35
+ map_element "media", to: :media
36
+ map_element "preformat", to: :preformat
37
+ map_element "private-char", to: :private_char
38
+ map_element "supplementary-material", to: :supplementary_material
39
+ map_element "table", to: :table
40
+ map_element "textual-form", to: :textual_form
41
+ map_element "math", to: :math
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sts
4
+ module IsoSts
5
+ class Anonymous < Lutaml::Model::Serializable
6
+ attribute :id, :string
7
+ attribute :specific_use, :string
8
+ attribute :xml_lang, :string
9
+
10
+ xml do
11
+ element "anonymous"
12
+
13
+ map_attribute "id", to: :id
14
+ map_attribute "specific-use", to: :specific_use
15
+ map_attribute "xml:lang", to: :xml_lang
16
+ end
17
+ end
18
+ end
19
+ end