acoeur/bin/_commands/content.sh
2022-10-26 23:12:29 +02:00

20 lines
327 B
Bash
Executable File

#!/bin/sh
. ./_commands/_extract.sh
dir=$1 file=$2
page=${file%.content}
echo
echo "= $dir/$page.md"
echo "Changing content"
line_number=$(sed -n "/---/=" "$dir/$page.md" | tail -1)
headers=$(sed -n "1,$line_number p" "$dir/$page.md")
content=$(cat "$dir/$file")
printf "%s\n%s" "$headers" "$content" > "$dir/$page.md"