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

Conflict between stem and inline passtrough when using + in multiple formulas #3409

Closed
MarcdeFalco opened this issue Sep 8, 2019 · 3 comments
Assignees
Milestone

Comments

@MarcdeFalco
Copy link

There's a conflict between stem and inline passtrough substitution when using at least two formulas with a plus in them.

Minimal example :
stem:[+] X stem:[+]
which gets substituted to stem:[<PASSTROUGH containing ] X stem:[>]

@mojavelinux
Copy link
Member

mojavelinux commented Sep 9, 2019

Your observation is consistent with how the parser is designed / implemented. That pattern matches the requirements of a constrained passthrough. Thus, the + must be escaped. There are various ways of doing so.

  • stem:[\+] X stem:[+]
  • stem:a[{plus}] X stem:[+]
  • stem:[+++] X stem:[+]

These types of problems will be resolved (or at least minimized) once the design of the inline parser is changed, though that must first be addressed in the AsciiDoc language definition. See #61.

@mojavelinux mojavelinux added this to the support milestone Sep 9, 2019
@mojavelinux mojavelinux self-assigned this Sep 9, 2019
@jirutka
Copy link
Member

jirutka commented Mar 6, 2020

One of my users encountered this problem too, in a non-obvious formula: stem:[+\infty-(+\infty)]. It behaves even more oddly in asciidoctor.js. I minimalized this example into stem:[+1+] – asciidoctor.js renders 0 instead of +1+ or at least 1!

This makes Asciidoctor basically unusable for math teachers.

I suggest the following easy fix: move stem processing before passthrough processing.

jirutka added a commit to jirutka/asciidoctor that referenced this issue Mar 6, 2020
I just moved processing of the stem substitutions before processing of
the passthrough substitutions. It seems that it works well and the side
effects of this change are acceptable, i.e. they will probably affect
much less users than the current undesirable behaviour of + signs inside
the stem macros.

Fixes asciidoctor#3409
@mojavelinux
Copy link
Member

I've added tests to verify the parser is working as designed. See e2c0534

I believe the issue with Asciidoctor.js has also since been resolved. It used to have a problem locating passthrough placeholders, which is why the 0 was showing up (technically it was an escaped 0). Regardless, that is/was an issue with Asciidoctor.js, not this project.

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

Successfully merging a pull request may close this issue.

3 participants