diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-10-14 21:28:19 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-10-14 21:28:19 +0200 |
| commit | 8158f66bb4842defd222b0989af3a6f621be212b (patch) | |
| tree | 5564e440dde2fe491acf265a30234252bece4989 /build.sh | |
| parent | 63d34b144553b7a5c683125588912bea075ef6a9 (diff) | |
| download | sebastiano.tronto.net-8158f66bb4842defd222b0989af3a6f621be212b.tar.gz sebastiano.tronto.net-8158f66bb4842defd222b0989af3a6f621be212b.zip | |
Added Alta Via 2 pages (hidden)
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 24 |
1 files changed, 22 insertions, 2 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,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. | ||
| 20 | mdpreprocess() { | ||
| 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 | |||
| 16 | copyfile() { | 30 | copyfile() { |
| 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) |
