forked from rDrama/rDrama
Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost
commit
f586fac262
|
@ -91,7 +91,8 @@ reddit_domain_regex = re.compile("(^|\s|\()https?:\/\/(reddit\.com|new\.reddit.c
|
||||||
|
|
||||||
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
|
color_regex = re.compile("[a-z0-9]{6}", flags=re.A)
|
||||||
|
|
||||||
showmore_regex = re.compile("(.{3000,40000}?</p>)(<p>.*)", flags=re.A)
|
# lazy match on the {}?, only match if there is trailing text
|
||||||
|
showmore_regex = re.compile("^(.{3000,40000}?</p>)(<p>.*)", flags=re.A)
|
||||||
|
|
||||||
search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)
|
search_token_regex = re.compile('"([^"]*)"|(\S+)', flags=re.A)
|
||||||
|
|
||||||
|
|
|
@ -373,7 +373,7 @@ def sanitize(sanitized, edit=False, limit_pings=0, showmore=True):
|
||||||
sanitized = sanitized.replace('\n','')
|
sanitized = sanitized.replace('\n','')
|
||||||
|
|
||||||
if showmore and len(sanitized) > 5000:
|
if showmore and len(sanitized) > 5000:
|
||||||
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized)
|
sanitized = showmore_regex.sub(r'\1<p><button class="showmore" onclick="showmore()">SHOW MORE</button></p><d class="d-none">\2</d>', sanitized, count=1)
|
||||||
|
|
||||||
return sanitized.strip()
|
return sanitized.strip()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue