refactored tape ssg
This commit is contained in:
parent
4cf014f274
commit
6735e712eb
|
@ -1,6 +1,8 @@
|
|||
dnl template.m4.html v1.4-p1
|
||||
dnl template.m4.html v2.0-p1
|
||||
dnl Part of the tape-and-string suite used to construct the website
|
||||
ifdef(`DEBUG',`traceon')dnl
|
||||
ifdef(`_INFILE',`dnl ',`errprint(`Macro _INFILE is not defined')
|
||||
m4exit(1)')dnl
|
||||
include(`m4/lib.m4')dnl
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
@ -15,7 +17,7 @@ include(`m4/lib.m4')dnl
|
|||
<a href="/">Home</a>
|
||||
</div>
|
||||
<div class="content">
|
||||
include(`/dev/stdin')dnl Probably not a good idea, but whatever.
|
||||
esyscmd(`./tape.sh' _INFILE)
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
19
render.sh
19
render.sh
|
@ -9,21 +9,6 @@ declare -A title
|
|||
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||
function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||
function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
||||
function tape {
|
||||
if test -d "$1"; then
|
||||
err "tape: Passed directory, $1"
|
||||
return 1
|
||||
fi
|
||||
case $1 in
|
||||
*.txti) redcloth "$1" ;;
|
||||
*.org) org-ruby --translate html "$1" ;;
|
||||
*.md) comrak --gfm "$1" ;;
|
||||
*.html) cat $1 ;;
|
||||
*.s[ac]ss) err "Told to render $1, shouldn't happen"; return 1 ;;
|
||||
*.sh) (inf "Running shellscript $1, I hope you know what you're doing..."; source $1 );;
|
||||
*) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;;
|
||||
esac
|
||||
}
|
||||
function dirs {
|
||||
if test -d out; then
|
||||
wrn "Directory 'out' already exists."
|
||||
|
@ -50,9 +35,9 @@ function docs {
|
|||
o="${i/in/out}"
|
||||
echo "$i => $o"
|
||||
if test -z "${title[$i]}"; then
|
||||
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") m4/main.html.m4 > ${o%.*}.html
|
||||
m4 -D_INFILE="$i" -DCSSI=$(awk -f get_sd.awk <<< "$i") m4/main.html.m4 > ${o%.*}.html
|
||||
else
|
||||
tape $i | m4 -DCSSI=$(awk -f get_sd.awk <<< "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
|
||||
m4 -D_INFILE="$i" -DCSSI=$(awk -f get_sd.awk <<< "$i") -DTITLE="${title[$i]}" m4/main.html.m4 > ${o%.*}.html
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; }
|
||||
function wrn { 1>&2 echo -e "\x1B[1;93mWRN\x1B[0m: $*"; }
|
||||
function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; }
|
||||
if test -d "$1"; then
|
||||
err "tape: Passed directory, $1"
|
||||
return 1
|
||||
elif test -z "$*"; then
|
||||
err "No files passed."
|
||||
exit 1
|
||||
fi
|
||||
case $1 in
|
||||
_INFILE) err "Passed raw macro."; exit 1;;
|
||||
*.txti) redcloth "$1" ;;
|
||||
*.org) org-ruby --translate html "$1" ;;
|
||||
*.md) comrak --gfm "$1" ;;
|
||||
*.html) cat $1 ;;
|
||||
*.s[ac]ss) err "Told to render $1, shouldn't happen"; exit 1 ;;
|
||||
*.sh) (inf "Running shellscript $1, I hope you know what you're doing..."; source $1 );;
|
||||
*) pandoc --columns 168 -t html "$1" || echo "Skipping $i, unknown format" ;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue