Skip to content

Commit

Permalink
Added the ability to make blockquote expandable
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorKhabarov committed Jul 10, 2024
1 parent 776bd53 commit 7364530
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions telebot/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def mcite(content: str, escape: Optional[bool]=True) -> str:
return content


def hcite(content: str, escape: Optional[bool]=True) -> str:
def hcite(content: str, escape: Optional[bool] = True, expandable: Optional[bool] = False) -> str:
"""
Returns a html-formatted block-quotation string.
Expand All @@ -350,11 +350,17 @@ def hcite(content: str, escape: Optional[bool]=True) -> str:
:param escape: True if you need to escape special characters. Defaults to True.
:type escape: :obj:`bool`
:param expandable: True if you need the quote to be expandable. Defaults to False.
:type expandable: :obj:`bool`
:return: The formatted string.
:rtype: :obj:`str`
"""
return '<blockquote>{}</blockquote>'.format(escape_html(content) if escape else content)
return "<blockquote{}>{}</blockquote>".format(
" expandable" if expandable else "",
escape_html(content) if escape else content,
)


def apply_html_entities(text: str, entities: Optional[List], custom_subs: Optional[Dict[str, str]]) -> str:
Expand Down

0 comments on commit 7364530

Please sign in to comment.