aboutsummaryrefslogtreecommitdiff
path: root/wiki-utils.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-24 13:58:09 +1000
committerYuchen Pei <id@ypei.org>2023-07-24 13:58:09 +1000
commit7cea566a9616f1300cfc2728acf664ac5bd89bd8 (patch)
treeae65e5d7d160bca38a6783f791a3ac8dbc620aa0 /wiki-utils.el
parent78672bd3ccd71e36cd99d57b244213a37a8bf32e (diff)
Add search.
- For mediawiki sites, use API search. - For non-mediawiki sites, use eww. - Now it depends on a new library `generic-search.el'.
Diffstat (limited to 'wiki-utils.el')
-rw-r--r--wiki-utils.el21
1 files changed, 18 insertions, 3 deletions
diff --git a/wiki-utils.el b/wiki-utils.el
index fd5a0bc..043602b 100644
--- a/wiki-utils.el
+++ b/wiki-utils.el
@@ -110,15 +110,30 @@ Assuming the current buffer to be a `url-retrieve' response buffer."
"Alist of wiki sites.
Each item is in the form of (identifier . properties), where
-identifier is a symbol, and properties is a plist of the site.
-One of the sites is (local), meaning a local filesystem.")
-
+identifier is a symbol, and properties is a plist of site
+properties. One of the sites is (local), meaning a local
+filesystem.
+
+The only mandatory field is `:host'. All other fields, i.e.
+`:engine', `:base-url', `:api-base-url', `display-name' may be
+computed from `wiki-engine-compute-engine',
+`wiki-engine-compute-base-url',
+`wiki-engine-compute-api-base-url', or
+`wiki-engine-compute-display-name'.")
+
+;; FIXME: does it make sense to fallback to wiki-find-file here?
(defun wiki-site-fetcher (site-id)
"Return the fetcher function for wiki site with SITE-ID."
(if site-id
(intern (format "wiki-%s-fetch" site-id))
'wiki-find-file))
+(defun wiki-site-searcher (site-id)
+ "Return the fetcher function for wiki site with SITE-ID."
+ (if site-id
+ (intern (format "wiki-%s-search" site-id))
+ (error "Unknown site id: %s" site-id)))
+
(defvar wiki-client-buffer-name "*wiki api*"
"Name of the buffer recording wiki API calls.")