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

Add @mgeier's math tagging for rst conversion[WIP] #416

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mpacer
Copy link
Member

@mpacer mpacer commented Sep 17, 2016

Should address #291.

Some note on review: I just copied that code as it was used in production with nbsphinx. It LGTM, but I've not put it through more extensive testing; I'm assuming that (if it doesn't break our tests) then it does as @mgeier describes in #291 and alludes to in #232.

@mpacer
Copy link
Member Author

mpacer commented Sep 17, 2016

Is there a reason that our pandoc calls inside filters don't include filter_func's by default? If not then, this seems like it should work.

@mpacer mpacer changed the title Add @mgeier's math tagging for rst conversion Add @mgeier's math tagging for rst conversion[WIP] Sep 17, 2016
@mpacer
Copy link
Member Author

mpacer commented Sep 17, 2016

Aha…it's because we don't use that at all because our pandoc call is structured slightly differently than nbsphinx's, which has a two step call one to go to json and then a second to convert from json to whichever format is needed.

This will take a little more work than I thought, changing to WIP.

@mpacer mpacer closed this Sep 17, 2016
@mpacer mpacer reopened this Sep 17, 2016
@mpacer
Copy link
Member Author

mpacer commented Sep 17, 2016

Hmmm…one solution would be to perform the intermediate json step inside the rst2markdown converter, but that is messy. another option would be to have an alternate execution path for pandoc wherein if it has a filter like this then it goes through this intermediate json layer. This way current functionality isn't adjusted. I'm going to investigate that path.

@mpacer mpacer mentioned this pull request Oct 12, 2016
@@ -102,4 +102,4 @@ def rawlatex2math(text):
json_data = json.loads(text, object_hook=rawlatex2math_hook)
return json.dumps(json_data)

return pandoc(source, 'markdown', 'rst', extra_args=extra_args)
return pandoc(source, 'markdown', 'rst', extra_args=extra_args, filter_func=rawlatex2math)
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't have def to refer back to as far as I can tell. no wonder it doesn't work.

@@ -117,5 +117,7 @@ def rawlatex2math_hook(obj):
def rawlatex2math(text):
json_data = json.loads(text, object_hook=rawlatex2math_hook)
return json.dumps(json_data)

temp_text =
Copy link
Member Author

Choose a reason for hiding this comment

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

This is invalid :(

@mpacer
Copy link
Member Author

mpacer commented Dec 7, 2016

This is going the wrong direction, fix using the new syntax for intermediate actions on the json internals as a pure python process.

@mpacer
Copy link
Member Author

mpacer commented Dec 7, 2016

In particular note: these results associated with #458

Make pandoc call include filter

trying to have a secondary two processing level pandoc call
return json.dumps(json_data)


return convert_pandoc(source, 'markdown', 'rst', extra_args=extra_args)
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to use the new pandoc_with_filter function you defined here? At the moment, I don't think it's using the functions functions you define above.

@willingc willingc added the status:work-in-process Do not merge label Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants