+++ /dev/null
-function include() { # include a file
- # include FILE
- cat "$1"
-}
-
-function index() { # index current directory
- for f in .. ./* ; do
- name="$(basename "$f")"
- [[ "$(stat -c %F "$f")" == "directory" ]] && name+='/'
-
- # omit .cf and PREFIX/POSTFIX files
- [[ "$name" == *.cf ]] && continue
- [[ "$name" == "PREFIX" ]] && continue
- [[ "$name" == "POSTFIX" ]] && continue
-
- printf "%s <a href=\"%s\">%s</a>%$((34 - ${#name}))s %-17s %16s<br/>" \
- "$(stat -c %A "$f")" \
- "$name" "$name" "" \
- "$(date '+%d-%m-%Y %H:%M' -d "@$(stat -c %Y "$f")")" \
- "$(stat -c %s "$f")"
- done
-}
-
-function indexh() { # index with header
- printf "<b>---------- %-34s %-17s %16s</b><br/>" "name" "date" "size"
- index
-}
-
-function git-history() {
- git log --follow --format='%h %ad: %s<br/>' \
- --date='format:%d-%m-%Y' "$FILE" \
- | tr -d "\n"
-}
-
-function title() { # custom title using $FILE
- echo "<title>$1$(basename "$FILE" | rev | cut -d'.' -f2- | rev)$2</title>"
-}
echo "Working in '$(pwd)'" > /dev/stderr
file="$(basename "$1")"
-# load stock functions
+# stock functions
+
+function include() { # include a file
+ # include FILE
+ cat "$1"
+}
+
+function index() { # index current directory
+ for f in .. ./* ; do
+ name="$(basename "$f")"
+ [[ "$(stat -c %F "$f")" == "directory" ]] && name+='/'
+
+ # omit .cf and PREFIX/POSTFIX files
+ [[ "$name" == *.cf ]] && continue
+ [[ "$name" == "PREFIX" ]] && continue
+ [[ "$name" == "POSTFIX" ]] && continue
+
+ printf "%s <a href=\"%s\">%s</a>%$((34 - ${#name}))s %-17s %16s<br/>" \
+ "$(stat -c %A "$f")" \
+ "$name" "$name" "" \
+ "$(date '+%d-%m-%Y %H:%M' -d "@$(stat -c %Y "$f")")" \
+ "$(stat -c %s "$f")"
+ done
+}
+
+function indexh() { # index with header
+ printf "<b>---------- %-34s %-17s %16s</b><br/>" "name" "date" "size"
+ index
+}
+
+function git-history() {
+ git log --follow --format='%h %ad: %s<br/>' \
+ --date='format:%d-%m-%Y' "$FILE" \
+ | tr -d "\n"
+}
+
+function title() { # title
+ echo "<title>$1</title>"
+}
+
+function titlef() { # custom title using $FILE
+ echo "<title>$1$(basename "$FILE" | rev | cut -d'.' -f2- | rev)$2</title>"
+}
+
+# load user functions
libdir="${XDG_DATA_HOME:-$HOME/.local/share}/ssg"
echo "Loading libraries from '$libdir'" > /dev/stderr
for f in $libdir/** ; do