-
Notifications
You must be signed in to change notification settings - Fork 25
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
Math doesn't always render in summaries #40
Comments
Can you clarify a bit? I am pretty new to pelican. What are the summary pages? Are they the index pages served at SITE_URL/index.html or something different? I would think what Avaris is suggesting is taking @memoized
def get_summary(self, siteurl):
"""Returns the summary of an article.
This is based on the summary metadata if set, otherwise truncate the
content.
"""
if hasattr(self, '_summary'):
return self._update_content(self._summary, siteurl)
if self.settings['SUMMARY_MAX_LENGTH'] is None:
return self.content
return truncate_html_words(self.content,
self.settings['SUMMARY_MAX_LENGTH']) and creating something like this: def get_summary_new(self, siteurl):
"""Returns a new summary of an article.
"""
if self.settings['SUMMARY_MAX_LENGTH'] is None:
return self.content
return truncate_html_words(self.content,
self.settings['SUMMARY_MAX_LENGTH']) What did you try? |
Summaries are what you see at the bottom of the page here: https://blog.getpelican.com/category/news.html When they are auto-generated, they are just excerpts from the beginning of each article. This is what I did based on Avaris's suggestion: (This includes your changes as well.) This just replaces the call to |
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:
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 toarticle._summary
will be ignored.Thus I won't send a pull request until further comment by @barrysteyn
The text was updated successfully, but these errors were encountered: