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"
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"
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