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

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

[elpa] externals/kiwix edea223 100/192: Merge branch 'release/0.7.0'


From: Stefan Monnier
Subject: [elpa] externals/kiwix edea223 100/192: Merge branch 'release/0.7.0'
Date: Sat, 19 Dec 2020 00:41:41 -0500 (EST)

branch: externals/kiwix
commit edea2234a7a5267c1888dbe2271e9100bdc3f5a8
Merge: 6a7fc40 57150a7
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    Merge branch 'release/0.7.0'
---
 README.org | 11 ++++++-----
 kiwix.el   | 36 ++++++++++++++++++------------------
 2 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/README.org b/README.org
index f1e4799..79bca25 100644
--- a/README.org
+++ b/README.org
@@ -74,14 +74,15 @@ with RESTful API.
 The link format is like this:
 
 #+BEGIN_EXAMPLE
-[[wiki:(library):search][description]]
+[[wikipedia:(library):search][description]]
 #+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
-- [[wiki:meta-circular%20interpreter][meta-circular interpreter]] :: only 
capitalize the first word.
+- [[wikipedia:Operations%20Research][Operations Research]] :: query contains 
space.
+- [[wikipedia:Operations%20research][Operations research]] :: the second word 
is not capitalized.
+- [[wikipedia:%E4%B8%AD%E5%9B%BD][中国]] :: non-english query
+- [[wikipedia:meta-circular%20interpreter][meta-circular interpreter]] :: only 
capitalize the first word.
diff --git a/kiwix.el b/kiwix.el
index 1ac9259..a5ec5c7 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -234,13 +234,13 @@ for query string and library interactively."
 
 ;;; Support Org-mode
 ;;
-;; - [[wiki:(library):query]]
-;; - [[wiki:query]]
+;; - [[wikipedia:(library):query]]
+;; - [[wikipedia:query]]
 ;;
 ;; links:
-;; - wiki:(zh):%E7%A6%85%E5%AE%97
-;; - wiki:(en):linux
-;; - wiki:linux
+;; - wikipedia:(zh):%E7%A6%85%E5%AE%97
+;; - wikipedia:(en):linux
+;; - wikipedia:linux
 ;;
 ;; - parameter `link' will be (en):linux" or linux".
 ;;
@@ -261,8 +261,8 @@ for query string and library interactively."
     )
   )
 
-(defun org-wiki-link-open (link)
-  "Open LINK in external wiki program."
+(defun org-wikipedia-link-open (link)
+  "Open LINK in external Wikipedia program."
   ;; The regexp: (library):query
   ;; - query : should not exclude space
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^]\n\t\r]*\\)"  link) ; 
(library):query
@@ -283,8 +283,8 @@ for query string and library interactively."
       ;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
       (browse-url url))))
 
-(defun org-wiki-link-export (link description format)
-  "Export the wiki LINK with DESCRIPTION for FORMAT from Org files."
+(defun org-wikipedia-link-export (link description format)
+  "Export the Wikipedia LINK with DESCRIPTION for FORMAT from Org files."
   (when (string-match "\\(?:(\\(.*\\)):\\)?\\([^] \n\t\r]*\\)" link)
     (let* ((library (kiwix-org-get-library))
            (query (url-encode-url (or (match-string 2 link) description)))
@@ -299,16 +299,16 @@ for query string and library interactively."
          ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
          (t path))))))
 
-(defun org-wiki-store-link ()
-  "Store a link to a wiki link."
+(defun org-wikipedia-store-link ()
+  "Store a link to a Wikipedia link."
   ;; [C-c o C-l l] `org-store-link'
   ;; remove those interactive functions. use normal function instead.
   (when (eq major-mode 'wiki-mode)
     (let* ((query (read-string "Wikipedia Query with Kiwix: "))
            (library (kiwix-select-library-name))
-           (link (concat "wiki:" "(" library "):" query)))
+           (link (concat "wikipedia:" "(" library "):" query)))
       (org-store-link-props
-       :type "wiki"
+       :type "wikipedia"
        :link link
        :description query))))
 
@@ -316,11 +316,11 @@ for query string and library interactively."
 (with-eval-after-load "org"
   (if kiwix-support-org-mode-link
       (progn
-        (org-link-set-parameters "wiki"
-                                 :follow #'org-wiki-link-open
-                                 :store #'org-wiki-store-link
-                                 :export #'org-wiki-link-export)
-        (add-hook 'org-store-link-functions 'org-wiki-store-link t)
+        (org-link-set-parameters "wikipedia"
+                                 :follow #'org-wikipedia-link-open
+                                 :store #'org-wikipedia-store-link
+                                 :export #'org-wikipedia-link-export)
+        (add-hook 'org-store-link-functions 'org-wikipedia-store-link t)
 
         ;; [[Wikipedia_Local:]]
         ;; (if (and



reply via email to

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