diff options
author | jao <jao@gnu.org> | 2022-07-31 23:23:11 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-07-31 23:23:11 +0100 |
commit | 2a35dd02d97b72a9c6e12bbb2a5540d2ce9a3e5f (patch) | |
tree | f46e302f70e4e7e55eabed8692043cf17340f6d6 /lib/doc | |
parent | f8e9b2e6099dd569e971b32c3a733ea8e5e0952d (diff) | |
download | elibs-2a35dd02d97b72a9c6e12bbb2a5540d2ce9a3e5f.tar.gz elibs-2a35dd02d97b72a9c6e12bbb2a5540d2ce9a3e5f.tar.bz2 |
doc-view: better regexp for parsing TOCs
Diffstat (limited to 'lib/doc')
-rw-r--r-- | lib/doc/jao-doc-view.el | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/doc/jao-doc-view.el b/lib/doc/jao-doc-view.el index b8fbe1b..03fd5c1 100644 --- a/lib/doc/jao-doc-view.el +++ b/lib/doc/jao-doc-view.el @@ -101,6 +101,9 @@ (image-set-window-vscroll (round (/ (* height (cdr (pdf-view-image-size))) (frame-char-height)))))) +(defvar jao-doc-view--outline-rx + ".+\\(\t+\\)\"\\(.+\\)\"\t#\\(?:page=\\)?\\([0-9]+\\)") + (defun jao-doc-view-pdf-outline (&optional file-name) (if (derived-mode-p 'pdf-view-mode) (pdf-info-outline) @@ -110,7 +113,7 @@ (with-temp-buffer (insert (shell-command-to-string (format "mutool show %s outline" fn))) (goto-char (point-min)) - (while (re-search-forward ".+\\(\t+\\)\"\\(.+\\)\"\t#\\([0-9]+\\)," nil t) + (while (re-search-forward jao-doc-view--outline-rx nil t) (push `((level . ,(length (match-string 1))) (title . ,(match-string 2)) (page . ,(string-to-number (match-string 3)))) |