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

Why <math> element handler removes double round brackets? #67

Closed
skalee opened this issue Apr 28, 2021 · 2 comments
Closed

Why <math> element handler removes double round brackets? #67

skalee opened this issue Apr 28, 2021 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@skalee
Copy link
Contributor

skalee commented Apr 28, 2021

See line 13 in <math> element converter:

def convert(node, state = {})
stem = node.to_s.gsub(/\n/, " ")
stem = MathML2AsciiMath.m2a(stem) if ReverseAdoc.config.mathml2asciimath
stem = stem.gsub(/\[/, "\\[").gsub(/\]/, "\\]").gsub(/\(\(([^\)]+)\)\)/, "(\\1)") unless stem.nil?
" stem:[" << stem << "] "
end

Last #gsub call in that line replaces doubled round brackets (like in ((...))) with single ones ((...)). What's the reason for doing that? Although it seems not very harmful, it actually changes the expression itself and the way it is rendered with MathJax. For example:

Zrzut ekranu 2021-04-28 o 05 08 50
Zrzut ekranu 2021-04-28 o 05 09 00

@opoudjis, this change was made by you 3 years ago in e16d77d, do you remember why?

@skalee skalee added the question Further information is requested label Apr 28, 2021
@opoudjis opoudjis self-assigned this Apr 28, 2021
@opoudjis
Copy link
Contributor

I don't, but you should not trust the MathML generated by Microsoft's XSLT (exported from source OOXML). I would not at all be surprised if Microsoft's XSLT overgenerates brackets, and I clamped down on it doing so in response three years ago.

I'd trial it with some actual Word exports before commiting any such change if I were you.

@skalee
Copy link
Contributor Author

skalee commented May 5, 2021

Okay. I'll make it optional if I stumble upon any issues caused by this thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants