zodiac/bin/zod_render
2011-10-18 01:07:12 -04:00

33 lines
721 B
Bash
Executable File

#!/bin/sh
# render a zodiac page
# zod_render zodlibdir projdir targetdir md_builtin [files]
zod_lib="$1"
proj="$2"
target="$3"
md_builtin="$4"
f="$5"
# source zod sh functions
. $zod_lib/zod_functions
ext=${f##*.}
meta=${f%.$ext}.meta
set -- -f "$zod_lib/render.awk"
[ -f "$proj/helpers.awk" ] && set -- "$@" -f "$proj/helpers.awk"
set -- "$@" -v markdown_filter_cmd="$md_builtin"
[ -f "$proj/global.meta" ] && set -- "$@" $proj/global.meta
[ -f "$meta" ] && set -- "$@" $meta
set -- "$@" "$f"
find "$proj" -type f -name "*.partial" -o -name "*.layout"
while read -r part; do
set -- "$@" "$part"
done
page=${f##*/}
page=${page%.$ext}.html
__zod_destination "$proj" "$target" "$f"
awk "$@" > "$destination/$page"