emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/htmlize 3ed76d8 065/134: Use find-image to find the actual


From: ELPA Syncer
Subject: [nongnu] elpa/htmlize 3ed76d8 065/134: Use find-image to find the actual location of the image file in image-load-path.
Date: Sat, 7 Aug 2021 09:17:08 -0400 (EDT)

branch: elpa/htmlize
commit 3ed76d89f0059de9033dcbc7ea1217e2c451ec60
Author: Hrvoje Niksic <hniksic@gmail.com>
Commit: Hrvoje Niksic <hniksic@gmail.com>

    Use find-image to find the actual location of the image file in 
image-load-path.
---
 htmlize.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/htmlize.el b/htmlize.el
index 2db0dc9..529fd79 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -451,9 +451,12 @@ next-single-char-property-change")))
 
 (defun htmlize-generate-image (imgprops)
   (cond ((plist-get imgprops :file)
-         (format "<img src=\"%s\" />"
-                 (htmlize-protect-string (file-relative-name
-                                          (plist-get imgprops :file)))))
+         ;; Try to find the image in image-load-path
+         (let* ((found-props (cdr (find-image (list imgprops))))
+                (file (or (plist-get found-props :file)
+                          (plist-get imgprops :file))))
+           (format "<img src=\"%s\" />"
+                   (htmlize-protect-string (file-relative-name file)))))
         ((plist-get imgprops :data)
          (format "<img src=\"data:image/%s;base64,%s\" />"
                  (or (plist-get imgprops :type) "")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]