aboutsummaryrefslogtreecommitdiff
path: root/scripts/generate_post_summary_html.sh
diff options
context:
space:
mode:
authorKenny Ballou <kballou@devnulllabs.io>2018-08-17 22:30:27 -0600
committerKenny Ballou <kballou@devnulllabs.io>2018-08-19 08:11:29 -0600
commitc818f2b61c75195cf7adb542dd443e37feea7b59 (patch)
tree6f7c89e834e1973209187abd668eaa360cb367a6 /scripts/generate_post_summary_html.sh
parent28da2aee6b587e751d1ee60d9da80d9c9f200181 (diff)
downloadblog.kennyballou.com-c818f2b61c75195cf7adb542dd443e37feea7b59.tar.gz
blog.kennyballou.com-c818f2b61c75195cf7adb542dd443e37feea7b59.tar.xz
Convert to Org-mode and Pandoc
Create some fairly straight-forward conversion scripts to generate a static site from Emacs Org-mode files using Pandoc to generate HTML files.
Diffstat (limited to 'scripts/generate_post_summary_html.sh')
-rwxr-xr-xscripts/generate_post_summary_html.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/generate_post_summary_html.sh b/scripts/generate_post_summary_html.sh
new file mode 100755
index 0000000..b184246
--- /dev/null
+++ b/scripts/generate_post_summary_html.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+# Generate HTML post summary tags
+
+ORGIN=${1}
+GENERATED_PREVIEW_FILE=${2}
+PROJ_ROOT=$(git rev-parse --show-toplevel)
+
+source ${PROJ_ROOT}/scripts/org-metadata.sh
+DISPLAY_DATE=$(date -d ${DATE} +'%a %b %d, %Y')
+SORT_DATE=$(date -d ${DATE} +'%Y %m %d ')
+PREVIEW_CONTENT=$(cat ${GENERATED_PREVIEW_FILE} | pandoc -f org -t html)
+
+echo -n "${SORT_DATE}"
+echo -n '<article class="post"><header>'
+echo -n "<h2><a href=\"${SLUG}\">${TITLE}</a></h2>"
+echo -n "<div class=\"post-meta\">${DISPLAY_DATE}</div></header>"
+echo -n "<blockquote>$(echo ${PREVIEW_CONTENT})</blockquote>"
+echo -n '<ul class="tags"><li><i class="fa fa-tags"></i></li>'
+echo -n "${TAGS}" | awk '{ printf "<li>%s</li>", $0}'
+echo -n '</ul>'
+echo -n '<footer>'
+echo -n "<a href=\"${SLUG}\">Read More</a>"
+echo -n "</footer>"
+echo ""