Create remove_image_tags filter and apply it to content and summary
This commit is contained in:
@ -39,12 +39,6 @@ def try_to_replace(custom_message: str, template: str, replace_with: str) -> str
|
||||
Returns:
|
||||
Returns the custom_message with the tag replaced.
|
||||
"""
|
||||
if not template:
|
||||
return custom_message
|
||||
|
||||
if not replace_with:
|
||||
return custom_message
|
||||
|
||||
try:
|
||||
return custom_message.replace(template, replace_with)
|
||||
except TypeError:
|
||||
|
@ -31,6 +31,7 @@ templates.env.filters["encode_url"] = encode_url
|
||||
templates.env.filters["entry_is_whitelisted"] = entry_is_whitelisted
|
||||
templates.env.filters["entry_is_blacklisted"] = entry_is_blacklisted
|
||||
templates.env.filters["discord_markdown"] = convert_to_md
|
||||
templates.env.filters["remove_image_tags"] = remove_image_tags
|
||||
|
||||
|
||||
@app.post("/add_webhook")
|
||||
|
@ -82,6 +82,5 @@ def list_webhooks(reader: Reader) -> list[dict[str, str]]:
|
||||
# Check if the tag is named webhooks
|
||||
if tag == "webhooks":
|
||||
webhooks = reader.get_tag((), "webhooks") # type: ignore
|
||||
break
|
||||
|
||||
return webhooks
|
||||
|
@ -117,7 +117,7 @@
|
||||
{% raw %}
|
||||
{{ entry_content }}
|
||||
{% endraw %}
|
||||
</code>{{ entry.content[0].value|discord_markdown }}
|
||||
</code>{{ entry.content[0].value|discord_markdown|remove_image_tags }}
|
||||
</li>
|
||||
<li>
|
||||
<code>
|
||||
@ -173,7 +173,7 @@
|
||||
{% raw %}
|
||||
{{ entry_summary }}
|
||||
{% endraw %}
|
||||
</code>{{ entry.summary|discord_markdown }}
|
||||
</code>{{ entry.summary|discord_markdown|remove_image_tags }}
|
||||
</li>
|
||||
<li>
|
||||
<code>
|
||||
|
Reference in New Issue
Block a user