From 8fb7c32ec32339b2c1890c9094ff9e6687a6b9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Mon, 2 Jan 2023 17:13:53 +0100 Subject: [PATCH] Meta: Create nested manpage section indices for the website This is probably committing some sed crimes, but it looks very nice! --- Meta/build-manpages-website.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Meta/build-manpages-website.sh b/Meta/build-manpages-website.sh index 459abe7d12..49de582db9 100755 --- a/Meta/build-manpages-website.sh +++ b/Meta/build-manpages-website.sh @@ -76,11 +76,15 @@ for section_directory in output/*/; do <( for f in $(find "${section_directory}" -iname '*.html' | ${SORT}); do filename=$(realpath --relative-to="${section_directory}" "$f") - name="${filename%.html}" if [[ "$filename" == "index.html" ]]; then continue fi - echo "- [${name}](${filename})" + filename_no_extension="${filename%.html}" + # Generate indentation by subdirectory count: Replace each slash by the two Markdown indentation spaces, then remove all non-space characters. + indentation=$(echo "${filename_no_extension}" | sed -e 's/ //g' -e 's/\// /g' -e 's/[^ ]//g') + name="$(basename "${filename}")" + name="${name%.html}" + echo "${indentation}- [${name}](${filename})" done ) & done