summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Info.plist14
-rw-r--r--src/icon.pngbin1617 -> 0 bytes
-rwxr-xr-xsrc/index-pages.py25
-rwxr-xr-xsrc/index.sh43
4 files changed, 25 insertions, 57 deletions
diff --git a/src/Info.plist b/src/Info.plist
deleted file mode 100644
index 36517aa..0000000
--- a/src/Info.plist
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleIdentifier</key>
- <string>gnucodingstandards</string>
- <key>CFBundleName</key>
- <string>GNU Coding Standards</string>
- <key>DocSetPlatformFamily</key>
- <string>gnustandards</string>
- <key>isDashDocset</key>
- <true/>
-</dict>
-</plist>
diff --git a/src/icon.png b/src/icon.png
deleted file mode 100644
index 9b18522..0000000
--- a/src/icon.png
+++ /dev/null
Binary files differ
diff --git a/src/index-pages.py b/src/index-pages.py
new file mode 100755
index 0000000..6dee7d0
--- /dev/null
+++ b/src/index-pages.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python3
+
+import os
+import re
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "scripts"))
+from create_table import create_table
+from get_title import get_title
+from insert import insert
+
+def insert_page(db_path, html_path):
+ page_name = get_title(html_path)
+ page_name = page_name.replace('(GNU Coding Standards)', '')
+
+ page_type = "Guide"
+
+ insert(db_path, page_name, page_type, os.path.basename(html_path))
+
+if __name__ == '__main__':
+ db_path = sys.argv[1]
+
+ create_table(db_path)
+ for html_path in sys.argv[2:]:
+ insert_page(db_path, html_path)
diff --git a/src/index.sh b/src/index.sh
deleted file mode 100755
index 75f20a5..0000000
--- a/src/index.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env sh
-
-DB_PATH="$1"
-shift
-
-get_title() {
- FILE="$1"
-
- PATTERN="<title>.*\(GNU Coding Standards\).*</title>"
-
- #Find pattern in file
- grep -Eo "$PATTERN" "$FILE" |
- #Remove tag
- sed 's/<[^>]*>//g' | \
- #Remove '(automake)'
- sed 's/(GNU Coding Standards)//g' | \
- #Remove trailing space
- sed 's/[ ]*$//g' | \
- #Replace '&amp' with '&'
- sed 's/&amp/&/g'
-}
-
-insert() {
- NAME="$1"
- TYPE="$2"
- PAGE_PATH="$3"
-
- sqlite3 "$DB_PATH" "INSERT INTO searchIndex(name, type, path) VALUES (\"$NAME\",\"$TYPE\",\"$PAGE_PATH\");"
-}
-
-# 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 and insert into table for each html file
-while [ -n "$1" ]; do
- unset PAGE_NAME
- PAGE_NAME="$(get_title "$1")"
- if [ -n "$PAGE_NAME" ]; then
- insert "$PAGE_NAME" "Guide" "$(basename "$1")"
- fi
- shift
-done