aboutsummaryrefslogtreecommitdiff
path: root/utils/buildsite.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/buildsite.sh')
-rwxr-xr-xutils/buildsite.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/utils/buildsite.sh b/utils/buildsite.sh
index c5d8782f..7297dbb2 100755
--- a/utils/buildsite.sh
+++ b/utils/buildsite.sh
@@ -361,7 +361,8 @@ for f in docs/*.md; do
case $f in */readme.md|*/index.md) continue;; esac
title=$(head -n1 "$f" | sed "s/^#* *//")
file=${f##*/}
- echo "- [$title](./${file%.md}.html)" >> docs/index.md
+ file_no_num=$(printf '%s' "$file" | sed 's/^[0-9][0-9]-//')
+ echo "- [$title](./${file_no_num%.md}.html)" >> docs/index.md
done
cat >> docs/index.md << 'EOF'
@@ -373,6 +374,7 @@ doc_files=$(ls docs/*.md 2>/dev/null | sort | grep -v /readme.md | grep -v /inde
find . -type f -name "*.md" ! -path './public/*' | sed 's|^\./||' | while IFS= read -r i; do
dir=${i%/*}
file=${i##*/}
+ outfile=$(printf '%s' "$file" | sed 's/^[0-9][0-9]-//')
title=${dir##*/}
[ "$dir" = "$file" ] && {
title=home; dir=
@@ -388,7 +390,7 @@ find . -type f -name "*.md" ! -path './public/*' | sed 's|^\./||' | while IFS= r
next=$(printf '%s\n' "$doc_files" | grep -FA1 "$i" | tail -n1)
if [ "$next" ] && [ "$next" != "$i" ]; then
next_title=$(head -n1 "$next" | sed 's/^#* *//')
- next_html=${next##*/}
+ next_html=$(printf '%s' "${next##*/}" | sed 's/^[0-9][0-9]-//')
printf '\n<div style="display:flex;justify-content:space-between;margin-top:1.5em"><a href="/docs/">&lt;- back to docs</a><a href="/docs/%s">%s -&gt;</a></div>\n' "${next_html%.md}.html" "$next_title"
else
printf '\n<a href="/docs/">&lt;- back to docs</a>\n'
@@ -398,7 +400,7 @@ find . -type f -name "*.md" ! -path './public/*' | sed 's|^\./||' | while IFS= r
;;
esac
cat files/footer
- } > "public/${i%.md}.html"
+ } > "public/$dir/${outfile%.md}.html"
done
# move readme.html to index.html