[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 33cfe42 4/7: Use cond structure is better
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 33cfe42 4/7: Use cond structure is better |
Date: |
Wed, 11 Aug 2021 15:58:44 -0400 (EDT) |
branch: externals/kiwix
commit 33cfe42da29adda656bee3230e59b0aa7645b0db
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
Use cond structure is better
---
kiwix.el | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index 29ddd29..8f04dbf 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -156,23 +156,25 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
:type "GET"
:sync t
:parser (lambda ()
- (if (libxml-available-p) ; (and (not (featurep 'elquery))
(libxml-available-p))
- (let ((document (libxml-parse-html-region (point-min)
(point-max))))
- (setq kiwix-libraries
- (mapcar
- ;; remove "/" from "/<zim_library_name>"
- (lambda (slash_library)
- (substring slash_library 1 nil))
- ;; list of "/<zim_library_name>"
- (mapcar
- (lambda (a)
- (dom-attr a 'href))
- (dom-by-tag
- (dom-by-class
- (dom-by-class document "kiwix") ; <div
class="kiwix">
- "book__list") ; <div
class="book__list">
- 'a) ; <a
href="/wikipedia_zh_all_maxi_2021-03">
- ))))
+ (cond
+ ((libxml-available-p) ; (and (not (featurep 'elquery))
(libxml-available-p))
+ (let ((document (libxml-parse-html-region (point-min)
(point-max))))
+ (setq kiwix-libraries
+ (mapcar
+ ;; remove "/" from "/<zim_library_name>"
+ (lambda (slash_library)
+ (substring slash_library 1 nil))
+ ;; list of "/<zim_library_name>"
+ (mapcar
+ (lambda (a)
+ (dom-attr a 'href))
+ (dom-by-tag
+ (dom-by-class
+ (dom-by-class document "kiwix") ; <div
class="kiwix">
+ "book__list") ; <div
class="book__list">
+ 'a) ; <a
href="/wikipedia_zh_all_maxi_2021-03">
+ )))))
+ ((featurep 'elquery)
(require 'elquery)
(let ((html (elquery-read-string
(buffer-substring-no-properties (point-min)
(point-max)))))
@@ -189,7 +191,7 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
(elquery-children
;; return the <div
class="book__list">
(car (elquery-$ ".book__list"
html)))))))
- (elquery-children (first (elquery-$ ".book__list"
html))))))
+ (elquery-children (first (elquery-$ ".book__list"
html)))))))
:error (cl-function
(lambda (&rest args &key error-thrown &allow-other-keys)
(message "Function kiwix-get-libraries error.")))
- [elpa] externals/kiwix updated (71e770c -> 7d6039f), Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix 5616b66 6/7: Merge pull request #6 from zonuexe/patch-1, Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix 801c924 2/7: Make elquery optional by use Emacs built-in library libxml and dom, Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix edd8458 1/7: Make external library elquery optional, Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix 5f9cff3 5/7: Activate embedded HTML, Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix 33cfe42 4/7: Use cond structure is better,
Stefan Monnier <=
- [elpa] externals/kiwix 7d6039f 7/7: Fix org-kiwix void function incompatible which is behind API upgrade, Stefan Monnier, 2021/08/11
- [elpa] externals/kiwix 4f04ffd 3/7: Error: You should depend on (emacs "25.1") if you need ‘dom’., Stefan Monnier, 2021/08/11