diff options
author | Case Duckworth | 2023-01-08 23:59:23 -0600 |
---|---|---|
committer | Case Duckworth | 2023-01-08 23:59:23 -0600 |
commit | c3c14ffdead37172ac9a34220379ccbaa562c309 (patch) | |
tree | 45fbbc796737bd648519165108493d7d0a570cfb | |
parent | Remove expand from default filters (diff) | |
download | vienna-c3c14ffdead37172ac9a34220379ccbaa562c309.tar.gz vienna-c3c14ffdead37172ac9a34220379ccbaa562c309.zip |
Change $DOMAIN to $URL_ROOT
-rwxr-xr-x | vienna | 32 |
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 | |||
11 | by C. Duckworth <acdw@acdw.net> | 11 | by C. Duckworth <acdw@acdw.net> |
12 | 12 | ||
13 | USAGE: vienna [-h] | 13 | USAGE: 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 | ||
16 | FLAGS: | 16 | FLAGS: |
17 | -h view this help | 17 | -h view this help |
@@ -20,18 +20,18 @@ FLAGS: | |||
20 | OPTIONS: | 20 | OPTIONS: |
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 | ||
26 | PARAMETERS: | 26 | COMMANDS: |
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 | ||
36 | you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG, | 36 | you can redefine any variables or functions vienna uses in \$VIENNA_CONFIG, |
37 | which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so | 37 | which by default is ./.vienna.sh. vienna uses heredoc-inspired templating, so |
@@ -43,7 +43,7 @@ EOF | |||
43 | 43 | ||
44 | configure() { | 44 | configure() { |
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 |
232 | DOMAIN="$DOMAIN" | 232 | |
233 | # Basic configuration variables | ||
234 | URL_ROOT="$URL_ROOT" | ||
233 | OUTDIR="$OUTDIR" | 235 | OUTDIR="$OUTDIR" |
234 | PLUGINDIR="$PLUGINDIR" | 236 | PLUGINDIR="$PLUGINDIR" |
235 | PAGE_TEMPLATE="$PAGE_TEMPLATE" | 237 | PAGE_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" |