diff options
author | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-01-19 20:12:03 +0100 |
---|---|---|
committer | Patryk Niedźwiedziński <pniedzwiedzinski19@gmail.com> | 2021-01-19 20:12:03 +0100 |
commit | 679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc (patch) | |
tree | a135abde1a959a9087a5b2a58a478dadfe3cb69c /md2saait | |
parent | cf1bacb6d47208e1309a22428837ec105c40ecde (diff) | |
download | low-puszcza-679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc.tar.gz low-puszcza-679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc.zip |
Add md2saait
Diffstat (limited to 'md2saait')
-rwxr-xr-x | md2saait/frontmatter2cfg | 11 | ||||
-rwxr-xr-x | md2saait/getdate | 4 |
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 |