fix: baseurl for cpython docs

This commit is contained in:
Muspi Merol
2024-08-01 12:36:46 +08:00
parent 286f7cf0e3
commit 28859db65a
2 changed files with 3 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ def install_requirements():
return ensure_future(install("html2text2"))
async def get_cpython_docs(html: str):
async def get_cpython_docs(html: str, pathname: str):
await install_requirements()
nodes = select(html, "div.body")
@@ -19,4 +19,4 @@ async def get_cpython_docs(html: str):
from html2text import html2text
return html2text(nodes[0]).replace("", "")
return html2text(nodes[0], f"/cpython/{pathname.removeprefix("/cpython")}").replace("", "")

View File

@@ -17,7 +17,7 @@
async function refresh() {
loading = true;
const py = await getPy({ web: true });
text = await py.pyimport("web.get_cpython_docs")(data.html);
text = await py.pyimport("web.get_cpython_docs")(data.html, location.pathname);
loading = false;
};