commit 4306279f89f750d6dcf2b79da360aba72dae8c75
parent 65e342ef6089f28368b02d667c82d6b3147ecdeb
Author: Jake Bauer <jbauer@paritybit.ca>
Date: Sat, 27 Mar 2021 23:05:18 -0400
Fix table of contents link generation
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/http/compile b/http/compile
@@ -212,8 +212,7 @@ set_html_toc()
tocEntry="$(echo "$tocEntry" | sed -e 's/^[[:space:]]*//')"
if echo "$tocEntry" | grep -qi "^subsub:"; then
tocEntry="$(echo "$tocEntry" | cut -d':' -f2-)"
- tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \
- | tr '[:upper:]' '[:lower:]' | tr -d ':' )"
+ tocEntryId="$(echo "$tocEntry" | sed 's/ /%20/g' | tr -d ':' )"
sed -i -e "/toc-title/a\\
<ul><ul><li><a href=\"#$tocEntryId\">$tocEntry</a></li></ul></ul>" \
"$outputFile"
@@ -222,8 +221,7 @@ set_html_toc()
"$outputFile"
elif echo "$tocEntry" | grep -qi "^sub:"; then
tocEntry="$(echo "$tocEntry" | cut -d':' -f2-)"
- tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \
- | tr '[:upper:]' '[:lower:]' | tr -d ':' )"
+ tocEntryId="$(echo "$tocEntry" | sed 's/ /%20/g' | tr -d ':' )"
sed -i -e "/toc-title/a\\
<ul><li><a href=\"#$tocEntryId\">$tocEntry</a></li></ul>" \
"$outputFile"
@@ -231,8 +229,7 @@ set_html_toc()
</section>\n<section>" \
"$outputFile"
else
- tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \
- | tr '[:upper:]' '[:lower:]' | tr -d ':' )"
+ tocEntryId="$(echo "$tocEntry" | sed 's/ /%20/g' | tr -d ':' )"
sed -i -e "/toc-title/a\\
<li><a href=\"#$tocEntryId\">$tocEntry</a></li>" \
"$outputFile"