forked from hkc/mastoposter
Added blockquote element to node_to_plaintext
This commit is contained in:
parent
277c32b09d
commit
1b3a0bbe0b
|
@ -27,7 +27,9 @@ from mastoposter.integrations import (
|
||||||
from mastoposter.types import Status
|
from mastoposter.types import Status
|
||||||
|
|
||||||
__version__ = "0.1"
|
__version__ = "0.1"
|
||||||
__description__ = "Configurable reposter from Mastodon-compatible Fediverse servers"
|
__description__ = (
|
||||||
|
"Configurable reposter from Mastodon-compatible Fediverse servers"
|
||||||
|
)
|
||||||
|
|
||||||
logger = getLogger()
|
logger = getLogger()
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ def node_to_markdown(el: PageElement) -> str:
|
||||||
% str.join(
|
% str.join(
|
||||||
"\n",
|
"\n",
|
||||||
(
|
(
|
||||||
"▍%s" % part
|
"\u258d%s" % part
|
||||||
for part in str.join(
|
for part in str.join(
|
||||||
"", map(node_to_markdown, tag.children)
|
"", map(node_to_markdown, tag.children)
|
||||||
).split("\n")
|
).split("\n")
|
||||||
|
@ -256,6 +256,16 @@ def node_to_plaintext(el: PageElement) -> str:
|
||||||
return str.join("", map(node_to_plaintext, el.children)) + "\n\n"
|
return str.join("", map(node_to_plaintext, el.children)) + "\n\n"
|
||||||
elif el.name == "br":
|
elif el.name == "br":
|
||||||
return "\n"
|
return "\n"
|
||||||
|
elif el.name == "blockquote":
|
||||||
|
return str.join(
|
||||||
|
"\n",
|
||||||
|
(
|
||||||
|
"\u258d%s" % part
|
||||||
|
for part in str.join(
|
||||||
|
"", map(node_to_plaintext, el.children)
|
||||||
|
).split("\n")
|
||||||
|
),
|
||||||
|
)
|
||||||
elif el.name in ("ol", "ul"):
|
elif el.name in ("ol", "ul"):
|
||||||
children = map(node_to_plaintext, el.children)
|
children = map(node_to_plaintext, el.children)
|
||||||
return "\n%s\n" % str.join(
|
return "\n%s\n" % str.join(
|
||||||
|
|
Loading…
Reference in New Issue