summaryrefslogtreecommitdiff
path: root/publish.sh
blob: 674403dd1dec629ea478e31f8b2b87e631ec9b5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
set -x

(cd input && git pull)

INPUTS=$(find input -name '*.org' -exec grep -l "#+PUBLISH" {} \;)
readonly filter='s/#\+PUBLISH//g; ;s/\[([^\]]*)\.org\]/[$1.html]/g'

mkdir -p www
cp static/*.css www

for input in ${INPUTS}; do
    output="www${input#input}"
    output="${output%org}html"
    mkdir -p $(dirname "$output")
    perl -pe "$filter" "$input" | pandoc -f org -s -t html5 -H static/header-ext.html -o "$output"
done