mount and rss
[pinopress.git] / modules / md-header
1 #!/bin/sh
2
3 ## module to read meta in header of md file
4 ## usage: 
5 ##      md-header [md_filepath] [header_name]
6
7 [ "$#" -ne 2 ] && { echo "Incorrect usage"; exit 1; }
8
9 propname=""
10 case "$2" in
11     name) propname=name;;
12     published) propname=published;;
13     tags) propname=tags;;
14     description) propname=description;;
15     userlocal1) propname=userlocal1;;
16     userlocal2) propname=userlocal2;;
17     *) exit 1;;
18 esac
19
20 sed -nE "s/^-- ${propname}: (.*)$/\1/p" "$1"