diff options
author | Arun Isaac | 2020-03-15 02:38:08 +0530 |
---|---|---|
committer | Arun Isaac | 2020-03-15 02:41:02 +0530 |
commit | 5eced15e5610b2fe02baf7b473650309d1f9a6db (patch) | |
tree | 6a313db996743c3f4e0100987dc60ccc5d478514 | |
parent | 9d411d414a2ec6df21126931d3f516bc66b64b2a (diff) | |
download | ennum-5eced15e5610b2fe02baf7b473650309d1f9a6db.tar.gz ennum-5eced15e5610b2fe02baf7b473650309d1f9a6db.tar.lz ennum-5eced15e5610b2fe02baf7b473650309d1f9a6db.zip |
Add post and image link follow functions.
* ennu-html.el (ennu-follow): New macro.
(ennu-follow-post, ennu-follow-image): New functions. Add respectively
as :follow properties to post and image links in org-link-parameters.
-rw-r--r-- | ennu-html.el | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/ennu-html.el b/ennu-html.el index b1cf217..d87a598 100644 --- a/ennu-html.el +++ b/ennu-html.el @@ -295,6 +295,10 @@ ;; Pass other link types to org-html-link (_ (org-html-link link desc info))))) +(defmacro ennu-follow (path) + `(ennu-with-current-directory (ennu-setting :working-directory) + (find-file ,path))) + ;; TODO: Pass title through org-export-data-with-backend or something ;; similar in order to export org syntax in title (defun ennu-export-post (path desc backend) @@ -303,10 +307,20 @@ (xmlgen `(a :href ,(expand-file-name* path (ennu-setting :posts-directory)) ,(or desc (ennu-post-title (ennu-read-post filename))))))) +(defun ennu-follow-post (path) + (ennu-follow (expand-file-name (concat path ".org") + (ennu-setting :posts-directory)))) (org-link-set-parameters - "post" :export 'ennu-export-post) + "post" + :export 'ennu-export-post + :follow 'ennu-follow-post) + +(defun ennu-follow-image (path) + (ennu-follow (expand-file-name path (ennu-setting :images-directory)))) +(org-link-set-parameters + "image" :follow 'ennu-follow-image) (defun ennu-export-thumbnail (path desc backend) (xmlgen @@ -316,7 +330,9 @@ (ennu-setting :images-directory))))) (org-link-set-parameters - "thumbnail" :export 'ennu-export-thumbnail) + "thumbnail" + :export 'ennu-export-thumbnail + :follow 'ennu-follow-image) (defun ennu-export-video (path desc backend) (let ((video-directory (ennu-setting :video-directory))) |