From f64c090bac0741963acef6193440d56fc6fbd48f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 21 Apr 2024 13:46:34 +0300 Subject: ignore bare blocks for toc generation --- lib/template.source.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/template.source.sh b/lib/template.source.sh index a18e00f..29d0bf4 100644 --- a/lib/template.source.sh +++ b/lib/template.source.sh @@ -94,7 +94,15 @@ template::inline::index () { template::inline::toc () { echo '```' echo 'Table of contents:' - $GREP '^#' "$(basename "$CURRENT_TPL")" | $SED -E -n '/^#+ / { s/#/ /g; s/^ //; p; }' + < "$(basename "$CURRENT_TPL")" $SED -E -n ' + /^```/,/^```/! { + /^#+ / { + s/#/ /g + s/^ // + p + } + } + ' echo '```' } -- cgit v1.2.3