summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-09-19 15:16:16 -0400
committerLouie S <louie@example.com>2023-09-19 15:16:16 -0400
commit1866dd507d0e36ef4cadef454424865358f435ca (patch)
treeed4976f629d3fee65eb946cae485ec8f4d70c7da
parent24630a5f215cfc949bac6faa9864b8ed29ee4594 (diff)
NSIS docsetHEADmaster
-rw-r--r--.gitignore2
-rw-r--r--Makefile20
-rw-r--r--README17
-rw-r--r--README.md33
-rw-r--r--README.template17
-rw-r--r--manual_src/manual.tar.gzbin0 -> 286696 bytes
-rw-r--r--src/Info.plist8
-rw-r--r--src/icon.pngbin0 -> 1241 bytes
-rw-r--r--src/icon@2x.pngbin0 -> 2754 bytes
-rw-r--r--src/icon_orig.pngbin0 -> 2410 bytes
-rwxr-xr-xsrc/index_sub_pages.sh25
-rw-r--r--src/lib/insert2
12 files changed, 64 insertions, 60 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0ba0ba8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+NSIS*
+tmp
diff --git a/Makefile b/Makefile
index 9339745..0b10046 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-#DOCSET_NAME = ...
+DOCSET_NAME = NSIS
DOCSET_DIR = $(DOCSET_NAME).docset
CONTENTS_DIR = $(DOCSET_DIR)/Contents
@@ -8,12 +8,13 @@ DOCUMENTS_DIR = $(RESOURCES_DIR)/Documents
INFO_PLIST_FILE = $(CONTENTS_DIR)/Info.plist
INDEX_FILE = $(RESOURCES_DIR)/docSet.dsidx
ICON_FILE = $(DOCSET_DIR)/icon.png
+ICON_FILE_2X = $(DOCSET_DIR)/icon@2x.png
ARCHIVE_FILE = $(DOCSET_NAME).tgz
-#SRC_ICON = src/icon.png
+SRC_ICON = src/icon.png
+SRC_ICON_2X = src/icon@2x.png
-#MANUAL_URL = ...
-#MANUAL_FILE = tmp/...
+MANUAL_FILE = manual_src/manual.tar.gz
ERROR_DOCSET_NAME = $(error DOCSET_NAME is unset)
WARNING_MANUAL_URL = $(warning MANUAL_URL is unset)
@@ -38,6 +39,9 @@ DOCSET = $(INFO_PLIST_FILE) $(INDEX_FILE)
ifdef SRC_ICON
DOCSET += $(ICON_FILE)
endif
+ifdef SRC_ICON_2X
+DOCSET += $(ICON_FILE_2X)
+endif
all: $(DOCSET)
@@ -73,7 +77,11 @@ $(INFO_PLIST_FILE): src/Info.plist $(CONTENTS_DIR)
$(INDEX_FILE): src/index.sh $(DOCUMENTS_DIR)
rm -f $@
- src/index.sh $@ $(DOCUMENTS_DIR)/*.html
+ src/index.sh $@ $(DOCUMENTS_DIR)/Docs/*.html
+ src/index_sub_pages.sh $@ $(DOCUMENTS_DIR)/Docs/Contents.html
-$(ICON_FILE): src/icon.png $(DOCSET_DIR)
+$(ICON_FILE): $(SRC_ICON) $(DOCSET_DIR)
cp $(SRC_ICON) $@
+
+$(ICON_FILE_2X): $(SRC_ICON_2X) $(DOCSET_DIR)
+ cp $(SRC_ICON_2X) $@
diff --git a/README b/README
new file mode 100644
index 0000000..31cd789
--- /dev/null
+++ b/README
@@ -0,0 +1,17 @@
+Here is a script and a Makefile for generating a NSIS (Nullsoft Scriptable Install System) docset for Dash. The script is based on the dash-docset-generation-template
+
+- NSIS: https://nsis.sourceforge.io/
+- Dash: https://kapeli.com/dash
+- dash-docset-generation-template: https://github.com/lshprung/dash-docset-generation-template
+
+To generate a docset from the latest edition of the NSIS Manual, simply
+execute `make` from the same directory as this README file.
+The manual's source is included as in this project's source tree, and is
+originally sourced from Debian's nsis-doc package.
+
+Requirements:
+
+- any POSIX-compliant shell
+- make - https://www.gnu.org/software/make/
+- pup - https://github.com/ericchiang/pup
+- sqlite3 - https://www.sqlite.org/index.html
diff --git a/README.md b/README.md
deleted file mode 100644
index 774f7de..0000000
--- a/README.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# Dash Docset Template
-
-This is a repository providing a template to package a Dash docset from HTML source documentation. Files that need to be manually configured are listed below. Additional fine tuning is also recommended, depending on the quirks of the documentation being packaged. An example docset packaging script for GNU Make using this template can be seen [here](https://github.com/lshprung/gnu-make-dash-docset)
-
-### `README.template`
-
-This file will provide a README for the packaging script. Replace `<NAME>`, `<UPSTREAM LINK>`, and `<UPSTREAM HOST>` with appropriate values.
-
-### `Makefile`
-
-This file will build the docset.
-
-- `DOCSET_NAME` must be set
-- `MANUAL_FILE` must be set
- - If the script should download documentation from the internet, `MANUAL_URL` must also be set. If not, ensure a `.tgz` archive of the HTML documentation exists at `tmp/MANUAL.tgz` (where MANUAL is the name of the archive)
-
-### `src/icon.png`
-
-If you want to associate an icon with the docset, it should be saved to `src/icon.png`. Make sure to uncomment the corresponding line in `Makefile` to include the icon in the docset.
-
-### `src/index.sh`
-
-This is the main script that builds the docset index. This script does not require any manual modifications, but you will probably want to make additions/changes to improve the quality of your docset and accomodate any quirks.
-
-### `src/Info.plist`
-
-This file contains metadata for the docset. Replace `<!-- VALUE -->` with appropriate values. It may be useful to refer to the `Info.plist` file of an existing docset for reference.
-
----
-
-### Credits
-
-Created by [lshprung](https://github.com/lshprung), and originally based on [benzado](https://github.com/benzado)'s [gnu-make-dash-docset](https://github.com/benzado/gnu-make-dash-docset).
diff --git a/README.template b/README.template
deleted file mode 100644
index 5d08037..0000000
--- a/README.template
+++ /dev/null
@@ -1,17 +0,0 @@
-Here is a script and a Makefile for generating a <NAME> docset for Dash. The script is based on the dash-docset-generation-template
-
-- <NAME>: <UPSTREAM LINK>
-- Dash: https://kapeli.com/dash
-- dash-docset-generation-template: https://github.com/lshprung/dash-docset-generation-template
-
-To generate a docset from the latest edition of the <NAME> Manual, simply
-execute `make` from the same directory as this README file. The latest edition
-will be downloaded from <UPSTREAM HOST> and packaged appropriately.
-
-Requirements:
-
-- any POSIX-compliant shell
-- curl - https://curl.se/
-- make - https://www.gnu.org/software/make/
-- pup - https://github.com/ericchiang/pup
-- sqlite3 - https://www.sqlite.org/index.html
diff --git a/manual_src/manual.tar.gz b/manual_src/manual.tar.gz
new file mode 100644
index 0000000..18e04ad
--- /dev/null
+++ b/manual_src/manual.tar.gz
Binary files differ
diff --git a/src/Info.plist b/src/Info.plist
index 111baae..4b831c3 100644
--- a/src/Info.plist
+++ b/src/Info.plist
@@ -3,11 +3,13 @@
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
- <string><!-- VALUE --></string>
+ <string>NSIS</string>
<key>CFBundleName</key>
- <string><!-- VALUE --></string>
+ <string>NSIS</string>
<key>DocSetPlatformFamily</key>
- <string><!-- VALUE --></string>
+ <string>nsis</string>
+ <key>dashIndexFilePath</key>
+ <string>Docs/Contents.html</string>
<key>isDashDocset</key>
<true/>
</dict>
diff --git a/src/icon.png b/src/icon.png
new file mode 100644
index 0000000..db5e987
--- /dev/null
+++ b/src/icon.png
Binary files differ
diff --git a/src/icon@2x.png b/src/icon@2x.png
new file mode 100644
index 0000000..c9288a3
--- /dev/null
+++ b/src/icon@2x.png
Binary files differ
diff --git a/src/icon_orig.png b/src/icon_orig.png
new file mode 100644
index 0000000..14ccc71
--- /dev/null
+++ b/src/icon_orig.png
Binary files differ
diff --git a/src/index_sub_pages.sh b/src/index_sub_pages.sh
new file mode 100755
index 0000000..9a3c8c3
--- /dev/null
+++ b/src/index_sub_pages.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env sh
+
+# shellcheck source=./lib/create_table
+. "$(dirname "$0")"/lib/create_table
+# shellcheck source=./lib/insert
+. "$(dirname "$0")"/lib/insert
+
+DB_PATH="$1"
+shift
+CONTENTS="$1"
+shift
+
+insert_sub_page() {
+ LINK="$1"
+ NAME="$(echo "$LINK" | pup -p 'a text{}' | sed 's/\"\"//g' | tr -d \\n)"
+ PAGE_PATH="$(echo "$LINK" | pup -p 'a attr{href}')"
+
+ insert "$DB_PATH" "$NAME" "Guide" "$PAGE_PATH"
+}
+
+create_table "$DB_PATH"
+
+grep -Eo "<li><a href.*</a></li>" "$CONTENTS" | while read -r line; do
+ insert_sub_page "$line"
+done
diff --git a/src/lib/insert b/src/lib/insert
index 31c1b4c..8100c1e 100644
--- a/src/lib/insert
+++ b/src/lib/insert
@@ -4,5 +4,5 @@ insert() {
TYPE="$3"
PAGE_PATH="$4"
- sqlite3 "$DB_PATH" "INSERT INTO searchIndex(name, type, path) VALUES (\"$NAME\",\"$TYPE\",\"$PAGE_PATH\");"
+ sqlite3 "$DB_PATH" "INSERT INTO searchIndex(name, type, path) VALUES (\"$NAME\",\"$TYPE\",\"Docs/$PAGE_PATH\");"
}