blob: 8cddddde91097a2726a1302717790a3fc869ba80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
abspath="$(dirname $(realpath "$0"))"
cd $abspath
dir="blog"
mkdir -p html
IFS=$'\n'
for file in $(ls ${dir}/*.md); do
template=$(cat template.html)
name=$(printf "$file" | sed -e "s/.md//" -e "s/^${dir}\///")
content=$(pandoc -t html "${dir}/${name}.md")
title=$(cat "${dir}/${name}.md" | grep "^#[^#]" | sed -e "s/^#[ ]*//")
printf "$template" "$title" "$content" > html/${name}.html
done
|