mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Add markdown support for ufora notifications, store notifications using IDs
This commit is contained in:
parent
c9bef3b300
commit
268bb80bfd
2 changed files with 23 additions and 3 deletions
|
|
@ -26,6 +26,9 @@ class UforaNotification:
|
|||
|
||||
return embed
|
||||
|
||||
def get_id(self):
|
||||
return int(self._notif_id) if self._notif_id is not None else self._content["id"]
|
||||
|
||||
def _create_url(self):
|
||||
if self._notif_id is None or self._course_id is None:
|
||||
return self._content["link"]
|
||||
|
|
@ -52,11 +55,27 @@ class UforaNotification:
|
|||
|
||||
def _clean_content(self, text: str):
|
||||
html_table = {
|
||||
# CHARACTERS:
|
||||
"&": '&',
|
||||
""": '"',
|
||||
"apos;": "'",
|
||||
">": ">",
|
||||
"<": "<"
|
||||
"<": "<",
|
||||
# MARKDOWN SUPPORT:
|
||||
"<b>": "**",
|
||||
"</b>": "**",
|
||||
"<strong>": "**",
|
||||
"</strong>": "**",
|
||||
"<i>": "*",
|
||||
"</i>": "*",
|
||||
"<em>": "*",
|
||||
"</em>": "*",
|
||||
"<del>": "~~",
|
||||
"</del>": "~~",
|
||||
"<ins>": "__",
|
||||
"</ins>": "__",
|
||||
# Represent paragraphs with newlines
|
||||
"</p>": "\n"
|
||||
}
|
||||
|
||||
# Unescape HTML
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue