summary refs log tree commit diff
path: root/md2saait/frontmatter2cfg
blob: e4fb4e221c8a4adc6d69abd762ebded0a21b2a3b (plain)
1
2
3
4
5
6
7
8
9
10
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/:/ =/" | sed "s/'//g"