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

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

[elpa] externals/kiwix 6e85607 066/192: validate query is english or non


From: Stefan Monnier
Subject: [elpa] externals/kiwix 6e85607 066/192: validate query is english or non-english.
Date: Sat, 19 Dec 2020 00:41:34 -0500 (EST)

branch: externals/kiwix
commit 6e856073c484af71c1e1cb6fbbe1e2225715bd5e
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@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

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