aboutsummaryrefslogtreecommitdiff
path: root/nov.el
diff options
context:
space:
mode:
authorClemens Radermacher <clemera@posteo.net>2020-05-04 09:13:31 +0200
committerClemens Radermacher <clemera@posteo.net>2020-05-04 11:32:45 +0200
commitae0f48672efc07631a6b26ab53ef8df358530530 (patch)
tree15abf213e6b66608df61775a1ad9dc3025d750c1 /nov.el
parent03776c62c995682455267851617461c1ecf3217b (diff)
Fix link label parsing for imenu
Diffstat (limited to 'nov.el')
-rw-r--r--nov.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/nov.el b/nov.el
index e7279e6..634c902 100644
--- a/nov.el
+++ b/nov.el
@@ -867,6 +867,7 @@ See also `nov-bookmark-make-record'."
(defun nov-imenu-create-index ()
"Generate Imenu index."
+ (require 'esxml)
(let* ((toc-path (cdr (aref nov-documents 0)))
(ncxp (version< nov-epub-version "3.0"))
(toc (with-temp-buffer
@@ -877,7 +878,8 @@ See also `nov-bookmark-make-record'."
(mapcar
(lambda (node)
(-let* ((href (esxml-node-attribute 'href node))
- (label (car (esxml-node-children node)))
+ (label (mapconcat 'string-trim-whitespace
+ (esxml-find-descendants #'stringp node) " "))
((filename target) (nov-url-filename-and-target href)))
(list label filename 'nov-imenu-goto-function target)))
(esxml-query-all "a" toc))))