From 7cea566a9616f1300cfc2728acf664ac5bd89bd8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 24 Jul 2023 13:58:09 +1000 Subject: Add search. - For mediawiki sites, use API search. - For non-mediawiki sites, use eww. - Now it depends on a new library `generic-search.el'. --- wiki-utils.el | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'wiki-utils.el') 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.") -- cgit v1.2.3