always use .html extension for files while local testing (fix browser preview)

This commit is contained in:
Jaromil 2015-10-14 02:26:14 +02:00
parent b2a0c6d98a
commit 132da54dc7
1 changed files with 11 additions and 4 deletions

15
render
View File

@ -346,12 +346,19 @@ read_meta() {
# calculate the destination path for a file or folder to render from views
calc_dest() {
{ test -r "$1" } || {
[[ "$1" ]] || {
error "error calculating destination: cannot read $1"
return 0 }
# optional 2nd arg: extension
ext="$2"
{ test "$ext" = "" } && { ext="$EXTENSION" }
if [[ "$CMD" = "test" ]]; then
# when in test mode force .html as an extension
# since that will make the local preview in browsers work
ext=".html"
else
# optional 2nd arg: extension
ext="$2"
[[ "$ext" = "" ]] && { ext="$EXTENSION" }
fi
func "calc_dest \"$1\" \"$2\""