aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh24
1 files changed, 22 insertions, 2 deletions
diff --git a/build.sh b/build.sh
index 93f0294..b0ebde7 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,7 @@
1#!/bin/sh 1#!/bin/sh
2 2
3basedir="$(pwd)"
4
3recursivebuild() { 5recursivebuild() {
4 local destdir=$(echo "$1" | sed 's|^src|http|') 6 local destdir=$(echo "$1" | sed 's|^src|http|')
5 mkdir -p "$destdir" 7 mkdir -p "$destdir"
@@ -13,17 +15,35 @@ recursivebuild() {
13 done 15 done
14} 16}
15 17
18# This function is currently unused, but we keep it in case we need to
19# preprocess some m4 files.
20mdpreprocess() {
21 file="$1"
22 if [ "$(echo "$file" | sed 's/.*\.//')" = "m4" ]; then
23 printf 'm4_include(macros.m4)m4_dnl\n%s\n' "$(cat "$file")" | \
24 m4 -P -I "$basedir/utils"
25 else
26 cat "$file"
27 fi
28}
29
16copyfile() { 30copyfile() {
17 file=$1 31 file=$1
18 dest=$2 32 dest=$2
19 ind=$dest/index.html 33 ind=$dest/index.html
20 extension=$(echo "$file" | sed 's/.*\.//') 34 extension=$(echo "$file" | sed 's/.*\.//')
21 case "$extension" in 35 case "$extension" in
36 # m4 preprocess is currently disabled
37 #m4)
38 # noext=$(echo "$file" | sed 's/\..*//')
39 # mdpreprocess "$file" > $noext.md
40 # ;;
22 md) 41 md)
23 t="$(markdowntitle "$file")" 42 t="$(markdowntitle "$file")"
24 sed "s/TITLE/$t/" < top.html > "$ind" 43 sed "s/TITLE/$t/" < top.html > "$ind"
25 lowdown --html-no-skiphtml --html-no-escapehtml \ 44 mdpreprocess "$file" | \
26 "$file" >> "$ind" 45 lowdown --html-no-skiphtml --html-no-escapehtml \
46 >> "$ind"
27 cat bottom.html >> "$ind" 47 cat bottom.html >> "$ind"
28 ;; 48 ;;
29 html) 49 html)

Generated with cgit - Back to sebastiano.tronto.net