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

Improve parsing of composite inline blocks #66

Merged
merged 7 commits into from Feb 20, 2020
Merged

Conversation

chrisjsewell
Copy link
Member

fixes #51, where for example a $ within a code span was causing issues for later math blocks, i.e. for.

`$` $a=1$

Only a math block between the first and second dollar sign was being recognised as potential math (overriden in priority by the code block), since the math block regex was run once per paragraph.

Now the algorithm looks for the first span block match (code block or math block) and, if a block is found, records that block, advances the cursor position to the end of the block, and recomputes the next block.

@chrisjsewell
Copy link
Member Author

@choldgraf since this is a change to the core parsing algorithm, before merging, we should read carefully through the CircleCI artefacts, to check for any unexpected behaviour not picked up by the unit tests.

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 20, 2020

Differences noted between 'Wealth Distribution Dynamics' examples:

@chrisjsewell
Copy link
Member Author

Didn't see any issues in syntax.md, but I did note that RTD (right) doesn't appear to be rendering admonitions correctly, like from CircleCI artefact (left)?

image

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 20, 2020

@choldgraf
Copy link
Member

that is quite strange that RTD has different behavior from Circle (circle looks fine to me FWIW). Perhaps that's something unrelated to this PR that we should figure out in a different issue? I wonder if RTD is loading (or not loading) some kind of asset that is different in CircleCI. Or, it could be that RTD is using a different version of Sphinx (if I remember it uses an older 1.X version)

@chrisjsewell
Copy link
Member Author

using a different version of Sphinx

That would be my first thought as well. Maybe you can force RTD to use a newer version of sphinx? I'm sure I've done something like this before, by using Conda.

@choldgraf
Copy link
Member

yep, I think you can specify it in RTD.yml, I'll try it in another PR to see if that fixes it (may do some self-merging since we don't get the build results until it's merged)

@chrisjsewell
Copy link
Member Author

chrisjsewell commented Feb 20, 2020

may do some self-merging since we don't get the build results until it's merged

You can add/activate extra repo branches for RTD to build in the Version settings

@choldgraf
Copy link
Member

hmmm, actually I take it back, our [sphinx] install option does specify 2.X, and the logs say it's running 2.4.2

@choldgraf
Copy link
Member

OK I think it has to do with the Sphinx theme we're using, I opened up #68 to track it

@chrisjsewell
Copy link
Member Author

Anyway, I'm happy to merge this PR now, if you are?

Figure out why equation referencing didn't work
```
Euler's identity, equation {DOESN'T WORKeq}`euler`, was elected one of the
Euler's identity, equation {math:numref}`euler`, was elected one of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yessss

"For example, `$x_{hey}=it+is^{math}$` renders $x_{hey}=it+is^{math}$.",
],
),
("in_link_content", ["[$a$](link)"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

embedding equations inside links...this is some power-user stuff right here ;-)

Copy link
Member

@choldgraf choldgraf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for the improvement, it's good to see multi-part roles working now!

@choldgraf choldgraf merged commit 7cc2c92 into develop Feb 20, 2020
@chrisjsewell chrisjsewell deleted the math-issue-51 branch February 20, 2020 06:06
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 this pull request may close these issues.

'$'-delimited in-line math example fails in syntax.md
2 participants