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

Handle abstract_chars_count set to 0 #172

Merged
merged 1 commit into from
Feb 21, 2023
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
8 changes: 8 additions & 0 deletions mkdocs_rss_plugin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ def get_description_or_abstract(self, in_page: Page, chars_count: int = 160) ->
# return the description.
if description and chars_count is not None:
return description
# If no description and chars_count set to 0, return empty string
elif not description and chars_count == 0:
logger.warning(
f"[rss-plugin] No description set for page {in_page.file} "
"and 'abstract_chars_count' set to 0. The feed won't be compliant, "
"because an item must have a description."
)
return ""
# If chars count is unlimited, use the html content
elif in_page.content and chars_count is None:
if chars_count is None or len(in_page.content) < chars_count:
Expand Down