-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Math does not always render in article summaries. In particular, when I use the setting RELATIVE_URLS=False, math won't render in summaries.
This is the line that inserts the script necessary to show math in summaries:
https://github.com/barrysteyn/pelican_plugin-render_math/blob/master/render_math.py#L336
I asked about this in #pelican on freenode, and I got the following response from Avaris:
Avaris: problem is the summary being memoized and there is no easy way to 'get' auto-generated summaries without triggering that
Avaris: whenever you access .summary or in this case ._get_summary(), it's recorded so that it won't have to regenerated over and over if you request it again
Avaris: that's an optimization for site generation but that creates the problem of not being able to manipulate summaries from a plugin
As a quick fix he suggested replicating this method:
https://github.com/getpelican/pelican/blob/master/pelican/contents.py#L293
in place of this:
https://github.com/barrysteyn/pelican_plugin-render_math/blob/master/render_math.py#L324
I did this and it works. But this is still just a hack. If another plugin calls get_summary before render_math, the memoization will still kick and the modification to article._summary will be ignored.
Thus I won't send a pull request until further comment by @barrysteyn