From 679b29ec04a08c1ca43bfea6d0f5ac0ae10a72dc Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Tue, 19 Jan 2021 20:12:03 +0100 Subject: Add md2saait --- md2saait/frontmatter2cfg | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 md2saait/frontmatter2cfg (limited to 'md2saait/frontmatter2cfg') 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/:/ =/" -- cgit 1.4.1