mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Fixed an issue with formatting
This commit is contained in:
parent
f5ca6dfada
commit
5daebc75f5
4
misc.py
4
misc.py
|
@ -75,7 +75,7 @@ def weighted_average(value, weight, new_value):
|
||||||
|
|
||||||
def link_formatter(link):
|
def link_formatter(link):
|
||||||
"""Formats a link to not embed it"""
|
"""Formats a link to not embed it"""
|
||||||
return "<" + re.sub(r"([ \)])", "\\\\\\1", link) + ">"
|
return "<" + re.sub(r"([ )])", "\\\\\\1", link) + ">"
|
||||||
|
|
||||||
|
|
||||||
class ContentParser(HTMLParser):
|
class ContentParser(HTMLParser):
|
||||||
|
@ -98,7 +98,7 @@ class ContentParser(HTMLParser):
|
||||||
self.added = True
|
self.added = True
|
||||||
|
|
||||||
def handle_data(self, data):
|
def handle_data(self, data):
|
||||||
data = re.sub(r"(`|_|\*|~|<|>|{|}|@|/|\|)", "\\\\\\1", data, 0)
|
data = re.sub(r"([`_*~<>{}@/|\\])", "\\\\\\1", data, 0)
|
||||||
if self.current_tag == "ins" and self.ins_length <= 1000:
|
if self.current_tag == "ins" and self.ins_length <= 1000:
|
||||||
self.ins_length += len("**" + data + '**')
|
self.ins_length += len("**" + data + '**')
|
||||||
if self.ins_length <= 1000:
|
if self.ins_length <= 1000:
|
||||||
|
|
Loading…
Reference in a new issue