refactor: merge html_parser.py with extensions.py
All checks were successful
Build / Upload to production (push) Successful in 1m37s

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2025-06-09 01:39:26 +03:00
parent d0357ff7c9
commit 511dc3e9b6
Signed by: mctaylors
GPG key ID: 4EEF4F949A266EE2
4 changed files with 84 additions and 74 deletions

View file

@ -5,6 +5,28 @@ from typing import Any, Optional
import config
class HtmlFormat:
@staticmethod
def bold(s: str) -> str:
return f"<b>{s}</b>"
@staticmethod
def italic(s: str) -> str:
return f"<i>{s}</i>"
@staticmethod
def strikethrough(s: str) -> str:
return f"<s>{s}</s>"
@staticmethod
def hyperlink(s: str, href: str) -> str:
return f"<a href='{href}'>{s}</a>"
@staticmethod
def code(s: str) -> str:
return f"<code>{s}</code>"
def humanize_tags_from_json(value: str, default: str) -> str:
if value != "":
return ", ".join([re.sub("_\\(.*", "", t) for t in value.split()])