bareddit will no longer be maintained by me (metalune) because gophereddit exists https://bareddit.metalune.xyz
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 

23 lines
901 B

# --------------------------------------------------------------- Imports ---------------------------------------------------------------- #
# System
from typing import Dict, List, Optional
import traceback, html
# Pip
from kcu import strings
# ---------------------------------------------------------------------------------------------------------------------------------------- #
__REDDIT_TAG = '​'
# ------------------------------------------------------------ Public methods ------------------------------------------------------------ #
def clean_text(text: Optional[str]) -> Optional[str]:
if text is None:
return None
return strings.htmlunescape(text).replace('\n' + __REDDIT_TAG + '\n', '\n').replace(__REDDIT_TAG, '')
# ---------------------------------------------------------------------------------------------------------------------------------------- #