diff options
author | Vasilij Schneidermann <mail@vasilij.de> | 2017-09-24 14:12:05 +0200 |
---|---|---|
committer | Vasilij Schneidermann <mail@vasilij.de> | 2017-09-24 14:12:05 +0200 |
commit | f89cba1a1be0704299bee862ea54bd1983db1ac2 (patch) | |
tree | 6fbd1af839677397845bdad6f96a42604ac76a8d | |
parent | ec322b439108ffb69ee0010944d4eb502c9f13d5 (diff) |
Accept optional url argument when rendering images
-rw-r--r-- | nov.el | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 <img> 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)))) |