aboutsummaryrefslogtreecommitdiff
path: root/md
diff options
context:
space:
mode:
authorthinkpadmaster <a.scerba02@gmail.com>2023-07-13 23:35:05 -0500
committerthinkpadmaster <a.scerba02@gmail.com>2023-07-13 23:35:05 -0500
commitfca693f8cf2eeeae92939488b63127a90030c8fb (patch)
treebfe7d75448b9d2714f024e7d783d3e901facfbab /md
parente864807341990f5c72e198d96740983bf7671584 (diff)
Extreme structure changes and file renames. Move to new template format.
Diffstat (limited to 'md')
-rw-r--r--md/BLOG_TEMPLATE.tmpl.html20
-rwxr-xr-xmd/md2html.sh17
-rw-r--r--md/template.md13
3 files changed, 50 insertions, 0 deletions
diff --git a/md/BLOG_TEMPLATE.tmpl.html b/md/BLOG_TEMPLATE.tmpl.html
new file mode 100644
index 0000000..c1c1dbf
--- /dev/null
+++ b/md/BLOG_TEMPLATE.tmpl.html
@@ -0,0 +1,20 @@
+{{define "title"}}{{ .Title }}{{end}}
+{{define "description"}}$description${{end}}
+{{define "keywords"}}$tags${{end}}
+
+{{define "main"}}
+<h1>$page$</h1>
+<article class="postContent">
+ <h2>{{ .Title }}</h2>
+ $body$
+ <p>Uploaded: <time datetime="$date$">$date$</time></p>
+ <!--<div class="tags">
+ <h4>tags:</h4>
+ <nav>
+ {{ range .Tags }}
+ <a href="/tags/{{ . }}">{{ . }}</a> <span>ยท</span>
+ {{ end }}
+ </nav>
+ </div>-->
+</article>
+{{end}}
diff --git a/md/md2html.sh b/md/md2html.sh
new file mode 100755
index 0000000..d45f38d
--- /dev/null
+++ b/md/md2html.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# converts md to .tmpl.html with pandoc
+
+readonly POSTS_DIR="../../html/posts"
+readonly POST_TEMP="POST_TEMPLATE.tmpl.html"
+
+post=$(basename "$1" .md)
+echo "converting $post to HTML"
+
+# pandoc for md to html
+pandoc -f markdown-auto_identifiers -t html --template=$POST_TEMP --wrap=none -o "$POSTS_DIR/$post.tmpl.html" "$post".md
+
+# # adds in filename to path no longer needed
+# sed -i "s/posts\//posts\/$post/" "$POSTS_DIR/$post.tmpl.html"
+
+# makes http & https links have target _blank and rel noopener noreferrer
+perl -i -0pe 's/(<\W*a\W*[^>]*href=)(["'"'"']http[s]?:\/\/[^"'"'"'>]*["'"'"'])([^>]*>)/$1$2 target="_blank" rel="noopener noreferrer"$3/g' "$POSTS_DIR/$post.tmpl.html" \ No newline at end of file
diff --git a/md/template.md b/md/template.md
new file mode 100644
index 0000000..2d7aa82
--- /dev/null
+++ b/md/template.md
@@ -0,0 +1,13 @@
+---
+page: Projects
+title: Title
+date: 2021-04-27
+description: Description
+tags: tmp
+---
+
+text
+
+<div class="imgGrid">
+![caption](/file/path/image.jpg "title"){alt="atext" id="thumbnail"}
+</div> \ No newline at end of file