1
0
mirror of https://codeberg.org/fediverse/fep.git synced 2026-08-09 05:56:10 +00:00

Website: Escape double quotes when producing page description (#825)

Double quotes are escaped to fix FEP-db0e and FEP-7b29 pages.
Removed ':' replacement, it is no longer necessary.

Reviewed-on: https://codeberg.org/fediverse/fep/pulls/825
This commit is contained in:
silverpill
2026-06-25 16:04:39 +02:00
committed by silverpill
parent cdae274566
commit 7dfa44a3cf
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -57,9 +57,8 @@ def clean_markdown(text: str) -> str:
"""Transforms markdown to a plain text string. To be used in the frontmatter"""
transformed = nh3.clean(markdown(text), tags=set())
transformed = re.sub(r"\[(.+?)\]\[(.+?)\]", r"\1", transformed)
transformed = transformed.replace(
":", " "
) # See https://codeberg.org/fediverse/fep/pulls/673/files#issuecomment-7514311
# Escape double quotes (FEP-db0e, FEP-7b29)
transformed = transformed.replace('"', '\\"')
return transformed.replace("\n", " ")
+1 -1
View File
@@ -37,7 +37,7 @@ def test_format_metatable():
("[link](http://test.example)", "link"),
("[link][link]", "link"),
("[a][a] [b][b]", "a b"),
("a:b", "a b"),
('a "b"', r'a \"b\"'),
],
)
def test_clean_markdown(text: str, expected: str):