First pass at site compiler
Takes vimwiki notes and throws them into HTML. Still need to: - Fix links on output - Add header/footer - Password-protect private dir
This commit is contained in:
parent
4a4d524eb4
commit
30e37785ed
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Best practice options
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
|
||||
|
||||
if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then
|
||||
echo 'Usage:
|
||||
'
|
||||
exit
|
||||
fi
|
||||
|
||||
INPUT_DIR=~/notes
|
||||
OUTPUT_DIR=~/public_html
|
||||
|
||||
pushd ~
|
||||
|
||||
traverse_dir() {
|
||||
local dir=$1
|
||||
for d in $dir; do
|
||||
OUTPUT=$OUTPUT_DIR${d##$INPUT_DIR}
|
||||
if [ -d "$d" ]; then
|
||||
mkdir -p $OUTPUT
|
||||
traverse_dir "$d/*"
|
||||
elif [[ $d == *.md ]]; then
|
||||
OUTPUT=${OUTPUT%.md}.html
|
||||
OUTPUT=${OUTPUT// /_}
|
||||
echo $OUTPUT
|
||||
pandoc -f markdown -t html -o $OUTPUT "$d"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
traverse_dir $INPUT_DIR/\*
|
||||
|
||||
popd
|
Loading…
Reference in New Issue