add motd schema and motd editor

This commit is contained in:
2025-11-27 19:47:26 +03:00
parent 04fd3f5d20
commit fca214dfcf
12 changed files with 156 additions and 32 deletions

View File

@@ -218,10 +218,14 @@ def should_collapse(text, surrounding):
return False
def babycode_to_html(s):
def babycode_to_html(s, banned_tags=None):
allowed_tags = list(TAGS.keys())
if banned_tags is not None:
for tag in banned_tags:
allowed_tags.remove(tag)
subj = escape(s.strip().replace('\r\n', '\n').replace('\r', '\n'))
parser = Parser(subj)
parser.valid_bbcode_tags = TAGS.keys()
parser.valid_bbcode_tags = allowed_tags
parser.bbcode_tags_only_text_children = TEXT_ONLY
parser.valid_emotes = EMOJI.keys()