diff options
Diffstat (limited to 'wiki-engine.el')
| -rw-r--r-- | wiki-engine.el | 17 | 
1 files changed, 12 insertions, 5 deletions
diff --git a/wiki-engine.el b/wiki-engine.el index a201c72..fb6fcba 100644 --- a/wiki-engine.el +++ b/wiki-engine.el @@ -90,13 +90,20 @@ The site name is passed as a symbol WIKI-SITE."  (defun-wiki-fetchers)  (defun wiki-open-url (url) -  "Open the wiki corresponding to URL. +  "Open the raw wiki corresponding to the URL of a html wiki page. -If URL points to html title, open the corresponding raw title. -If URL points to a raw title, open directly. -If URL points to a host, assume it is mediawiki try to open main page." +If URL points to html title, open the corresponding raw title."    (interactive "sURL: ") -   +  (when-let +      ((found-site +        (seq-find +         (lambda (site-pair) +           (when-let ((base-url (plist-get (cdr site-pair) :base-url))) +             (string-prefix-p base-url url))) +         wiki-sites))) +    (pcase-let ((`(,site-id . ,site-info) found-site)) +      (funcall (wiki-site-fetcher site-id) +               (string-remove-prefix (plist-get site-info :base-url) url))))    )  (provide 'wiki-engine)  | 
