From ae0f48672efc07631a6b26ab53ef8df358530530 Mon Sep 17 00:00:00 2001 From: Clemens Radermacher Date: Mon, 4 May 2020 09:13:31 +0200 Subject: Fix link label parsing for imenu --- nov.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'nov.el') 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)))) -- cgit v1.2.3