feat: consider included files and relative paths

This commit is contained in:
Sven Vogel 2024-12-03 09:22:02 +01:00
parent 2b91a16d7d
commit 4573e87344
1 changed files with 11 additions and 1 deletions

View File

@ -17,7 +17,7 @@ function format() {
exit 1 exit 1
fi fi
local imports=$(rg "#import \"([a-z0-9/\-]+\.typ)\"" -Nor '$1' "$1") local imports=$(rg "#import \"([a-z0-9/\-.]+\.typ)\"" -Nor '$1' "$1")
# format all included files # format all included files
while IFS= read -r line; do while IFS= read -r line; do
@ -26,6 +26,16 @@ function format() {
fi fi
format "$wd/$line" "$2" format "$wd/$line" "$2"
done <<< "$imports" done <<< "$imports"
local includes=$(rg "#import \"([a-z0-9/\-.]+\.typ)\"" -Nor '$1' "$1")
# format all included files
while IFS= read -r line; do
if [ -z "$line" ]; then
continue
fi
format "$wd/$line" "$2"
done <<< "$includes"
} }
case $1 in case $1 in