emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/kiwix 634b5ae 061/192: enhance function kiwix-query to


From: Stefan Monnier
Subject: [elpa] externals/kiwix 634b5ae 061/192: enhance function kiwix-query to support space between strings.
Date: Sat, 19 Dec 2020 00:41:33 -0500 (EST)

branch: externals/kiwix
commit 634b5ae0d1c79d8b3f1c0a34a8737ad9dea1b4a5
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    enhance function kiwix-query to support space between strings.
---
 kiwix.el | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index bac104a..3865f96 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -164,7 +164,12 @@
   (let* ((kiwix-library (if library
                             library
                           (kiwix-get-library-fullname "default")))
-         (url (concat kiwix-server-url kiwix-library "/A/" (url-encode-url 
(capitalize query)) ".html")))
+         (url (concat kiwix-server-url kiwix-library "/A/"
+                      ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+                      (url-encode-url
+                       ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+                       (replace-regexp-in-string " " "_" (capitalize query) 
nil nil))
+                      ".html")))
     (browse-url url)))
 
 ;;;###autoload
@@ -234,11 +239,13 @@ for query string and library interactively."
                  kiwix-server-url
                  library "/A/"
                  ;; query need to be convert to URL encoding: "禅宗" 
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
-                 (url-encode-url (capitalize query))
+                 (url-encode-url
+                  ;; convert space to underline: "Beta distribution" 
"Beta_distribution"
+                  (replace-regexp-in-string " " "_"
+                                            (capitalize query) nil nil))
                  ".html")))
       ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
-      (browse-url url))
-    ))
+      (browse-url url))))
 
 (defun org-wiki-link-export (link description format)
   "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]