diff options
author | Arun Isaac | 2025-03-30 03:06:37 +0100 |
---|---|---|
committer | Arun Isaac | 2025-03-30 03:06:37 +0100 |
commit | b0d62ccdd3795a0b879be700317b1053b58e5f8f (patch) | |
tree | fabc9d5280ac26dc1281b9cc5bf5803ce7511148 | |
parent | 1f8e8b37ed0e21dbcfd5da9e4b2c0d16325b4a37 (diff) | |
download | ennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.tar.gz ennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.tar.lz ennum-b0d62ccdd3795a0b879be700317b1053b58e5f8f.zip |
* 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.
-rw-r--r-- | ennum-html.el | 15 | ||||
-rw-r--r-- | ennum.el | 10 |
2 files changed, 23 insertions, 2 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) @@ -654,7 +654,8 @@ result as a string." :blog-scheme :index-posts-per-page :image-width :image-link-width :locale-alist :other-files-directory - :store :tag-directory :image-thumbnail-width + :pdf-width :pdf-height :store + :tag-directory :image-thumbnail-width :required-metadata) (plist-get (org-combine-plists (list :atom-feed-number-of-posts 12 @@ -664,6 +665,11 @@ result as a string." :image-link-width 1024 :index-posts-per-page 12 :locale-alist '(("en" . "C")) + ;; These PDF dimensions preserve the √2 ratio + ;; of A series paper. + ;; https://en.wikipedia.org/wiki/Paper_size#A_series + :pdf-width 640 + :pdf-height 905 :store ".ennum" :tag-directory "tag" :image-thumbnail-width 320 @@ -743,7 +749,7 @@ recognized as a directory, it should end in a slash. See width)) (list (ennum-setting :image-width) (ennum-setting :image-link-width)))) - ('static + ((or 'pdf 'static) (list (ennum-publish-copy (ennum--file-join (ennum-setting :static-directory) |