add template with home link

add index page
This commit is contained in:
quenousimporte 2024-03-21 09:52:47 +01:00
parent eaee0782d7
commit 39ee428fff
3 changed files with 31 additions and 7 deletions

15
st.sh
View File

@ -1,11 +1,20 @@
input=. input=$1
output=./out output=$input/out
outformat=markdown+hard_line_breaks+autolink_bare_uris+lists_without_preceding_blankline outformat=markdown+hard_line_breaks+autolink_bare_uris+lists_without_preceding_blankline
index=$output/index.html
rm -rf $output/* rm -rf $output/*
cp style.css $output/style.css 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 for f in $input/*.md
do do
f=${f##*/} f=${f##*/}
sed 's/\[\[\(.*\)\]\]/\[\1\](\1.html)/g' "$input/$f" | pandoc -f $outformat --metadata title="${f%.md}" --standalone --css=style.css -o "$output/${f%.md}.html" 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 done
echo '</body></html>' >> $index

15
template.html Normal file
View File

@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>$title$</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div>
<a href="index.html">Home</a>&nbsp;
</div>
<hr>
$body$
</body>
</html>