From db8f670ebcb42fdfd7156f9917f7dab59502e9bd Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 25 Aug 2019 23:45:58 +0530 Subject: Publish ennu-with-file-contents. * ennu.el (ennu--with-file-contents): Rename to ... (ennu-with-file-contents): ... this. Add docstring. (ennu-publish-post, ennu-publish-page, ennu--feed-entry, ennu-post-links, ennu--post-metadata-memoized): Fix invocations. --- ennu.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'ennu.el') diff --git a/ennu.el b/ennu.el index 3eac9a4..5d37a71 100644 --- a/ennu.el +++ b/ennu.el @@ -10,7 +10,10 @@ (defvar ennu-version "0.1.0" "Ennu version string") -(defmacro ennu--with-file-contents (file &rest body) +(defmacro ennu-with-file-contents (file &rest body) + "Create a temporary buffer, insert contents of FILE into that +buffer and evaluate BODY. The value returned is the value of the +last form in BODY." (declare (indent defun)) `(with-temp-buffer (insert-file-contents ,file) @@ -24,7 +27,7 @@ `((,post) (,(ennu--org-output-filename post)) ,(lambda (output-file) - (ennu--with-file-contents post + (ennu-with-file-contents post (org-export-to-file 'ennu-html output-file)) ;; (when-let (tangle-dir (or (plist-get posts-plist :valai-tangle-directory) ;; valai-tangle-directory)) @@ -46,7 +49,7 @@ (file-name-as-directory pages-directory) page))) ,(lambda (output-file) - (ennu--with-file-contents page + (ennu-with-file-contents page (org-export-to-file 'html output-file))))) (defun ennu-video-poster (video) @@ -168,7 +171,7 @@ (name ,(plist-get metadata :author)) (email ,user-mail-address)) (content :type "html" :xml:lang ,lang - ,(ennu--with-file-contents post + ,(ennu-with-file-contents post (org-export-as 'ennu-html nil nil t))) (link :rel "alternate" :href ,link) ,@(seq-map (lambda (tag) `(category :term ,tag)) @@ -228,7 +231,7 @@ `((,file) (,file) ,(apply-partially 'copy-file file))) (defun ennu-post-links (post) - (ennu--with-file-contents post + (ennu-with-file-contents post (org-element-map (org-element-parse-buffer) 'link (lambda (link) (pcase link @@ -250,7 +253,7 @@ (file-attributes post)))) (defmemoize ennu--post-metadata-memoized (post last-modified) - (ennu--with-file-contents post + (ennu-with-file-contents post (let ((metadata (org-export-get-environment 'ennu-html)) (export (apply-partially 'org-export-with-backend 'ennu-html))) (seq-do (lambda (key) -- cgit v1.2.3