From 07f59f5eb8c296b7306882185cbe932a2f286174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sun, 31 Jan 2021 12:51:28 +0000 Subject: Rename index to htindex (like htwrap) --- index | 74 ------------------------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100755 index (limited to 'index') diff --git a/index b/index deleted file mode 100755 index accd0be..0000000 --- a/index +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/rc -e - -# index -- add ids to headings and print index to stderr - -flagfmt=s -args='[file ...]' - -if(! ifs=() eval `{aux/getflags $*}){ - aux/usage - exit usage -} - -fn source{ - if(! ~ $#* 0) - cat $* - if not - cat -} - -source $* | awk ' - /.*<\/h[0-9]/ { - heading($0) - next - } - // { - open = 1 - s = $0 - next - } - open && /<\/h[0-9]>/ { - open = 0 - s = s "\n" $0 - heading(s) - next - } - open { s = s " " $0; next } - { print } - - function heading(s) { - i = s - sub("^.*", "", i) - sub(".*$", "", i) - i = toascii(i) - sub("^", " ", s) - sub("<\/h[0-9]>$", "", s) - print s > "/dev/stderr" - } - } - - function toascii(s) { - s = tolower(s) - gsub("[ÀÁÂÃÄÅàáâãäå]", "a", s) - gsub("[Ææ]", "ae", s) - gsub("[Çç]", "c", s) - gsub("[Ðð]", "dh", s) - gsub("[ÈÉÊËèéêë]", "e", s) - gsub("[ÌÍÎÏìíîï]", "i", s) - gsub("[Ññ]", "n", s) - gsub("[ÒÓÔÕÖØòóôõöø]", "o", s) - gsub("[ß]", "ss", s) - gsub("[Þþ]", "th", s) - gsub("[ÙÚÛÜùúûü]", "u", s) - gsub("[×]", "x", s) - gsub("[Ýýÿ]", "y", s) - gsub("[^-a-z_ ]", "", s) - gsub("[ ]+", "-", s) - return s - } -' -- cgit v1.2.3