about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xvienna26
1 files changed, 15 insertions, 11 deletions
diff --git a/vienna b/vienna index 1d060ce..5ebdb93 100755 --- a/vienna +++ b/vienna
@@ -98,13 +98,16 @@ main() {
98 # doesn't exist, that's an error. If we're just looking for the 98 # doesn't exist, that's an error. If we're just looking for the
99 # default file, however, there is no error---the user might want 99 # default file, however, there is no error---the user might want
100 # to use the default configuration. 100 # to use the default configuration.
101 log "Can't find configuration \`$CONFIG'." 101 log error "Can't find configuration \`$CONFIG'."
102 exit 2 102 exit 2
103 fi 103 fi
104 ## Log configuration variables 104 ## Log configuration variables
105 log config "domain: $DOMAIN" 105 log config domain: "$DOMAIN"
106 log config "workdir: $WORKD" 106 log config workdir: "$WORKD"
107 log config "output: $OUTD" 107 log config output: "$OUTD"
108 log config page.tmpl: "$PAGE_TEMPLATE"
109 log config index.tmpl: "$INDEX_TEMPLATE"
110 log config feed.tmpl: "$FEED_TEMPLATE"
108 ## Plugins 111 ## Plugins
109 # Plugins are .*.sh files in build directory. They're sourced here. 112 # Plugins are .*.sh files in build directory. They're sourced here.
110 if gencheckglob './.*.sh' ./.*.sh; then 113 if gencheckglob './.*.sh' ./.*.sh; then
@@ -158,15 +161,15 @@ postprocess() {
158 case "${1:-ok}" in 161 case "${1:-ok}" in
159 ok) ;; 162 ok) ;;
160 publish) 163 publish)
161 log vienna "publish" 164 log vienna publish
162 publish "$OUTD" 165 publish "$OUTD"
163 ;; 166 ;;
164 preview) 167 preview)
165 log vienna "preview" 168 log vienna preview
166 preview "$OUTD" 169 preview "$OUTD"
167 ;; 170 ;;
168 *) 171 *)
169 log vienna "Don't know command \`$1'." 172 log error "Don't know command \`$1'."
170 exit 1 173 exit 1
171 ;; 174 ;;
172 esac 175 esac
@@ -207,9 +210,10 @@ EOF
207 210
208log() { 211log() {
209 if "$LOG"; then 212 if "$LOG"; then
210 t="$1" 213 printf >&2 '[%s] ' "$1"
211 shift 214 shift
212 echo >&2 "[$t]" "$@" 215 printf >&2 "%s\t" "$@"
216 echo >&2
213 fi 217 fi
214} 218}
215 219
@@ -307,7 +311,7 @@ genpage() { # genpage PAGE...
307 test -f "$PAGE_TEMPLATE" || return 1 311 test -f "$PAGE_TEMPLATE" || return 1
308 gencheckglob "*.$PAGE_RAW_EXT" "$@" || set -- 312 gencheckglob "*.$PAGE_RAW_EXT" "$@" || set --
309 for FILE; do 313 for FILE; do
310 log genpage "$FILE" 314 log genpage "$FILE"
311 outd="$OUTD/${FILE%.$PAGE_RAW_EXT}" 315 outd="$OUTD/${FILE%.$PAGE_RAW_EXT}"
312 outf="$outd/index.html" 316 outf="$outd/index.html"
313 tmpf="$TMPD/$FILE.tmp" 317 tmpf="$TMPD/$FILE.tmp"
@@ -328,7 +332,7 @@ genlist() { # genlist PERITEM_FUNC TEMPLATE_FILE PAGE...
328 return 332 return
329 fi 333 fi
330 for FILE; do 334 for FILE; do
331 log genlist "$peritem_func: $template_file: $FILE" 335 log genlist "$peritem_func" "$FILE"
332 LINK="$DOMAIN${DOMAIN:+/}${FILE%.$PAGE_RAW_EXT}" 336 LINK="$DOMAIN${DOMAIN:+/}${FILE%.$PAGE_RAW_EXT}"
333 "$peritem_func" "$FILE" 337 "$peritem_func" "$FILE"
334 done | expand "$template_file" 338 done | expand "$template_file"