From a288b29ddc37eefeebf41ef25ec7cd60879e3c75 Mon Sep 17 00:00:00 2001 From: Mikhail Kobuk Date: Sat, 13 Apr 2024 03:40:53 +0300 Subject: [PATCH] Fix build: skip instead of break, rework dir processing --- build.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build.sh b/build.sh index cf09148..0067dac 100755 --- a/build.sh +++ b/build.sh @@ -11,6 +11,17 @@ sources=${@:4} echo "using command <${pancompile}>" echo "for sources: ${sources}" +function process_dir() { + pushd . + arg_dir=$1 + + cd ${arg_dir} + indir_src="$(find . -name '*.md')" + indir_out="${indir_src##*/}" + ${panexec} ${panflags} ${indir_src} ${panformat} -o ../${indir_out%.*}.html + popd +} + for src in ${sources}; do if [ -d ${src} ]; then printf "\tfound dir: ${src}\n" @@ -20,9 +31,7 @@ for src in ${sources}; do continue fi - indir_src="$(find ${src} -name '*.md')" - indir_out="${indir_src##*/}" - ${panexec} ${panflags} ${indir_src} ${panformat} -o ${indir_out%.*}.html + process_dir ${src} elif [ -f ${src} ] && [ "${src##*.}" == "md" ]; then printf "\tfound md file: ${src}\n" @@ -30,8 +39,7 @@ for src in ${sources}; do printf "\t${panexec} ${panflags} ${src} ${panformat} -o ${src%.*}.html" ${panexec} ${panflags} ${src} ${panformat} -o ${src%.*}.html else - echo "unknown source" - exit 1 + printf "Unknown source (%s) - skipping\n" "$src" fi done -- 2.34.1