Skip to content

feat: decouple IsoSts from NisoSts by modelling from the ISOSTS schema#41

Open
HassanAkbar wants to merge 5 commits into
mainfrom
fix/isosts-decouple-schema-driven
Open

feat: decouple IsoSts from NisoSts by modelling from the ISOSTS schema#41
HassanAkbar wants to merge 5 commits into
mainfrom
fix/isosts-decouple-schema-driven

Conversation

@HassanAkbar

Copy link
Copy Markdown
Member

Metanorma PR checklist

fixes #40

ISOSTS declares originator, doc-type, doc-number, part-number, version,
suppl-type, suppl-number, suppl-version, urn, sdo, proj-id, release-version,
ics and secretariat as type="xs:string" -- text content, no attributes.
Model them in IsoSts and repoint std-ident, std-ref, doc-ident, reg-meta,
nat-meta and iso-meta away from NisoSts.

These carry content only. NisoSts models the same elements with an @id that
ISOSTS does not define, so the NisoSts bodies are not reused.

Also model wi-number, which ISOSTS defines as mixed content carrying an @id.
It was typed as a plain string, silently discarding that @id.

Refs #40
IsoSts::Permissions already models the ISOSTS content model
(copyright-statement*, copyright-year*, copyright-holder*, license*), but
array, app and table-wrap-foot still referenced the NisoSts model.

Refs #40
ISOSTS defines no <ruby> element -- it exists only in NISO STS. ISOSTS
styled-content permits email, ext-link, uri, address, alternatives, array,
boxed-text and others, but not ruby.

Behaviour change: <ruby> inside <styled-content> no longer round-trips. Such
a document is not valid ISOSTS. No fixture exercises it.

Refs #40
Model year, pub-date, release-version-id, is-proof, alt-text, long-desc,
tex-math, pub-id, volume, issue, fpage, lpage and page-range in IsoSts and
repoint std-ref, mixed-citation, reg-meta, iso-meta, nat-meta, graphic and
disp-formula away from NisoSts.

Attribute sets come from ISOSTS.xsd, not from the NisoSts models, which
disagree with it. ISOSTS year has content-type/specific-use/xml:lang and no
@id, where NisoSts::Year has only @id. fpage carries @seq but lpage does not.
tex-math carries @Version and pub-id carries @specific-use; both sit after
long enumeration blocks in the schema and are easy to miss.

Specs assert the exact attribute set per element. Round-tripping cannot prove
these correct: a model that invents or drops an attribute still parses and
serialises symmetrically.

Refs #40
The document targeted lib/sts/iso_sts/content_groups/highlight_elements.rb and
194+ emphasis refs. That file was deleted as dead code; the real work is
metadata types. It also proposed a three-tier Sts::Base hierarchy, which
contradicts the 2026-05-07 ADR and the schema divergence between the two
namespaces.

Record that ISOSTS.xsd is the source of truth rather than the NisoSts models,
that round-tripping does not prove schema correctness, and that independence
from NisoSts is not independence from TbxIsoTml/MathML.

Refs #40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the IsoSts decoupling work (issue #40) by replacing a set of remaining Sts::NisoSts::* references in lib/sts/iso_sts/ with schema-driven Sts::IsoSts models derived from reference-docs/isosts-v1/xsd/ISOSTS.xsd, and by updating specs/docs to lock in the intended attribute sets and behavior.

Changes:

  • Introduces new IsoSts element classes (e.g., Year, PubDate, WiNumber, TexMath, plus xs:string leaf wrappers) and wires them via autoloads.
  • Repoints several IsoSts models away from NisoSts types (notably metadata fields, citation leafs, permissions) and removes <ruby> support from IsoSts::StyledContent.
  • Adds focused spec coverage to assert schema-correct attribute sets and verify empty-element round-tripping for xs:string elements; updates refactor TODO docs to reflect current status/scope.

Reviewed changes

Copilot reviewed 45 out of 45 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TODO.sts-refactor/03-namespace-coupling.md Updates the decoupling design note/status to reflect issue #40 progress and schema-driven modeling approach.
TODO.sts-refactor/00-overview.md Updates overview status and clarifies “independent of NisoSts” scope + known schema-conformance bug list.
spec/iso_sts/iso_sts_element_spec.rb Adds specs asserting schema-correct attribute sets, empty-element round-trips, and correct IsoSts type wiring.
lib/sts/iso_sts/year.rb Adds IsoSts::Year with ISOSTS attribute set and xml mappings.
lib/sts/iso_sts/wi_number.rb Adds IsoSts::WiNumber to preserve ISOSTS @id on <wi-number>.
lib/sts/iso_sts/volume.rb Adds IsoSts::Volume with ISOSTS attribute set and xml mappings.
lib/sts/iso_sts/version.rb Adds IsoSts::Version wrapper for ISOSTS xs:string <version>.
lib/sts/iso_sts/urn.rb Adds IsoSts::Urn wrapper for ISOSTS xs:string <urn>.
lib/sts/iso_sts/tex_math.rb Adds IsoSts::TexMath with ISOSTS attribute set and xml mappings.
lib/sts/iso_sts/table_wrap_foot.rb Repoints permissions to IsoSts::Permissions.
lib/sts/iso_sts/suppl_version.rb Adds IsoSts::SupplVersion wrapper for ISOSTS xs:string <suppl-version>.
lib/sts/iso_sts/suppl_type.rb Adds IsoSts::SupplType wrapper for ISOSTS xs:string <suppl-type>.
lib/sts/iso_sts/suppl_number.rb Adds IsoSts::SupplNumber wrapper for ISOSTS xs:string <suppl-number>.
lib/sts/iso_sts/styled_content.rb Removes modeling/mapping of <ruby> from IsoSts::StyledContent.
lib/sts/iso_sts/std_ref.rb Repoints <originator>, <doc-type>, <doc-number>, <part-number>, <suppl-*>, <year> to IsoSts models.
lib/sts/iso_sts/standard_identification.rb Repoints std-ident child elements to IsoSts xs:string wrappers.
lib/sts/iso_sts/secretariat.rb Simplifies IsoSts::Secretariat to content-only (schema xs:string).
lib/sts/iso_sts/sdo.rb Adds IsoSts::Sdo wrapper for ISOSTS xs:string <sdo>.
lib/sts/iso_sts/release_version.rb Adds IsoSts::ReleaseVersion wrapper for ISOSTS xs:string <release-version>.
lib/sts/iso_sts/release_version_id.rb Adds IsoSts::ReleaseVersionId with ISOSTS attribute set.
lib/sts/iso_sts/reg_meta.rb Repoints secretariat, ics, pub-date, wi-number, release-version-id to IsoSts models.
lib/sts/iso_sts/pub_id.rb Adds IsoSts::PubId with ISOSTS attribute set.
lib/sts/iso_sts/pub_date.rb Adds IsoSts::PubDate with ISOSTS attribute set.
lib/sts/iso_sts/proj_id.rb Adds IsoSts::ProjId wrapper for ISOSTS xs:string <proj-id>.
lib/sts/iso_sts/part_number.rb Adds IsoSts::PartNumber wrapper for ISOSTS xs:string <part-number>.
lib/sts/iso_sts/page_range.rb Adds IsoSts::PageRange with ISOSTS attribute set.
lib/sts/iso_sts/originator.rb Adds IsoSts::Originator wrapper for ISOSTS xs:string <originator>.
lib/sts/iso_sts/nat_meta.rb Repoints secretariat, ics, pub-date to IsoSts models.
lib/sts/iso_sts/mixed_citation.rb Repoints year, volume, issue, fpage, lpage, page-range, pub-id to IsoSts models.
lib/sts/iso_sts/lpage.rb Adds IsoSts::Lpage with ISOSTS attribute set.
lib/sts/iso_sts/long_desc.rb Adds IsoSts::LongDesc with ISOSTS attribute set.
lib/sts/iso_sts/issue.rb Adds IsoSts::Issue with ISOSTS attribute set.
lib/sts/iso_sts/iso_meta.rb Repoints ics, pub-date, is-proof to IsoSts models.
lib/sts/iso_sts/is_proof.rb Adds IsoSts::IsProof as an empty-element model.
lib/sts/iso_sts/ics.rb Adds IsoSts::Ics wrapper for ISOSTS xs:string <ics>.
lib/sts/iso_sts/graphic.rb Repoints alt-text and long-desc to IsoSts models.
lib/sts/iso_sts/fpage.rb Adds IsoSts::Fpage with ISOSTS attribute set.
lib/sts/iso_sts/document_identification.rb Repoints sdo, proj-id, release-version, urn to IsoSts models.
lib/sts/iso_sts/doc_type.rb Adds IsoSts::DocType wrapper for ISOSTS xs:string <doc-type>.
lib/sts/iso_sts/doc_number.rb Adds IsoSts::DocNumber wrapper for ISOSTS xs:string <doc-number>.
lib/sts/iso_sts/disp_formula.rb Repoints tex-math to IsoSts::TexMath.
lib/sts/iso_sts/array.rb Repoints permissions to IsoSts::Permissions.
lib/sts/iso_sts/app.rb Repoints permissions to IsoSts::Permissions.
lib/sts/iso_sts/alt_text.rb Adds IsoSts::AltText with ISOSTS attribute set.
lib/sts/iso_sts.rb Adds autoload entries for the new IsoSts element classes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HassanAkbar
HassanAkbar requested a review from ronaldtse July 16, 2026 14:07
@HassanAkbar HassanAkbar changed the title Fix/isosts decouple schema driven feat: decouple IsoSts from NisoSts by modelling from the ISOSTS schema Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decouple IsoSts from NisoSts: model IsoSts from the ISOSTS schema

2 participants