From f89cba1a1be0704299bee862ea54bd1983db1ac2 Mon Sep 17 00:00:00 2001 From: Vasilij Schneidermann Date: Sun, 24 Sep 2017 14:12:05 +0200 Subject: Accept optional url argument when rendering images --- nov.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'nov.el') diff --git a/nov.el b/nov.el index ae17b07..31287e4 100644 --- a/nov.el +++ b/nov.el @@ -429,16 +429,16 @@ This function honors `shr-max-image-proportion' if possible." (defvar nov-original-shr-tag-img-function (symbol-function 'shr-tag-img)) -(defun nov-render-img (dom) +(defun nov-render-img (dom &optional url) "Custom rendering function for DOM. Uses `shr-tag-img' for external paths and `nov-insert-image' for internal ones." - (let ((url (cdr (assq 'src (cadr dom))))) + (let ((url (or url (cdr (assq 'src (cadr dom)))))) (if (nov-external-url-p url) ;; HACK: avoid hanging in an infinite loop when using ;; `cl-letf' to override `shr-tag-img' with a function that ;; might call `shr-tag-img' again - (funcall nov-original-shr-tag-img-function dom) + (funcall nov-original-shr-tag-img-function dom url) (setq url (expand-file-name url)) (nov-insert-image url)))) -- cgit v1.2.3