Tweak index format

This commit is contained in:
Revar Desmera 2019-07-17 23:36:55 -07:00
parent d320940654
commit 5abc7db530

View File

@ -14,14 +14,15 @@ function lcase
function mkindex
{
TMPFILE=$(mktemp -t $(basename $0)) || exit 1
sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "[%s](%s#%s)\n", $3, $1, $3}' | sort -d -f -u >> $TMPFILE
sed 's/[^a-zA-Z0-9_.:$]//g' | awk -F ':' '{printf "- [%s](%s#%s)\n", $3, $1, $3}' | sort -d -f -u >> $TMPFILE
alpha="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
for a in $alpha; do
echo -n "[$a](#$(lcase "$a")) "
done
echo
echo
for a in $alpha; do
links=$(cat $TMPFILE | grep -i "^.[$(lcase "$a")]")
links=$(cat $TMPFILE | grep -i "^- .[$(lcase "$a")]")
if [ "$links" != "" ]; then
echo "### $(ucase "$a")"
echo "$links"