commit a6b0a2f886eb9f2bb3e6bb6b391f225c952fc933 Author: setop Date: Wed May 31 12:09:07 2023 +0200 mvp diff --git a/cmd.txt b/cmd.txt new file mode 100644 index 0000000..76df603 --- /dev/null +++ b/cmd.txt @@ -0,0 +1,15 @@ +export UA="Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0" +alias aspire='/usr/bin/wget -b -r -p -np -E -k -U "$UA" ' +mkdir -p awk.docset/Contents/Resources/Documents/ +aspire https://www.gnu.org/software/gawk/manual/html_node/index.html +mv www.gnu.org/software/gawk/manual/html_node/* awk.docset/Contents/Resources/Documents/ +wget https://kapeli.com/resources/Info.plist +sed -i -e 's,nginx,awk,' -e 's,Nginx,AWK,' Info.plist +mv Info.plist awk.docset/Contents/ +sqlite3 awk.docset/Contents/Resources/docSet.dsidx 'CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);' +sqlite3 awk.docset/Contents/Resources/docSet.dsidx 'CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);' +find awk.docset/Contents/Resources/Documents -type f -name '*.html' -print0 | xargs -0 -I £ bash -c 'echo £; grep -F "" £' > index.txt +sed -i -e 's,<title>,,' -e 's,,,' -e 's, (The GNU Awk User’s Guide),,' index.txt +awk -f genindex.awk index.txt >| index.tsv +{ echo '.mode tabs' ; echo '.import index.tsv searchIndex' ; } | sqlite3 awk.docset/Contents/Resources/docSet.dsidx +mv awk.docset ~/.local/share/Zeal/Zeal/docsets/ diff --git a/genindex.awk b/genindex.awk new file mode 100644 index 0000000..cac53a5 --- /dev/null +++ b/genindex.awk @@ -0,0 +1,14 @@ +BEGIN { OFS="\t"} + +NR%2 == 1 { # path + split($0, A, "/") + path = A[length(A)] + next +} + +NR%2==0 { # title + title = $0 + print NR/2, title, "Section", path + next +} +