]> git.plutz.net Git - shellwiki/commitdiff
bugfix: faulty depth counter for recurring H1 sections
authorPaul Hänsch <paul@plutz.net>
Sun, 27 Sep 2026 11:02:04 +0000 (13:02 +0200)
committerPaul Hänsch <paul@plutz.net>
Sun, 27 Sep 2026 11:02:04 +0000 (13:02 +0200)
handlers/70_slideshow.sh

index 3e6b81391b4eaace23c5b88489c682b9979d8c23..9b01b980edba9013a86c0784fddbd693ccf20c1a 100755 (executable)
@@ -104,12 +104,13 @@ wiki "$page" | {
         if [ "$depth" -eq 1 ]; then
           printf '%s\n<a class="prevslide" href="#%s">previous</a>' \
             "${tag}" "$sl_pre"
+          depth=$((depth - 1))
         elif [ "$depth" -eq 0 ]; then
           :  # ignore "hanging" closing tag from unwrapped H1 section
         else
           printf %s "${tag}"
+          depth=$((depth - 1))
         fi
-        depth=$((depth - 1))
         tag=''
         ;;
       *\</*\>)