[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix ea54acf 080/192: extract get org-mode link librar
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix ea54acf 080/192: extract get org-mode link library to a single function |
Date: |
Sat, 19 Dec 2020 00:41:37 -0500 (EST) |
branch: externals/kiwix
commit ea54acff23aa93d474a5d71812ff36c051b78b0f
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
extract get org-mode link library to a single function
---
kiwix.el | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index f3936db..d5211b7 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -246,19 +246,23 @@ for query string and library interactively."
;; - group 2: link? (match everything but ], space, tab, carriage return,
linefeed by using [^] \n\t\r]*)
;; for open wiki search query with local application database.
+(defun kiwix-org-get-library ()
+ "Get library from Org-mode link."
+ (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 kiwix-your-language-library)
+ )
+ )
+
(defun org-wiki-link-open (link)
"Open LINK in external wiki program."
;; The regexp: (library):query
;; - query : should not exclude space
(when (string-match "\\(?:(\\(.*\\)):\\)?\\([^]\n\t\r]*\\)" link) ;
(library):query
- (let* (
- (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 kiwix-your-language-library)
- ))
+ (let* ((library (kiwix-org-get-library))
(query (match-string 2 link))
(url (concat
kiwix-server-url
@@ -278,8 +282,7 @@ for query string and library interactively."
(defun org-wiki-link-export (link description format)
"Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
(when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)" link)
- (let* ((library (or (match-string 1 link)
- (kiwix-get-library-fullname "default")))
+ (let* ((library (kiwix-org-get-library))
(query (url-encode-url (or (match-string 2 link) description)))
;; "http://en.wikipedia.org/wiki/Linux"
;; --
- [elpa] externals/kiwix 19bfe4f 051/192: add an option to let kiwix-at-point search interactively, (continued)
- [elpa] externals/kiwix 19bfe4f 051/192: add an option to let kiwix-at-point search interactively, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix d4fbf7b 052/192: define function ahead, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f1554ba 054/192: fix some default library abbr name., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4968e3d 055/192: error when query is invalid., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 1b9f25b 056/192: add interactively called function., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 2e2d64d 059/192: Merge tag 'v0.4.3' into develop, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 8855ac4 060/192: delete deprecated source code files., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix fb83985 062/192: Merge branch 'master' into develop, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 45cc8ef 067/192: add some links test., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix d9bab20 074/192: Merge branch 'release/v0.5.1', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix ea54acf 080/192: extract get org-mode link library to a single function,
Stefan Monnier <=
- [elpa] externals/kiwix 49fdf02 079/192: add custom option for specifying your native language library, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5cba3b5 081/192: add a test for only capitalize the first word, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 4102205 086/192: load for `org-link-set-parameters', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 7b8a799 088/192: Merge tag 'void-function_org-link-set-parameters' into develop, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix e600844 089/192: fix kiwix does not contain group., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 121d98a 093/192: fix void function org-link-set-parameters., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 686bac6 068/192: fix query validating regexp, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 47d968a 069/192: update add org-mode link functions to Org-mode 9.0, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 3dab002 077/192: only capitalize the first word of string., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6fb8354 078/192: Merge branch 'release/v0.5.2', Stefan Monnier, 2020/12/19