mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-08 16:04:51 +00:00
Do string conversion and striping in the Parser
This commit is contained in:
parent
40b0c57b54
commit
a790431274
2 changed files with 3 additions and 1 deletions
|
|
@ -108,7 +108,7 @@ class HTML:
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
def parse(self, text: str):
|
def parse(self, text: str):
|
||||||
text = utils.add_surrogates(str(text or "").strip())
|
text = utils.add_surrogates(text)
|
||||||
|
|
||||||
parser = Parser(self.client)
|
parser = Parser(self.client)
|
||||||
parser.feed(text)
|
parser.feed(text)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ class Parser:
|
||||||
self.markdown = Markdown(client)
|
self.markdown = Markdown(client)
|
||||||
|
|
||||||
def parse(self, text: str, mode: str = ""):
|
def parse(self, text: str, mode: str = ""):
|
||||||
|
text = str(text or "").strip()
|
||||||
|
|
||||||
if mode is None:
|
if mode is None:
|
||||||
return OrderedDict([
|
return OrderedDict([
|
||||||
("message", text),
|
("message", text),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue