paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit bfcd6e712b2148ba549f31eae781f60d58b9581f
parent 30e892759db119c356c9aab01e7ce53664c80617
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Wed, 27 May 2020 15:24:15 -0400

Fix TOC link to header with ':'

Pandoc removes ':' characters in the id it assigns to headers. This
needs to be removed from the link created in the TOC to properly create
a link.

Diffstat:
Mcompile | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compile b/compile @@ -198,7 +198,7 @@ set_html_toc() if echo "$tocEntry" | grep -qi "^subsub:"; then tocEntry="$(echo "$tocEntry" | cut -d':' -f2-)" tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \ - | tr '[:upper:]' '[:lower:]' )" + | tr '[:upper:]' '[:lower:]' | tr -d ':' )" sed -i -e "/toc-title/a\\ <ul><ul><li><a href=\"#$tocEntryId\">$tocEntry</a></li></ul></ul>" \ "$outputFile" @@ -208,7 +208,7 @@ set_html_toc() elif echo "$tocEntry" | grep -qi "^sub:"; then tocEntry="$(echo "$tocEntry" | cut -d':' -f2-)" tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \ - | tr '[:upper:]' '[:lower:]' )" + | tr '[:upper:]' '[:lower:]' | tr -d ':' )" sed -i -e "/toc-title/a\\ <ul><li><a href=\"#$tocEntryId\">$tocEntry</a></li></ul>" \ "$outputFile" @@ -217,7 +217,7 @@ set_html_toc() "$outputFile" else tocEntryId="$(echo "$tocEntry" | tr ' ' '-' \ - | tr '[:upper:]' '[:lower:]' )" + | tr '[:upper:]' '[:lower:]' | tr -d ':' )" sed -i -e "/toc-title/a\\ <li><a href=\"#$tocEntryId\">$tocEntry</a></li>" \ "$outputFile"