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