From 80dbf5531816e8c56b41bcf895e47d655a87b75a Mon Sep 17 00:00:00 2001 From: Louie Shprung Date: Tue, 14 Mar 2023 14:24:59 -0700 Subject: Bump default version; restructure source to use pup for html parsing --- .gitignore | 4 ++-- Makefile | 2 +- README | 1 + src/index.sh | 65 ++++++++++++++++++++++++++++-------------------------------- 4 files changed, 34 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 9941ba2..9408f63 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/GNU_Make.docset -/GNU_Make.tgz +/GNU_Autoconf_Archive.docset +/GNU_Autoconf_Archive.tgz /tmp diff --git a/Makefile b/Makefile index fd8a429..d5c95b3 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ INDEX_FILE = $(RESOURCES_DIR)/docSet.dsidx ICON_FILE = $(DOCSET_DIR)/icon.png ARCHIVE_FILE = $(DOCSET_NAME).tgz -MANUAL_VERSION = 2022.09.03 +MANUAL_VERSION = 2023.02.20 MANUAL_URL = https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archive-$(MANUAL_VERSION).tar.xz MANUAL_SRC = tmp/autoconf-archive-$(MANUAL_VERSION) MANUAL_SRC_MAKEFILE = $(MANUAL_SRC)/Makefile diff --git a/README b/README index 0dbe50c..a345bcd 100644 --- a/README +++ b/README @@ -12,5 +12,6 @@ Requirements: - any POSIX-compliant shell - curl - make +- pup - sqlite3 - texinfo diff --git a/src/index.sh b/src/index.sh index 4d4b12b..05c066e 100755 --- a/src/index.sh +++ b/src/index.sh @@ -1,29 +1,20 @@ #!/usr/bin/env sh -DB_PATH="$1" -shift +create_table() { + sqlite3 "$DB_PATH" "CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT);" + sqlite3 "$DB_PATH" "CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path);" +} get_title() { FILE="$1" - PATTERN=".*\(Autoconf Archive\).*" - - #Find pattern in file - grep -Eo "$PATTERN" "$FILE" | - #Remove tag - sed 's/<[^>]*>//g' | \ - #Remove '(automake)' + pup -p -f "$FILE" 'title text{}' | \ sed 's/(Autoconf Archive)//g' | \ - #Remove trailing space - sed 's/[ ]*$//g' | \ - #Replace '&' with '&' - sed 's/&/&/g' | \ - #Replace '<' with '<' - sed 's/</