Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions grammars/basicdoc.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,10 @@ latexmath = element latexmath { text }
## Encoding of AsciiMath
asciimath = element asciimath { text }

## Encoding of MathML: the official W3C MathML 3.0 grammar (namespace
## Encoding of MathML: the official W3C MathML 4 grammar (namespace
## http://www.w3.org/1998/Math/MathML), via the metanorma wrapper in
## grammars/mathml/. See grammars/mathml/README.adoc and basicdoc-models#35.
## grammars/mathml/. See grammars/mathml/README.adoc, basicdoc-models#35,
## and the MathML 3 -> 4 migration: basicdoc-models#39 / metanorma#585.
mathml = external "mathml/metanorma-mathml.rnc"

StemAttributes =
Expand Down
53 changes: 42 additions & 11 deletions grammars/mathml/README.adoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,48 @@
= Vendored MathML 3.0 RelaxNG grammar
= Vendored MathML 4 RelaxNG grammar

`mathml3*.rnc` are the **unmodified** W3C MathML 3.0 RelaxNG Compact schema
files, retrieved from https://www.w3.org/Math/RelaxNG/mathml3/ and used under the
`mathml4*.rnc` are the W3C MathML 4 RelaxNG Compact schema files, retrieved
from https://www.w3.org/Math/RelaxNG/mathml4/ on **2026-07-16** and used under
the
https://www.w3.org/Consortium/Legal/2002/copyright-software-20021231[W3C Software
and Document License].
and Document License]. They are generated by W3C from
https://github.com/w3c/mathml-schema.

IMPORTANT: unlike the MathML 3 vendoring (which was unmodified), these files
carry **marked modifications**, each tagged in-place with a
`METANORMA MODIFICATION (basicdoc-models#39)` comment preserving the upstream
text. They fall into two classes: (a) the draft-generated grammar violates
RELAX NG's duplicate-attribute restriction throughout the full-profile
composition (jing rejects it outright: `data-other`, `dir`/`mathsize`/
`mathvariant`, `id`, `alttext`, `maxsize`, `href`, `attributionsrc`,
`displaystyle`, `encoding`); (b) the `anyElement`/`annotation-xml` combine
re-opens and a nested-include override had to be adjusted so the metanorma
wrapper's foreign-markup bans remain expressible for both jing and libxml2.
Diff against the upstream snapshot to enumerate; re-audit all of them when
re-syncing at CR/REC (upstream may have fixed the duplicates by then).

Include graph: `mathml4.rnc` includes `mathml4-presentation.rnc` (which
includes `mathml4-core.rnc`) and `mathml4-content.rnc` (which includes
`mathml4-strict-content.rnc`).

IMPORTANT: MathML 4 is, as of the retrieval date, a W3C **Working Draft
nearing Candidate Recommendation** (the schema is generated "for MathML4
drafts"). This snapshot is pinned as retrieved; **re-sync when MathML 4
reaches CR, and again at REC** (metanorma/metanorma#585 caveat 2). The target
is MathML 4 **full** — not MathML Core, which drops Content MathML.

`metanorma-mathml.rnc` is the metanorma wrapper: it `include`s the W3C grammar
(`start = math`) and augments it with metanorma's owned extension attributes
(currently `data-metanorma-numberformat` on `<mn>`). `basicdoc.rnc` references it
via `mathml = external "mathml/metanorma-mathml.rnc"`, so the wrapper's scope
contains the W3C grammar and avoids any define-name collision with basicdoc.
(currently `data-metanorma-numberformat` on `<mn>`), and bans the foreign
markup escape hatches (`annotation-xml`, `anyElement`). `basicdoc.rnc`
references it via `mathml = external "mathml/metanorma-mathml.rnc"`, so the
wrapper's scope contains the W3C grammar and avoids any define-name collision
with basicdoc. Note the documented v4 loosening the wrapper cannot subtract
(embedded XHTML/SVG in token content via `textorHTML`) — see the wrapper's
closing comment and metanorma/basicdoc-models#39.

MathML version is **3** (v4 is not yet officially published). The authoritative
list of `data-metanorma-numberformat` parameters lives in plurimath
(`Formatter::Standard::DEFAULT_OPTIONS`); add new `data-metanorma-*` attributes to
`metanorma-mathml.rnc` as they are coined. See metanorma/basicdoc-models#35.
MathML version is **4** (migrated from 3: metanorma/basicdoc-models#39,
umbrella metanorma/metanorma#585). The authoritative list of
`data-metanorma-numberformat` parameters lives in plurimath
(`Formatter::Standard::DEFAULT_OPTIONS`); add new `data-metanorma-*`
attributes to `metanorma-mathml.rnc` as they are coined. See
metanorma/basicdoc-models#35.
84 changes: 0 additions & 84 deletions grammars/mathml/mathml3-common.rnc

This file was deleted.

Loading
Loading