mirror of
https://github.com/promplate/pyth-on-line.git
synced 2025-09-06 20:53:20 +00:00
fix: baseurl for cpython docs
This commit is contained in:
@@ -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("¶", "")
|
||||
|
@@ -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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user