summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorMikhail Kobuk <[email protected]>2024-04-13 03:18:44 +0300
committerMikhail Kobuk <[email protected]>2024-04-13 03:18:44 +0300
commit2df40bb5b6e480061ec66e82aeab357ad4498355 (patch)
tree06010599da629ba605d5981d27036439c17cc721 /build.sh
downloadlinux-labs-2df40bb5b6e480061ec66e82aeab357ad4498355.tar.gz
linux-labs-2df40bb5b6e480061ec66e82aeab357ad4498355.zip
Add build system
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..cf09148
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,40 @@
+#! /bin/bash
+
+# USE: ./build.sh <pandoc> <pandoc_flags> <pandoc_format> [sources]
+
+pancompile="$1 $2 $3"
+panexec="$1"
+panflags="$2"
+panformat="$3"
+sources=${@:4}
+
+echo "using command <${pancompile}>"
+echo "for sources: ${sources}"
+
+for src in ${sources}; do
+ if [ -d ${src} ]; then
+ printf "\tfound dir: ${src}\n"
+
+ if [ "$(find ${src} -name '*.md' | wc -l)" != "1" ]; then
+ printf "\tToo many files in dir. Won't build. Skipping.\n"
+ continue
+ fi
+
+ indir_src="$(find ${src} -name '*.md')"
+ indir_out="${indir_src##*/}"
+ ${panexec} ${panflags} ${indir_src} ${panformat} -o ${indir_out%.*}.html
+
+ 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
+ fi
+done
+
+#for lab in $(find . -maxdepth 1 -name "lab*" -type d); do
+# echo "Found directory ${lab}"
+#done