use markdown(1) and cat(1) to build the html
* add an empty footer * add a minimal html header * indent the nav * modify the build process (publish.sh): * use a tmp directory * use discount markdown(1) rather than discount mkd2html(1) * generate html page title from the file name * indent html body * use cat(1) to combine the pieces * remove trailing newlines in publish.sh * git ignore tmp/ directory
This commit is contained in:
parent
fca71a607c
commit
fedb059fdb
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
tmp
|
5
head.html
Normal file
5
head.html
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" href="style.css">
|
12
nav.html
12
nav.html
@ -1,6 +1,6 @@
|
||||
<nav>
|
||||
<a href="/index.html">home</a>
|
||||
<a href="/projects.html">projects</a>
|
||||
<a href="/webring.html">webring</a>
|
||||
<a href="/contact.html">contact</a>
|
||||
</nav>
|
||||
<nav>
|
||||
<a href="/index.html">home</a>
|
||||
<a href="/projects.html">projects</a>
|
||||
<a href="/webring.html">webring</a>
|
||||
<a href="/contact.html">contact</a>
|
||||
</nav>
|
||||
|
20
publish.sh
20
publish.sh
@ -3,15 +3,21 @@
|
||||
PUB_DIR=${1:-/home/html/planet/static}
|
||||
FILES=md/*.md
|
||||
|
||||
test -d tmp || mkdir tmp
|
||||
|
||||
for f in $FILES
|
||||
do
|
||||
filename=$(basename -- $f .md)
|
||||
echo "publishing md/$filename.md to $PUB_DIR/$filename.html"
|
||||
mkd2html -css style.css $f
|
||||
mv md/*.html $PUB_DIR
|
||||
|
||||
# TODO insert nav before <body> tag
|
||||
# sed '/<body>/e cat nav.html' html/$filename.html
|
||||
markdown -o tmp/$filename.html $f
|
||||
sed -i 's/^/ /' tmp/$filename.html
|
||||
cp head.html tmp/
|
||||
# set the title
|
||||
title="$(echo $filename | awk '{for(i=1;i<=NF;i++){ $i=toupper(substr($i,1,1)) substr($i,2) }}1')"
|
||||
echo " <title>$title • Anarchy Planet</title>" >> tmp/head.html
|
||||
echo " </head>" >> tmp/head.html
|
||||
echo " <body>" >> tmp/head.html
|
||||
# compile the elements in order
|
||||
cat tmp/head.html nav.html tmp/$filename.html foot.html tail.html \
|
||||
> $PUB_DIR/$filename.html
|
||||
done
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user