summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2019-08-25 23:45:58 +0530
committerArun Isaac2019-08-25 23:45:58 +0530
commitdb8f670ebcb42fdfd7156f9917f7dab59502e9bd (patch)
tree09cedcb48955333a82133268635610d0eff7c11a
parent3e5088b3cf6fdac26845df791f2c25e7d4a3fc00 (diff)
downloadennum-db8f670ebcb42fdfd7156f9917f7dab59502e9bd.tar.gz
ennum-db8f670ebcb42fdfd7156f9917f7dab59502e9bd.tar.lz
ennum-db8f670ebcb42fdfd7156f9917f7dab59502e9bd.zip
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.
-rw-r--r--ennu.el15
1 files changed, 9 insertions, 6 deletions
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)