Fix build: skip instead of break, rework dir processing
authorMikhail Kobuk <[email protected]>
Sat, 13 Apr 2024 00:40:53 +0000 (03:40 +0300)
committerMikhail Kobuk <[email protected]>
Sat, 13 Apr 2024 00:40:53 +0000 (03:40 +0300)
build.sh

index cf091486b8fc0d2314510c1d483f7d53981e795a..0067dac585daee78416da044328b8f34a5eff7cc 100755 (executable)
--- 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
 

Powered by Git