You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
673 B
Bash

input=$1
output=$input/out
outformat=markdown+hard_line_breaks+autolink_bare_uris+lists_without_preceding_blankline
index=$output/index.html
rm -rf $output/*
cp style.css $output/style.css
echo '<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="style.css"></head><body><div><a href="index.html">Home</a></div><hr>' >> $index
for f in $input/*.md
do
f=${f##*/}
title=${f%.md}
sed 's/\[\[\(.*\)\]\]/\[\1\](\1.html)/g' "$input/$f" | pandoc -f $outformat --metadata title="$title" --template template.html --standalone -o "$output/${title}.html"
echo "<div><a href=\"$title.html\">$title</a></div>" >> $index
done
echo '</body></html>' >> $index