From 9f3b5569bf1a5e36773cd912f821b7ed05278a49 Mon Sep 17 00:00:00 2001 From: Randolph Sapp Date: Fri, 11 Apr 2025 18:21:20 -0500 Subject: [PATCH] fix(rename): relative paths should be from dir Relative paths should be from the directory of the current file, not from the file itself. This was done correctly for 1 out of the 3 inline replacement filters. Signed-off-by: Randolph Sapp --- bin/rename.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/rename.py b/bin/rename.py index 3b877244d..cda576288 100755 --- a/bin/rename.py +++ b/bin/rename.py @@ -162,7 +162,7 @@ def update_directives(**kwargs): """Replace old include and image/figure statements""" ref_destination = ( ' ' - + destination.relative_to(kwargs["file"], walk_up=True).as_posix() + + destination.relative_to(kwargs["file"].parent, walk_up=True).as_posix() + "\n" ) @@ -182,7 +182,7 @@ def update_inlines(**kwargs): ref_destination = ( "`" + destination.with_suffix("") - .relative_to(kwargs["file"], walk_up=True) + .relative_to(kwargs["file"].parent, walk_up=True) .as_posix() + "`" )