asciimath / asciimathml

A new home for asciimathml
http://asciimath.org/
MIT License
958 stars 184 forks source link

`{cc}` creates invalid output #106

Closed pkra closed 4 years ago

pkra commented 5 years ago

This case came up at https://github.com/mathjax/MathJax-node/issues/441 (where "bad" input is thrown at asciimath).

A reduced test case is {cc} which creates

<math xmlns="http://www.w3.org/1998/Math/MathML"">
  <mstyle displaystyle="true">
    <mrow>
      <mo>{</mo>
      <mstyle>
        cc
      </mstyle>
      <mo>}</mo>
    </mrow>
  </mstyle>
</math>

Sorry if this is a duplicate -- I didn't find anything that looked similar.

drlippman commented 4 years ago

This looks like a general issue where a UNARY operator is inside grouping symbols with something to operate on. The current solution is to just return the tag, which is fine for mi or mo tags, but doesn't make sense in a case like this or with accent symbols.

I'm going to make a modification so that if the symbol is mi or mo, it will continue to behave as it does now, but if it's another symbol the system will generate a blank element for it to act on.