From 3414d142ca5cad945657c2996f924db34da79c3d Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 24 Aug 2024 19:18:51 +0300 Subject: change toc format and fix a bug --- lib/html.source.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/html.source.sh') diff --git a/lib/html.source.sh b/lib/html.source.sh index 4be36df..543a459 100644 --- a/lib/html.source.sh +++ b/lib/html.source.sh @@ -141,7 +141,7 @@ html::source_highlight () { html::list::encode () { local text="$1"; shift - if [[ "$text" != ':'* ]]; then + if [[ "$text" != '⇢ '* ]]; then # No ToC html::encode "$text" return @@ -150,19 +150,19 @@ html::list::encode () { local -i toc_indent=0 # If there's a . (dot) in the liste element, it then indicates a ToC element - while [[ "$text" == ':'* ]]; do - text="$($SED 's/://' <<< "$text")" + while [[ "$text" == '⇢ '* ]]; do + text="$($SED 's/⇢ //' <<< "$text")" : $(( toc_indent++ )) done while [ $toc_indent -ge 2 ]; do - echo -n '      ' + echo -n '⇢ ' : $(( toc_indent-- )) done text="${text/ /}" local -r id="$(generate::internal_link_id "$text")" - echo "$(html::encode "$text")" + echo "$(html::encode "$text")" } # Convert Gemtext to HTML -- cgit v1.2.3