aboutsummaryrefslogtreecommitdiff
path: root/ennum-html.el
diff options
context:
space:
mode:
authorArun Isaac2025-03-30 03:06:37 +0100
committerArun Isaac2025-03-30 03:06:37 +0100
commitb0d62ccdd3795a0b879be700317b1053b58e5f8f (patch)
treefabc9d5280ac26dc1281b9cc5bf5803ce7511148 /ennum-html.el
parent1f8e8b37ed0e21dbcfd5da9e4b2c0d16325b4a37 (diff)
downloadennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.tar.gz
ennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.tar.lz
ennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.zip
Add pdf link type.HEADmaster
* ennum-html.el (ennum-html-export-pdf): New function. (org-link-parameters): Add pdf. * ennum.el (ennum-setting): Add :pdf-width and :pdf-height settings. (ennum-publish-link): Add pdf link type.
Diffstat (limited to 'ennum-html.el')
-rw-r--r--ennum-html.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/ennum-html.el b/ennum-html.el
index 5198a80..7e3eacb 100644
--- a/ennum-html.el
+++ b/ennum-html.el
@@ -372,6 +372,21 @@
"video"
:follow 'ennum-html-follow-video)
+(defun ennum-html-export-pdf (path desc backend)
+ (pcase backend
+ ((or 'ennum-html 'html)
+ (xmlgen
+ (let ((link-path (url-encode-url
+ (expand-file-name* path (ennum-setting :static-directory)))))
+ `(object :data ,link-path
+ :type "application/pdf"
+ :width ,(ennum-setting :pdf-width)
+ :height ,(ennum-setting :pdf-height)
+ "Download " (a :href ,link-path ,path)))))))
+
+(org-link-set-parameters
+ "pdf" :export 'ennum-html-export-pdf)
+
(defun ennum-html-export-static (path desc backend)
(pcase backend
((or 'ennum-html 'html)