branch: elpa/htmlize
commit 3ed76d89f0059de9033dcbc7ea1217e2c451ec60
Author: Hrvoje Niksic <[email protected]>
Commit: Hrvoje Niksic <[email protected]>

    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