diff options
Diffstat (limited to 'v2/src/development/genhtml.sh')
-rwxr-xr-x | v2/src/development/genhtml.sh | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/v2/src/development/genhtml.sh b/v2/src/development/genhtml.sh index f3a6e3a..1b2718a 100755 --- a/v2/src/development/genhtml.sh +++ b/v2/src/development/genhtml.sh @@ -192,19 +192,20 @@ add_headings_anchors() { ( IFS='' while read -r line; do - if ! printf '%s' "$line" | grep -q '^<h[2-6]>'; then + if ! printf '%s' "$line" | grep -q "^$INDENT<h[2-6]>"; then printf '%s\n' "$line" continue fi - LVL="$(printf '%s' "$line" | sed 's|^<h\(.\)>.*|\1|')" - HEADING="$(printf '%s' "$line" | sed 's|^<h.>\(.*\)</h.>$|\1|')" + LVL="$(printf '%s' "$line" | sed "s|^$INDENT<h\(.\)>.*|\1|")" + HEADING="$(printf '%s' "$line" | sed "s|^$INDENT<h.>\(.*\)</h.>$|\1|")" SLUG="$(slugify_once "$HEADING")" - printf '<h%s class="header-anchor" id="%s">%s<a href="#%s" aria-hidden="true"><img class="svg-icon" src="%s" /></a></h%s>\n' \ + printf '%s<h%s class="header-anchor" id="%s">%s<a href="#%s" aria-hidden="true"><img class="svg-icon" src="%s" /></a></h%s>\n' \ + "$INDENT" \ "$LVL" \ "$SLUG" \ "$HEADING" \ "$SLUG" \ - "$(url-for 'static/link.svg')" \ + "${icon_link_url:?}" \ "$LVL" done ) |