about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-01-08 23:59:23 -0600
committerCase Duckworth2023-01-08 23:59:23 -0600
commitc3c14ffdead37172ac9a34220379ccbaa562c309 (patch)
tree45fbbc796737bd648519165108493d7d0a570cfb
parentRemove expand from default filters (diff)
downloadvienna-c3c14ffdead37172ac9a34220379ccbaa562c309.tar.gz
vienna-c3c14ffdead37172ac9a34220379ccbaa562c309.zip
Change $DOMAIN to $URL_ROOT
-rwxr-xr-xvienna32
1 files changed, 17 insertions, 15 deletions
diff --git a/vienna b/vienna index 9fd4a42..e192776 100755 --- a/vienna +++ b/vienna
@@ -11,7 +11,7 @@ VIENNA: a tiny, tasty ssg
11by C. Duckworth <acdw@acdw.net> 11by C. Duckworth <acdw@acdw.net>
12 12
13USAGE: vienna [-h] 13USAGE: vienna [-h]
14 vienna [-q] [-c CONFIG] [-C DIR] [-d DOMAIN] [-o DIR] [COMMAND] 14 vienna [-q] [-c CONFIG] [-C DIR] [-o DIR] [-r URL] [COMMAND...]
15 15
16FLAGS: 16FLAGS:
17 -h view this help 17 -h view this help
@@ -20,18 +20,18 @@ FLAGS:
20OPTIONS: 20OPTIONS:
21 -c FILE use FILE as configuration. [default: $VIENNA_CONFIG] 21 -c FILE use FILE as configuration. [default: $VIENNA_CONFIG]
22 -C DIR operate in DIR, instead of \$PWD. 22 -C DIR operate in DIR, instead of \$PWD.
23 -d DOMAIN use DOMAIN as basis for urls. [default: example.com]
24 -o DIR output built site to DIR. [default: ./out] 23 -o DIR output built site to DIR. [default: ./out]
24 -r URL use URL as basis for urls. [default: example.com]
25 25
26PARAMETERS: 26COMMANDS:
27 init initialize a vienna site with minimalist defaults and exit. 27 init initialize a vienna site with minimalist defaults and exit.
28 clean remove output directory before building. 28 clean remove output directory before building.
29 publish publish the site after building.
30 NOTE: this requires a .vienna.sh file in the site root.
31 you'll have to define a \`publish' function there.
32 preview preview the site locally after building. 29 preview preview the site locally after building.
33 NOTE: this requires a .vienna.sh file in the site root. 30 NOTE: this requires a .vienna.sh file in the site root.
34 you'll have to define a \`preview' function there. 31 you'll have to define a \`preview' function there.
32 publish publish the site after building.
33 NOTE: this requires a .vienna.sh file in the site root.
34 you'll have to define a \`publish' function there.
35 35
36you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG, 36you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG,
37which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so 37which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so
@@ -43,7 +43,7 @@ EOF
43 43
44configure() { 44configure() {
45 ## Set up environment 45 ## Set up environment
46 DOMAIN="${VIENNA_DOMAIN:-https://www.example.com}" 46 URL_ROOT="${VIENNA_URL_ROOT:-https://www.example.com}"
47 TEMPDIR="${VIENNA_TEMPDIR:-/tmp/vienna}" 47 TEMPDIR="${VIENNA_TEMPDIR:-/tmp/vienna}"
48 WORKDIR="${VIENNA_WORKDIR:-$PWD}" 48 WORKDIR="${VIENNA_WORKDIR:-$PWD}"
49 OUTDIR="${VIENNA_OUTDIR:-out}" 49 OUTDIR="${VIENNA_OUTDIR:-out}"
@@ -58,8 +58,10 @@ configure() {
58 # Logging 58 # Logging
59 LOG=true 59 LOG=true
60 ## Parse command line arguments 60 ## Parse command line arguments
61 while getopts C:c:d:ho:q opt; do 61 while getopts hqC:c:o:r: opt; do
62 case "$opt" in 62 case "$opt" in
63 h) usage 0 ;;
64 q) LOG=false ;;
63 C) WORKDIR="$OPTARG" ;; 65 C) WORKDIR="$OPTARG" ;;
64 c) 66 c)
65 CONFIG="$OPTARG" 67 CONFIG="$OPTARG"
@@ -67,10 +69,8 @@ configure() {
67 # line but doesn't exist. 69 # line but doesn't exist.
68 CONFIG_ARG=1 70 CONFIG_ARG=1
69 ;; 71 ;;
70 d) DOMAIN="$OPTARG" ;;
71 h) usage 0 ;;
72 o) OUTDIR="$OPTARG" ;; 72 o) OUTDIR="$OPTARG" ;;
73 q) LOG=false ;; 73 r) URL_ROOT="$OPTARG" ;;
74 *) exit 1 ;; 74 *) exit 1 ;;
75 esac 75 esac
76 done 76 done
@@ -113,8 +113,8 @@ main() {
113 fi 113 fi
114 log vienna config 114 log vienna config
115 # Log configuration variables 115 # Log configuration variables
116 log config domain: "$DOMAIN" 116 log config 'base url': "$URL_ROOT"
117 log config workdir: "$WORKDIR" 117 log config 'work dir': "$WORKDIR"
118 log config output: "$OUTDIR" 118 log config output: "$OUTDIR"
119 log template page: "$PAGE_TEMPLATE" 119 log template page: "$PAGE_TEMPLATE"
120 log template index: "$INDEX_TEMPLATE" 120 log template index: "$INDEX_TEMPLATE"
@@ -229,7 +229,9 @@ initialize() { # initialize
229 log init "$CONFIG" 229 log init "$CONFIG"
230 cat >"$CONFIG" <<EOF 230 cat >"$CONFIG" <<EOF
231# .vienna.sh 231# .vienna.sh
232DOMAIN="$DOMAIN" 232
233# Basic configuration variables
234URL_ROOT="$URL_ROOT"
233OUTDIR="$OUTDIR" 235OUTDIR="$OUTDIR"
234PLUGINDIR="$PLUGINDIR" 236PLUGINDIR="$PLUGINDIR"
235PAGE_TEMPLATE="$PAGE_TEMPLATE" 237PAGE_TEMPLATE="$PAGE_TEMPLATE"
@@ -426,7 +428,7 @@ genlist() { # genlist PERITEM_FUNC TEMPLATE_FILE PAGE...
426 while read -r FILE; do 428 while read -r FILE; do
427 test -f "$FILE" || continue 429 test -f "$FILE" || continue
428 log genlist "$peritem_func:" "$FILE" 430 log genlist "$peritem_func:" "$FILE"
429 LINK="$DOMAIN${DOMAIN:+/}${FILE%.$PAGE_RAW_EXT}" 431 LINK="$URL_ROOT${URL_ROOT:+/}${FILE%.$PAGE_RAW_EXT}"
430 META="$TEMPDIR/$FILE.meta" 432 META="$TEMPDIR/$FILE.meta"
431 "$peritem_func" "$FILE" 433 "$peritem_func" "$FILE"
432 done | expand "$template_file" 434 done | expand "$template_file"