diff --git a/tilavarauspalvelu/migrations/0057_migrate_instructions_to_html.py b/tilavarauspalvelu/migrations/0057_migrate_instructions_to_html.py index e8b6bae4a..31a41bf88 100644 --- a/tilavarauspalvelu/migrations/0057_migrate_instructions_to_html.py +++ b/tilavarauspalvelu/migrations/0057_migrate_instructions_to_html.py @@ -15,7 +15,9 @@ def htmlize(text: str | None) -> str: if text.startswith("<"): return text - text = re.sub(r"(.{1,})", r"
\1
", text) + # Convert linebreaks to paragraphs + pattern = r"(.{1,})" # Match any characters, with a minimum length of 1 (Essentially get rows with content) + text = re.sub(pattern, r"\1
", text) return text.replace("\n", "") # Remove linebreaks diff --git a/utils/utils.py b/utils/utils.py index de03cb0ce..2c58c1c27 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -189,14 +189,34 @@ def as_p_tags(texts: Iterable[str]) -> str: def convert_html_to_text(html_text: str) -> str: text = html2text(html_text, bodywidth=0) - # Link text and url are the same + # Link text and url are the same: # Remove angle-brackets from links `