mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add blockquotes to text decorations
This commit is contained in:
parent
036a0a53d0
commit
d9f58b5a41
1 changed files with 14 additions and 0 deletions
|
|
@ -137,6 +137,10 @@ class TextDecoration(ABC):
|
|||
def underline(self, value: str) -> str: # pragma: no cover
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def underline(self, value: str) -> str: # pragma: no cover
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def strikethrough(self, value: str) -> str: # pragma: no cover
|
||||
pass
|
||||
|
|
@ -145,6 +149,10 @@ class TextDecoration(ABC):
|
|||
def quote(self, value: str) -> str: # pragma: no cover
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def blockquote(self, value: str) -> str: #pragma: no cover
|
||||
return f"<blockquote>{value}</blockquote>"
|
||||
|
||||
@abstractmethod
|
||||
def custom_emoji(self, value: str, custom_emoji_id: str) -> str: # pragma: no cover
|
||||
pass
|
||||
|
|
@ -178,6 +186,9 @@ class HtmlDecoration(TextDecoration):
|
|||
def strikethrough(self, value: str) -> str:
|
||||
return f"<s>{value}</s>"
|
||||
|
||||
def blockquote(self, value: str) -> str:
|
||||
return f"<blockquote>{value}</blockquote>"
|
||||
|
||||
def quote(self, value: str) -> str:
|
||||
return html.escape(value, quote=False)
|
||||
|
||||
|
|
@ -215,6 +226,9 @@ class MarkdownDecoration(TextDecoration):
|
|||
def strikethrough(self, value: str) -> str:
|
||||
return f"~{value}~"
|
||||
|
||||
def blockquote(self, value: str) -> str:
|
||||
return f">{value}"
|
||||
|
||||
def quote(self, value: str) -> str:
|
||||
return re.sub(pattern=self.MARKDOWN_QUOTE_PATTERN, repl=r"\\\1", string=value)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue