diff options
| author | Paul Buetow <paul@buetow.org> | 2024-08-24 19:18:51 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-08-24 19:18:51 +0300 |
| commit | 3414d142ca5cad945657c2996f924db34da79c3d (patch) | |
| tree | 3adbd4417a417f352f88293c27ce1d2339502ae7 /lib/html.source.sh | |
| parent | d64661ccdf837bb66c3268cb4415c56ba033f515 (diff) | |
change toc format and fix a bug
Diffstat (limited to 'lib/html.source.sh')
| -rw-r--r-- | lib/html.source.sh | 10 |
1 files changed, 5 insertions, 5 deletions
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 "<a href='#$id')'>$(html::encode "$text")</a>" + echo "<a href='#$id'>$(html::encode "$text")</a>" } # Convert Gemtext to HTML |
