diff options
-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)))) |