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

Percent sign should be an operator (<mo>) #58

Closed
skalee opened this issue Apr 7, 2021 · 1 comment
Closed

Percent sign should be an operator (<mo>) #58

skalee opened this issue Apr 7, 2021 · 1 comment
Milestone

Comments

@skalee
Copy link

skalee commented Apr 7, 2021

Problem description

Given example:

AsciiMath.parse("40%").to_mathml

Expected result:

<math><mn>40</mn><mo>%</mo></math>

Actual result:

<math><mn>40</mn><mi>%</mi></math>

That is it includes <mi>%</mi> instead of <mo>%</mo>.

Rationale

  1. It is a suffix operator or part of number notation, but certainly not an identifier.
  2. https://github.com/asciimath/asciimathml converts percent signs to <mo>%</mo>.

Can you provide a fix?

I think so.

@pepijnve
Copy link
Member

pepijnve commented Apr 7, 2021

I found the missing bit of logic in the asciimath.js implementation at https://github.com/asciimath/asciimathml/blob/master/ASCIIMathML.js#L605 tagst = (("A">st || st>"Z") && ("a">st || st>"z")?"mo":"mi");

This implementation doesn't have this heuristic in place. Should be easy enough to fix.

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

No branches or pull requests

2 participants