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: