summary refs log tree commit diff
path: root/md2saait
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-01-19 20:12:03 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2021-01-19 20:12:03 +0100
commit679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc (patch)
treea135abde1a959a9087a5b2a58a478dadfe3cb69c /md2saait
parentcf1bacb6d47208e1309a22428837ec105c40ecde (diff)
downloadlow-puszcza-679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc.tar.gz
low-puszcza-679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc.zip
Add md2saait
Diffstat (limited to 'md2saait')
-rwxr-xr-xmd2saait/frontmatter2cfg11
-rwxr-xr-xmd2saait/getdate4
2 files changed, 15 insertions, 0 deletions
diff --git a/md2saait/frontmatter2cfg b/md2saait/frontmatter2cfg
new file mode 100755
index 0000000..c53a905
--- /dev/null
+++ b/md2saait/frontmatter2cfg
@@ -0,0 +1,11 @@
+#!/bin/sh
+#/usr/bin/env nix-shell
+#nix-shell -i sh -p yq
+## Script for extracting frontmatter data and converting it into .cfg files required by saait
+##
+## Usage:
+## $ ./frontmatter2cfg [.md FILE]
+
+INPUT=$1
+
+sed -n '/---/,/---/p' $INPUT | tail -n +2 | head -n -1 | yq '{title: .title, created: .date, updated: .date, keywords: .title, image: .image}' -y | sed "/\(created\|updated\)/s/T.*'/'/" | sed "s/:/ =/"
diff --git a/md2saait/getdate b/md2saait/getdate
new file mode 100755
index 0000000..280d5cc
--- /dev/null
+++ b/md2saait/getdate
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+frontmatter2cfg $1 | grep created | \
+  cut -d' ' -f 3 | cut -c 2- | rev | cut -c 2- | rev