Show date, if whitelisted and, if blacklisted in feed page
This commit is contained in:
@ -64,4 +64,5 @@ def entry_is_blacklisted(entry_to_check: Entry) -> bool:
|
||||
def convert_to_md(thing: str) -> str:
|
||||
"""Discord does not support tables so we need to remove them from the markdown."""
|
||||
logger.debug(f"Converting {thing} to markdown.")
|
||||
# TODO: Should we remove thead, tbody, tr, th, and td instead?
|
||||
return markdownify(thing, strip=["table", "thead", "tbody", "tr", "th", "td"]) if thing else ""
|
||||
|
@ -483,12 +483,29 @@ def create_html_for_feed(entries: Iterable[Entry]) -> str:
|
||||
else:
|
||||
text = "<div class='text-muted'>No content available.</div>"
|
||||
|
||||
if entry.published:
|
||||
published: str = entry.published.strftime("%Y-%m-%d %H:%M:%S")
|
||||
else:
|
||||
published = ""
|
||||
|
||||
if entry_is_blacklisted(entry):
|
||||
blacklisted = "<span class='badge bg-danger'>Blacklisted</span>"
|
||||
else:
|
||||
blacklisted = ""
|
||||
|
||||
if entry_is_whitelisted(entry):
|
||||
whitelisted = "<span class='badge bg-success'>Whitelisted</span>"
|
||||
else:
|
||||
whitelisted = ""
|
||||
|
||||
html += f"""
|
||||
<div class="p-2 mb-2 border border-dark">
|
||||
{blacklisted}
|
||||
{whitelisted}
|
||||
<h2>
|
||||
<a class="text-muted text-decoration-none" href="{entry.link}">{entry.title}</a>
|
||||
</h2>
|
||||
{f"By { entry.author } @" if entry.author else ""}
|
||||
{f"By { entry.author } @" if entry.author else ""} {published}
|
||||
{text}
|
||||
{f"<img src='{first_image}' class='img-fluid' alt='{first_image_text}'>" if first_image else ""}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user