1
0
Fork 0

Added ordered list

This commit is contained in:
Casey 2023-01-13 10:40:40 +03:00
parent f3ddb4a1d9
commit 3fc8a3bcd8
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 22 additions and 0 deletions

View File

@ -86,6 +86,17 @@ def node_to_html(el: PageElement) -> str:
), ),
) )
), ),
"ol": lambda tag: (
"<code>%s</code>"
% str.join(
"\n",
(
"%d. %s"
% (i, node_to_html(li).replace("\n", "\n ").strip())
for i, li in enumerate(tag.children, 1)
),
)
),
} }
TAG_SUBSTITUTIONS: Dict[str, str] = { TAG_SUBSTITUTIONS: Dict[str, str] = {
@ -157,6 +168,17 @@ def node_to_markdown(el: PageElement) -> str:
), ),
) )
), ),
"ol": lambda tag: (
"\n``%s``\n"
% str.join(
"\n",
(
"%d. %s"
% (i, node_to_markdown(li).replace("\n", "\n ").strip())
for i, li in enumerate(tag.children, 1)
),
)
),
} }
TAG_SUBSTITUTIONS: Dict[str, str] = { TAG_SUBSTITUTIONS: Dict[str, str] = {