[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/kiwix 801c924 2/7: Make elquery optional by use Emacs b
From: |
Stefan Monnier |
Subject: |
[elpa] externals/kiwix 801c924 2/7: Make elquery optional by use Emacs built-in library libxml and dom |
Date: |
Wed, 11 Aug 2021 15:58:43 -0400 (EDT) |
branch: externals/kiwix
commit 801c9246a029d6fb0673fc4eea6cb61bd2651849
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>
Make elquery optional by use Emacs built-in library libxml and dom
---
kiwix.el | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/kiwix.el b/kiwix.el
index d715180..0572e56 100644
--- a/kiwix.el
+++ b/kiwix.el
@@ -61,6 +61,7 @@
(require 'subr-x)
(require 'thingatpt)
(require 'json)
+(require 'dom)
(declare-function helm "helm")
(declare-function helm-build-async-source "helm")
@@ -155,8 +156,23 @@ Set it to ‘t’ will use Emacs built-in ‘completing-read’."
:type "GET"
:sync t
:parser (lambda ()
- (if (not (featurep 'elquery))
- (print "PLACEHOLDER: use libxml by default")
+ (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">
+ ))))
(require 'elquery)
(let ((html (elquery-read-string
(buffer-substring-no-properties (point-min)
(point-max)))))
- [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 <=
- [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, 2021/08/11
- [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