aboutsummaryrefslogtreecommitdiff
path: root/ennum.el
diff options
context:
space:
mode:
authorArun Isaac2025-07-01 02:08:52 +0100
committerArun Isaac2025-07-01 02:10:43 +0100
commitb25a703572143b7f9cfc5f55704cd2c114b6adc3 (patch)
tree3a25ad414c46658fb9612c85799bd4b2930af40d /ennum.el
parent64b4c82fa0e56d8eca711dae699623ceeb8a3d7e (diff)
downloadennum-b25a703572143b7f9cfc5f55704cd2c114b6adc3.tar.gz
ennum-b25a703572143b7f9cfc5f55704cd2c114b6adc3.tar.lz
ennum-b25a703572143b7f9cfc5f55704cd2c114b6adc3.zip
Support images generated at build-time.HEADmaster
* ennum.el (ennum-setting): Add :generated-image-paths. (ennum--find-image): New function. (ennum-publish-link, ennum-publish): Use ennum--find-image.
Diffstat (limited to 'ennum.el')
-rw-r--r--ennum.el24
1 files changed, 15 insertions, 9 deletions
diff --git a/ennum.el b/ennum.el
index 1526e48..6314a5c 100644
--- a/ennum.el
+++ b/ennum.el
@@ -673,7 +673,8 @@ result as a string."
:locale-alist :other-files-directory
:pdf-width :pdf-height :store
:tag-directory :image-thumbnail-width
- :required-metadata :other-items)
+ :required-metadata :generated-image-paths
+ :other-items)
(plist-get (org-combine-plists
(list :atom-feed-number-of-posts 12
:atom-feed-file "blog.atom"
@@ -757,14 +758,21 @@ recognized as a directory, it should end in a slash. See
(defun ennum--filter-map (function sequence)
(seq-filter 'identity (seq-map function sequence)))
+(defun ennum--find-image (path)
+ "Find store item for image with PATH."
+ (or (seq-find 'file-exists-p
+ (seq-map (apply-partially 'expand-file-name
+ path)
+ (ennum-setting :generated-image-paths)))
+ (ennum-intern (ennum--file-join (ennum-setting :images-directory)
+ path))))
+
(defun ennum-publish-link (link)
(pcase (ennum-link-type link)
('image
(seq-map (lambda (width)
- (ennum-publish-image
- (ennum-intern (ennum--file-join (ennum-setting :images-directory)
- (ennum-link-path link)))
- width))
+ (ennum-publish-image (ennum--find-image (ennum-link-path link))
+ width))
(list (ennum-setting :image-width)
(ennum-setting :image-link-width))))
((or 'pdf 'static)
@@ -850,10 +858,8 @@ as keys. Keys are compared using `equal'."
(ennum-many-to-many-group-by 'ennum-post-tags posts))
;; Publish thumbnails
(seq-map (lambda (image)
- (ennum-publish-image
- (ennum-intern (ennum--file-join (ennum-setting :images-directory)
- image))
- (ennum-setting :image-thumbnail-width)))
+ (ennum-publish-image (ennum--find-image image)
+ (ennum-setting :image-thumbnail-width)))
(ennum--filter-map 'ennum-post-thumbnail posts))
;; Publish other files
(seq-map (apply-partially 'ennum-publish-generic other-files-directory)