diff options
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 19 |
1 files changed, 16 insertions, 3 deletions
| @@ -1,5 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | basedir="$(pwd)" | ||
| 4 | |||
| 3 | recursivebuild() { | 5 | recursivebuild() { |
| 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 | ||
| 18 | mdpreprocess() { | ||
| 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 | |||
| 16 | copyfile() { | 28 | copyfile() { |
| 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) |
