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

plugins/feeds: mention summary plugin, render summaries correctly #51

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion flamingo/plugins/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def make_urls_absolute(html, base_url):

class Feeds:
def pre_build(self, context):
env = context.templating_engine.env
render_summary = env.globals.get('render_summary')
FEEDS_DOMAIN = getattr(context.settings, 'FEEDS_DOMAIN', '/')
FEEDS = getattr(context.settings, 'FEEDS', [])

Expand Down Expand Up @@ -165,8 +167,17 @@ def pre_build(self, context):
'name': author,
})

# relies on a plugin generating a summary - see
# https://github.com/pengutronix/flamingo-ptx-blog-engine/blob/master/flamingo_ptx_blog_engine/summary.py
# for an example
if i['summary']:
summary = str(i['summary'])
if render_summary:
summary = render_summary(i)
else:
summary = str(i['summary'])

summary = make_urls_absolute(summary, fe_link['href'])

if 'html_filter' in feed_config:
summary = feed_config['html_filter'](summary)
fe.summary(summary, type='html')
Expand Down
Loading