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

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

[elpa] externals/kiwix 2d33910 072/192: Merge tag 'v0.5.0' into develop


From: Stefan Monnier
Subject: [elpa] externals/kiwix 2d33910 072/192: Merge tag 'v0.5.0' into develop
Date: Sat, 19 Dec 2020 00:41:36 -0500 (EST)

branch: externals/kiwix
commit 2d33910df0897903c126c2eb06526d8323a4159b
Merge: f84b449 3485131
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    Merge tag 'v0.5.0' into develop
    
    Support Org-mode 9.0
---
 README.org |  6 ++++++
 kiwix.el   | 14 ++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index f76677b..a7824e5 100644
--- a/README.org
+++ b/README.org
@@ -78,3 +78,9 @@ The link format is like this:
 #+END_EXAMPLE
 
 The =(library)= can be =wikipedia_en=, =wikipedia_zh=, =wiktionary_en=, or 
=en=, =zh= etc.
+
+* Test
+
+- [[wiki:Operations%20Research][Operations Research]] :: query contains space.
+- [[wiki:Operations%20research][Operations research]] :: the second word is 
not capitalized.
+- [[wiki:%E4%B8%AD%E5%9B%BD][中国]] :: non-english query
diff --git a/kiwix.el b/kiwix.el
index 3dd7c1a..4636c9b 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -229,11 +229,17 @@ for query string and library interactively."
 
 (defun org-wiki-link-open (link)
   "Open LINK in external wiki program."
-  (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)"  link) ; 
(library):query
+  ;; The regexp: (library):query
+  ;; - 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\ ]+" (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]