From 9a3e8f40c1dde6c14125fbc2e36b1ff2613de3e4 Mon Sep 17 00:00:00 2001 From: davy39 Date: Wed, 28 Feb 2024 11:07:09 +0100 Subject: [PATCH] pyodide on index.md --- main.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/main.py b/main.py index dea26bcec..2c44bc2c7 100644 --- a/main.py +++ b/main.py @@ -1129,33 +1129,21 @@ def get_image_path() -> str: # TODO : this issue concerning the urls must be closed ASAP def get_filepath() -> str: - print("docs_dirs", env.conf["docs_dir"]) - print( - "P1", - env.variables.page.abs_url, - "/".join( - filter( - lambda folder: folder != "", - convert_url_to_utf8(env.variables.page.url).split("/")[:-2], + if env.variables.page.is_index: + path = "/".join( + filter( + lambda folder: folder != "", + convert_url_to_utf8(env.variables.page.abs_url).split("/")[:-1], + ) ) - ), - ) - print( - "P2", - env.variables.page.abs_url, - "/".join( + else: + path = "/".join( filter( lambda folder: folder != "", - convert_url_to_utf8(env.variables.page.abs_url).split("/")[2:-2], + convert_url_to_utf8(env.variables.page.abs_url).split("/")[:-2], ) - ), - ) - return "/".join( - filter( - lambda folder: folder != "", - convert_url_to_utf8(env.variables.page.abs_url).split("/")[:-2], ) - ) + return path # TODO : handle the case where the same files are loaded on the same page. def generate_id_ide(content: str) -> str: