[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 3dab002 077/192: only capitalize the first word o
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 3dab002 077/192: only capitalize the first word of string. |
Date: |
Sat, 19 Dec 2020 00:41:37 -0500 (EST) |
branch: externals/kiwix
commit 3dab002df874b4a9d64b05270827a8a903066133
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
only capitalize the first word of string.
---
kiwix.el | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index 30f3905..3adc442 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -159,18 +159,29 @@
(async-shell-command
(concat kiwix-server-command library port daemon (shell-quote-argument
library-path)))))
+(defun kiwix-capitalize-first (string)
+ "Only capitalize the first word of STRING."
+ (concat
+ (string (upcase (aref string 0)))
+ (substring string 1))
+ )
(defun kiwix-query (query &optional library)
"Search `QUERY' in `LIBRARY' with Kiwix."
(let* ((kiwix-library (if library
library
(kiwix-get-library-fullname "default")))
- (url (concat kiwix-server-url kiwix-library "/A/"
- ;; query need to be convert to URL encoding: "禅宗"
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
- (url-encode-url
- ;; convert space to underline: "Beta distribution"
"Beta_distribution"
- (replace-regexp-in-string " " "_" (capitalize query)
nil nil))
- ".html")))
+ (url (concat
+ kiwix-server-url kiwix-library "/A/"
+ ;; query need to be convert to URL encoding: "禅宗"
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
+ (url-encode-url
+ ;; convert space to underline: "Beta distribution"
"Beta_distribution"
+ (replace-regexp-in-string
+ " " "_"
+ ;; only capitalize the first word. like: "meta-circular
interpreter" -> "Meta-circular interpreter"
+ (kiwix-capitalize-first query)
+ nil nil))
+ ".html")))
(browse-url url)))
;;;###autoload
@@ -248,8 +259,11 @@ for query string and library interactively."
;; query need to be convert to URL encoding: "禅宗"
https://zh.wikipedia.org/wiki/%E7%A6%85%E5%AE%97
(url-encode-url
;; convert space to underline: "Beta distribution"
"Beta_distribution"
- (replace-regexp-in-string " " "_"
- (capitalize query) nil nil))
+ (replace-regexp-in-string
+ " " "_"
+ ;; only capitalize the first word. like: "meta-circular
interpreter" -> "Meta-circular interpreter"
+ (kiwix-capitalize-first query)
+ nil nil))
".html")))
;; (prin1 (format "library: %s, query: %s, url: %s" library query url))
(browse-url url))))
- [elpa] externals/kiwix d9bab20 074/192: Merge branch 'release/v0.5.1', (continued)
- [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, 2020/12/19
- [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 <=
- [elpa] externals/kiwix 6fb8354 078/192: Merge branch 'release/v0.5.2', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 43e0547 083/192: Merge branch 'release/v0.6.0', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6a7fc40 097/192: Merge branch 'hotfix/void-function-org-link-set-parameters-2', Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 2ab63c9 098/192: Merge tag 'void-function-org-link-set-parameters-2' into develop, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 6e43812 102/192: fix void functions by adding autoload cookies., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 5aa6c3a 105/192: `string-empty-p` depends on (emacs "24.4"), Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 86dbead 107/192: add a helper function to detect kiwix profile directory accessible., Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 44a44cb 110/192: autoload org related functions, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix f7535e0 112/192: format code, remove dangling parentheses, Stefan Monnier, 2020/12/19
- [elpa] externals/kiwix 183b133 114/192: update usage comments, Stefan Monnier, 2020/12/19