refactor: merge html_parser.py with extensions.py
All checks were successful
Build / Upload to production (push) Successful in 1m37s
All checks were successful
Build / Upload to production (push) Successful in 1m37s
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
parent
d0357ff7c9
commit
511dc3e9b6
4 changed files with 84 additions and 74 deletions
|
@ -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()])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue