Forgot about plaintext
This commit is contained in:
parent
bbc5053cf6
commit
3753c6a342
|
@ -210,5 +210,19 @@ def node_to_plaintext(el: PageElement) -> str:
|
|||
return str.join("", map(node_to_plaintext, el.children)) + "\n\n"
|
||||
elif el.name == "br":
|
||||
return "\n"
|
||||
elif el.name in ("ol", "ul"):
|
||||
children = map(node_to_plaintext, el.children)
|
||||
return str.join(
|
||||
"\n",
|
||||
(
|
||||
" \u2022 %s" % li.replace("\n", "\n ").strip()
|
||||
for li in children
|
||||
)
|
||||
if el.name == "ol"
|
||||
else (
|
||||
"%d. %s" % (i, li.replace("\n", "\n ").strip())
|
||||
for i, li in enumerate(children)
|
||||
),
|
||||
)
|
||||
return str.join("", map(node_to_plaintext, el.children))
|
||||
return str(el)
|
||||
|
|
Loading…
Reference in New Issue