Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow MathML elements with m:math namespace in JATS #877

Merged
merged 2 commits into from
Mar 25, 2021

Conversation

rgieseke
Copy link
Contributor

As can be seen in #876 tools like Pandoc or LaTeXML produce MathML nodes with different namespaces.

LaTeXML's m:math is currently not read by encoda.

A simple fix is to also look for this namespace in the JATS decoder. I looked into doing the right thing and trying to read the namespace but this is probably a good enough solution if you want to include this.

According to the JATS tag browser m is common even though mml seems to be the official standard.

MathML Namespacing: The vast majority of users of this Tag Set use the DTDs as their primary (or only) model, so this Tag Set is maintained to ensure that users of DTDs and DTD-based tools will work well. Because DTDs do not “play well” with namespaces, and most DTD-based tools are not namespace aware, the MathML namespace has been hardcoded to the prefix “mml” in the DTDs. This means that the element name, in the DTDs, really is mml:math. While this was the usual prefix when this Tag Set was originally established, the more frequently seen prefix is now “m”. Since XSD and RNG use “real” namespaces, this makes no difference to them, as to a namespace-aware processor a namespace prefix is only a placeholder. For DTD users, the element names in the MathML will need to be “mml” (for example, mml:mfrac), but tools can be set to provide that prefix and the essence of namespaces is that prefixes do not matter, so no harm is done.

https://jats.nlm.nih.gov/publishing/tag-library/1.2/element/mml-math.html

Happy to look into providing test cases or consider alternatives!

@nokome
Copy link
Member

nokome commented Mar 25, 2021

Thanks for this @rgieseke, great to be getting your feedback and contributions!

I am happy to merge without a test given this is small but could you please fix the linting error:

https://dev.azure.com/stencila/stencila/_build/results?buildId=10972&view=logs&j=ad07b744-5a1a-5d54-7693-fcb02e666633&t=94df1b64-f1bb-5c49-0094-5b7458b33f31&l=20

by changing || to ??.

@rgieseke
Copy link
Contributor Author

Sure, and will try to run npm run lint before pushing next time!

@nokome nokome merged commit 52238a7 into stencila:master Mar 25, 2021
@stencila-ci
Copy link
Collaborator

🎉 This PR is included in version 0.112.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rgieseke rgieseke deleted the enable-m-math-namespace branch July 30, 2021 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants