diff options
Diffstat (limited to 'md.sh')
-rwxr-xr-x | md.sh | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -7,7 +7,7 @@ usage="usage: # input: <target dir>/src.md ./md-header ./md-footer <site root>/nav.html # output: <target dir>/index.html -# dependencies: lowdown fzf ./urlencode +# dependencies: lowdown, fzy, ./urlencode # Copyright 2019-2021 DistressNetwork° <uplink@distress.network> # @@ -111,7 +111,7 @@ done toc() { -[ "$(which fzf)" ] || { printf "[warn] \tfzf not found, skipping toc\n" ; return ; } +[ "$(which fzy)" ] || { printf "[warn] \tfzy not found, skipping toc\n" ; return ; } [ -f ./urlencode ] || { printf "[warn] \turlencode not found, skipping toc\n" ; return ; } tmp=$(mktemp -p /tmp) # using a tempfile, more convenient for storage and operations @@ -134,7 +134,7 @@ cat $tmp | while IFS='' read -r data ; do sed -e "s;^<li>\(${ID}\);<li><a href=\"#\1\">${HEADER};" -e "s;\([[:alnum:]]\)</li>$;\1</a></li>;" -i'' $tmp ; # find old id in output, replace with new id - IDLINE=$(grep -ne "^<h[[:digit:]] id=" $OUT | fzf -f "$(echo $HEADER | unesc)" | head -n 1 | cut -f 1 -d :) ; + IDLINE=$(grep -ne "^<h[[:digit:]] id=" $OUT | fzy -e "$(echo $HEADER | unesc)" | head -n 1 | cut -f 1 -d :) ; if [ "$IDLINE" ] ; then sed "${IDLINE}s;id=\".*\">.*</h;id=\"${ID}\">${HEADER}</h;" -i'' $OUT ; printf "\tassembled header: %s\n" "$(echo $HEADER | unesc)" ; |