From c103b964f0cdf2f3ff01e5c30da8536d8a298732 Mon Sep 17 00:00:00 2001 From: Methapon Metanipat Date: Mon, 30 Sep 2024 18:13:42 +0700 Subject: [PATCH] feat: add script --- gen.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 gen.sh diff --git a/gen.sh b/gen.sh new file mode 100644 index 00000000..5f6becc4 --- /dev/null +++ b/gen.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +shopt -s nullglob # Makes the loop work even if there are no files + +cd public + +for file in ./documents/*.md; do + # Extract filename without extension + filename="${file%.md}" + + # Build the output filename + output_file="./${filename}.docx" + + # Run the pandoc command with dynamic variables + pandoc \ + --reference-doc ./documents/ref.docx \ + --data-dir ./images \ + -o "$output_file" "$file" +done