Skip to content

Vendor W3C MathML 4 grammar (marked modifications); rework metanorma-mathml wrapper#40

Merged
opoudjis merged 2 commits into
mainfrom
feature/mathml4-grammar
Jul 16, 2026
Merged

Vendor W3C MathML 4 grammar (marked modifications); rework metanorma-mathml wrapper#40
opoudjis merged 2 commits into
mainfrom
feature/mathml4-grammar

Conversation

@opoudjis

Copy link
Copy Markdown
Contributor

Refs #39

Vendors the W3C MathML 4 RNC set (2026-07-16 draft snapshot, provenance in README) in place of MathML 3, and reworks the metanorma-mathml.rnc wrapper (numberformat augmentation + foreign-markup bans re-applied). Note for review: unlike v3 this is not an unmodified vendoring — the draft-generated W3C grammar is rejected outright by jing (duplicate-attribute violations across the full-profile composition), so the files carry marked METANORMA MODIFICATION comments (12, upstream text preserved in place; class-by-class summary in the README and commit message). Verified with jing: MathML 4 intent/arg + data-metanorma-numberformat pass, plurimath's own emission passes, foreign annotation-xml rejected. One v4 loosening a wrapper cannot subtract (embedded XHTML/SVG in token content) is documented in the wrapper.

🤖

Refs #39
Refs metanorma/metanorma#585

Replaces the vendored W3C MathML 3.0 RNC with the MathML 4 set
(www.w3.org/Math/RelaxNG/mathml4/, retrieved 2026-07-16, WD nearing CR,
pinned with provenance). Unlike the v3 vendoring, the files carry marked
modifications (each tagged METANORMA MODIFICATION in place, upstream text
preserved): the draft-generated grammar violates RELAX NG's
duplicate-attribute restriction across the full-profile composition and is
rejected outright by jing (data-other, dir/mathsize/mathvariant, id,
alttext, maxsize, href, attributionsrc, displaystyle, encoding), and the
anyElement/annotation-xml combine re-opens plus a nested-include override
had to be adjusted so the metanorma wrapper's foreign-markup bans stay
expressible for both jing and libxml2.

metanorma-mathml.rnc wrapper: include mathml4.rnc; data-metanorma-numberformat
augmentation and annotation-xml/anyElement bans re-applied; documents the one
v4 loosening a wrapper cannot subtract (embedded XHTML/SVG in token content
via textorHTML).

Verified with jing: valid MathML 4 with intent/arg +
data-metanorma-numberformat passes, text-only annotation passes, plurimath's
own emitted MathML passes, foreign annotation-xml is rejected.
@opoudjis opoudjis self-assigned this Jul 15, 2026
Refs #39

libxml2's RELAX NG rejects the compiled grammar outright on the svg branch
of mathml4-core's textorHTML ("Element svg attributes have a content type
error"), which breaks every passthrough validation in metanorma-standoc.
metanorma's serialiser never emits embedded HTML/SVG in math tokens, so
both foreign branches are removed as a further marked modification
(textorHTML = text | math), and the wrapper's "known loosening" note is
replaced by the resolution. Verified: jing probes unchanged (v4
intent/arg + numberformat pass, annotation-xml rejected), libxml2 compiles
clean, metanorma-standoc schema/validation specs green against the
recompiled set.
This was referenced Jul 15, 2026
@opoudjis
opoudjis merged commit d2a94b1 into main Jul 16, 2026
8 checks passed
opoudjis added a commit to metanorma/metanorma-standoc that referenced this pull request Jul 16, 2026
)

Refs #1212

Replaces the compiled mathml3*.rng set in lib/metanorma/validate with the
MathML 4 set compiled (trang) from the basicdoc-models vendoring
(metanorma/basicdoc-models#40: W3C 2026-07-16 draft snapshot with marked
modifications — the draft-generated grammar violates RELAX NG's
duplicate-attribute restriction throughout and its embedded-HTML/SVG token
content breaks libxml2; see that PR). metanorma-mathml.rng keeps its name,
so basicdoc.rng's externalRef is unchanged; its documentation comment is
updated to MathML 4.

jing id_check: false remains required (the v4 grammar still types id as
xsd:ID in MathMLPGlobalAttributes and CommonAtt).

Verified: schema_spec + validate_spec green (including passthrough
fragment validation through libxml2), math_spec green, full suite green.
opoudjis added a commit to metanorma/metanorma-model-iso that referenced this pull request Jul 19, 2026
#140)

* bump basicdoc-models to MathML 4 grammar; propagate mathml4 in copy.sh

Refs metanorma/metanorma-standoc#1212

basicdoc-models submodule advanced to the merged MathML 4 vendoring
(metanorma/basicdoc-models#40); copy.sh now propagates mathml4*.rng in
place of mathml3*.rng to metanorma-standoc and the flavour gems. Local
compile artifacts regenerated from the bumped submodule via trang are
byte-identical to the grammar files already shipped in
metanorma/metanorma-standoc#1214 and the 15 flavour re-vendoring PRs;
flavour basicdoc.rng copies will pick up the updated documentation
comment at the next copy.sh propagation.

* add lutaml-xsd to Gemfile: grammar build workflow requires its CLI

Refs metanorma/metanorma-standoc#1212

The Build and Deploy Grammars workflow runs `bundle exec lutaml-xsd
build`, but the lutaml-xsd executable dropped out of the lutaml
dependency chain in the early-July restructuring; the workflow has been
failing on main since 2026-07-05 (last green 2026-06-28), independently
of this branch. NB the Gemfile is Cimas-generated: the same line needs
adding to the Cimas source so the next cimas-sync does not revert it.
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.

1 participant