branch: externals/kiwix
commit 6e856073c484af71c1e1cb6fbbe1e2225715bd5e
Author: stardiviner <numbch...@gmail.com>
Commit: stardiviner <numbch...@gmail.com>

    validate query is english or non-english.
---
 kiwix.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/kiwix.el b/kiwix.el
index fea0143..7480bdb 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -233,9 +233,15 @@ for query string and library interactively."
   ;; - query : should not exclude space
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^]\n\t\r]*\\)"  link) ; 
(library):query
     (let* (
-           ;; convert between libraries full name and abbrev.
-           (library (kiwix-get-library-fullname (or (match-string 1 link)
-                                                    "default")))
+           (library (if (string-match-p "\\`[a-zA-Z\ ]+\\'"
+                                        ;; query
+                                        (match-string 2 link)) ; validate 
query is English
+                        ;; convert between libraries full name and abbrev.
+                        (kiwix-get-library-fullname (or (match-string 1 link)
+                                                        "default"))
+                      ;; validate query is non-English
+                      (kiwix-get-library-fullname "zh")
+                      ))
            (query (match-string 2 link))
            (url (concat
                  kiwix-server-url

Reply via email to