summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2020-03-15 03:06:10 +0530
committerArun Isaac2020-03-15 03:06:10 +0530
commitcf71d9234ca547cab61eed5436cd5a267160a07d (patch)
tree4483ebd80d08e8cce3268a38041aa7e09bcde3ea
parent5eced15e5610b2fe02baf7b473650309d1f9a6db (diff)
downloadennum-cf71d9234ca547cab61eed5436cd5a267160a07d.tar.gz
ennum-cf71d9234ca547cab61eed5436cd5a267160a07d.tar.lz
ennum-cf71d9234ca547cab61eed5436cd5a267160a07d.zip
Check backend while exporting links.
* ennu-html.el (ennu-export-post, ennu-export-thumbnail, ennu-export-video, ennu-export-static, ennu-export-tag): Export only if backend is either ennu-html or html.
-rw-r--r--ennu-html.el55
1 files changed, 33 insertions, 22 deletions
diff --git a/ennu-html.el b/ennu-html.el
index d87a598..4378d2a 100644
--- a/ennu-html.el
+++ b/ennu-html.el
@@ -302,11 +302,14 @@
;; 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)
- (let ((filename (concat (expand-file-name path (ennu-setting :posts-directory))
- ".org")))
- (xmlgen `(a :href ,(expand-file-name*
- path (ennu-setting :posts-directory))
- ,(or desc (ennu-post-title (ennu-read-post filename)))))))
+ (pcase backend
+ ((or 'ennu-html 'html)
+ (let ((filename (concat (expand-file-name path (ennu-setting :posts-directory))
+ ".org")))
+ (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))))
@@ -323,11 +326,13 @@
"image" :follow 'ennu-follow-image)
(defun ennu-export-thumbnail (path desc backend)
- (xmlgen
- `(img :src ,(expand-file-name*
- (ennu-image-output-filename
- path (ennu-setting :thumbnail-image-width))
- (ennu-setting :images-directory)))))
+ (pcase backend
+ ((or 'ennu-html 'html)
+ (xmlgen
+ `(img :src ,(expand-file-name*
+ (ennu-image-output-filename
+ path (ennu-setting :thumbnail-image-width))
+ (ennu-setting :images-directory)))))))
(org-link-set-parameters
"thumbnail"
@@ -335,20 +340,24 @@
:follow 'ennu-follow-image)
(defun ennu-export-video (path desc backend)
- (let ((video-directory (ennu-setting :video-directory)))
- (xmlgen
- `(video :src ,(expand-file-name* path video-directory)
- :poster ,(expand-file-name* (ennu-video-poster path) video-directory)
- :preload "none"
- :controls ""))))
+ (pcase backend
+ ((or 'ennu-html 'html)
+ (let ((video-directory (ennu-setting :video-directory)))
+ (xmlgen
+ `(video :src ,(expand-file-name* path video-directory)
+ :poster ,(expand-file-name* (ennu-video-poster path) video-directory)
+ :preload "none"
+ :controls ""))))))
(org-link-set-parameters
"video" :export 'ennu-export-video)
(defun ennu-export-static (path desc backend)
- (xmlgen
- `(a :href ,(expand-file-name* path (ennu-setting :static-directory))
- ,desc)))
+ (pcase backend
+ ((or 'ennu-html 'html)
+ (xmlgen
+ `(a :href ,(expand-file-name* path (ennu-setting :static-directory))
+ ,desc)))))
(org-link-set-parameters
"static" :export 'ennu-export-static)
@@ -357,9 +366,11 @@
"tangle" :export 'ennu-export-static)
(defun ennu-export-tag (tag desc backend)
- (xmlgen
- `(a :href ,(expand-file-name* tag (ennu-setting :tag-directory))
- ,(or desc tag))))
+ (pcase backend
+ ((or 'ennu-html 'html)
+ (xmlgen
+ `(a :href ,(expand-file-name* tag (ennu-setting :tag-directory))
+ ,(or desc tag))))))
(org-link-set-parameters
"tag" :export 'ennu-export-tag)