aboutsummaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index 93f0294..ca598e9 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,28 @@ recursivebuild() {
13 done 15 done
14} 16}
15 17
18mdpreprocess() {
19 file="$1"
20 if [ "$(echo "$file" | sed 's/.*\.//')" = "m4" ]; then
21 printf 'm4_include(macros.m4)m4_dnl\n%s\n' "$(cat "$file")" | \
22 m4 -P -I "$basedir/utils"
23 else
24 cat "$file"
25 fi
26}
27
16copyfile() { 28copyfile() {
17 file=$1 29 file=$1
18 dest=$2 30 dest=$2
19 ind=$dest/index.html 31 ind=$dest/index.html
20 extension=$(echo "$file" | sed 's/.*\.//') 32 extension=$(echo "$file" | sed 's/.*\.//')
21 case "$extension" in 33 case "$extension" in
22 md) 34 md|m4)
23 t="$(markdowntitle "$file")" 35 t="$(markdowntitle "$file")"
24 sed "s/TITLE/$t/" < top.html > "$ind" 36 sed "s/TITLE/$t/" < top.html > "$ind"
25 lowdown --html-no-skiphtml --html-no-escapehtml \ 37 mdpreprocess "$file" | \
26 "$file" >> "$ind" 38 lowdown --html-no-skiphtml --html-no-escapehtml \
39 >> "$ind"
27 cat bottom.html >> "$ind" 40 cat bottom.html >> "$ind"
28 ;; 41 ;;
29 html) 42 html)

Generated with cgit - Back to sebastiano.tronto.net