summaryrefslogtreecommitdiff
path: root/generate-blog.sh
diff options
context:
space:
mode:
authorAndrew <saintruler@gmail.com>2021-06-20 14:57:30 +0400
committerAndrew <saintruler@gmail.com>2021-06-20 14:57:30 +0400
commit9c694db396365a9fa512a65450a1486922fdd3e3 (patch)
tree82c6ab5c7dd87d0043ca6a4f19d1f100f2b6f719 /generate-blog.sh
Initial commit
Diffstat (limited to 'generate-blog.sh')
-rwxr-xr-xgenerate-blog.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/generate-blog.sh b/generate-blog.sh
new file mode 100755
index 0000000..8cddddd
--- /dev/null
+++ b/generate-blog.sh
@@ -0,0 +1,13 @@
+abspath="$(dirname $(realpath "$0"))"
+cd $abspath
+
+dir="blog"
+mkdir -p html
+IFS=$'\n'
+for file in $(ls ${dir}/*.md); do
+ template=$(cat template.html)
+ name=$(printf "$file" | sed -e "s/.md//" -e "s/^${dir}\///")
+ content=$(pandoc -t html "${dir}/${name}.md")
+ title=$(cat "${dir}/${name}.md" | grep "^#[^#]" | sed -e "s/^#[ ]*//")
+ printf "$template" "$title" "$content" > html/${name}.html
+done