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 --- src/index.sh | 65 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 35 deletions(-) (limited to 'src') 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/</