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

[render_math] Mathjax templated javascript #693

Closed

Conversation

danmackinlay
Copy link
Contributor

This pull request updates render_math to generate the mathjax script tags using jinja templates instead of python string templating.

This is a largeish change and it would be great if we had unit tests to ensure it hadn't broken anything ;-)

However, this should make it easier to write code with less bugs in the future; The string-interpolation method requires javascript-strings-in-javascript-strings-in-python-strings in the configuration file, which is difficult to write when it works, and doesn't work if your string needs to include quotation marks.

Jinja templating should ease development of new settings for the render_math plugin by eliminating these problems, and since jinja is used by pelican anyway should hopefully not add substantially to load time to memory usage.

Additionally, while implementing this I updated the templates to produce 2 script tags for Mathjax - a configuration script tag and a mathjax script tag. Combining these two is deprecated by Mathjax.

@danmackinlay
Copy link
Contributor Author

Whoops, I forgot to squash that down! Anyway, let's see if there's any comment first.

@danmackinlay
Copy link
Contributor Author

And I notice now that I've failed to re-enable HTTP access to mathjax in this code as opposed to HTTPS/TLS. Although - what is the use-case for this? Who will be desperate to access Mathjax over HTTP? A user with a private install of Mathjax on their intranet might wish to do this - but we currently don't support custom MathJax URLs. Other uses? I'd recommend we deprecate that feature in any case, or supplement it with custom Mathjax URL support.

@danmackinlay
Copy link
Contributor Author

@barrysteyn might have an opinion on this one, and in particular has a branch with LaTeX macro support which may relate to this one

@justinmayer
Copy link
Member

@barrysteyn: Any thoughts on this pull request?

@barrysteyn
Copy link
Contributor

@justinmayer I am on leave from work for a bit, so I will look into it within the next two or three days...

@barrysteyn
Copy link
Contributor

Hi - this is quite a big change. I know I was guilty of not making tests, however I believe a change like this needs to have some tests in order to see if things will work. @howthebodyworks perhaps we can collaborate on some tests?

@danmackinlay
Copy link
Contributor Author

My enthusiasm for tests is strictly proportional to the number of users of the code minus one. ;-)

Sure, I'll try to squeeze in tests as well; I'm currently travelling and will be for the next month so this may take a while.

In the interim, I should report that i am blogging using my own fork including the above pull request with the jinja templating and it Works For Me (tm)

@danmackinlay
Copy link
Contributor Author

Wow; Looking back, since I render_math I've done a lot of work over the year on my render_math branch, including fixing handing of math markup in drafts and adding support for Pelican 3.7. Untangling this mess could take a while.

@justinmayer
Copy link
Member

@howthebodyworks: I know it's probably a pain, but your work on this is greatly appreciated! (^_^)

@danmackinlay
Copy link
Contributor Author

Right back atcha @justinmayer.
The timing is nonetheless unfortunate - I had time earlier.

Also there is a moving target issue here - see e.g. #787 #805...

@danmackinlay danmackinlay changed the title Mathjax templated javascript [redner_math] Mathjax templated javascript Jan 4, 2017
@danmackinlay danmackinlay changed the title [redner_math] Mathjax templated javascript [render_math] Mathjax templated javascript Jan 4, 2017
@danmackinlay
Copy link
Contributor Author

I think that based on the current projections, the chance of me writing tests (#829) for render_math in any finite time are low, as it is at this point are low down a very long TODO list full of things for my day-job, including managing a boss who thinks that this new "Web" thing is a transitory fad.

Instead, I've moved on and created what is effectively substantive rewrite of render_math, with some new features and somewhat less code. This is not ideal, but it keeps my blog running. It does not, however, produce a nice clean pull request.

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.

4 participants