From 3a8697ef5f08dd5166bb26bfa1a4777cf69c06ff Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Thu, 9 Jul 2020 19:39:34 +0530 Subject: Percent encode URIs. * ennu-html.el (ennu-html-link, ennu-export-post, ennu-export-thumbnail, ennu-export-video, ennu-export-static, ennu-export-tag): Percent encode URIs. --- ennu-html.el | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'ennu-html.el') diff --git a/ennu-html.el b/ennu-html.el index 1f76f23..10025bc 100644 --- a/ennu-html.el +++ b/ennu-html.el @@ -286,10 +286,11 @@ (org-html-link (org-element-put-property (org-element-put-property - link :path (expand-file-name* - (ennu-image-output-filename - path (ennu-setting :default-image-width)) - (ennu-setting :images-directory))) + link :path (url-encode-url + (expand-file-name* + (ennu-image-output-filename + path (ennu-setting :default-image-width)) + (ennu-setting :images-directory)))) :type "file") desc info)))) ;; Pass other link types to org-html-link @@ -306,8 +307,8 @@ ((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)) + (xmlgen `(a :href ,(url-encode-url + (expand-file-name* path (ennu-setting :posts-directory))) ,(or desc (ennu-post-title (ennu-read-post filename))))))))) (defun ennu-follow-post (path) @@ -329,10 +330,11 @@ (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))))))) + `(img :src ,(url-encode-url + (expand-file-name* + (ennu-image-output-filename + path (ennu-setting :thumbnail-image-width)) + (ennu-setting :images-directory)))))))) (org-link-set-parameters "thumbnail" @@ -344,8 +346,9 @@ ((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) + `(video :src ,(url-encode-url (expand-file-name* path video-directory)) + :poster ,(url-encode-url + (expand-file-name* (ennu-video-poster path) video-directory)) :preload "none" :controls "")))))) @@ -356,7 +359,8 @@ (pcase backend ((or 'ennu-html 'html) (xmlgen - `(a :href ,(expand-file-name* path (ennu-setting :static-directory)) + `(a :href ,(url-encode-url + (expand-file-name* path (ennu-setting :static-directory))) ,desc))))) (org-link-set-parameters @@ -369,7 +373,8 @@ (pcase backend ((or 'ennu-html 'html) (xmlgen - `(a :href ,(expand-file-name* tag (ennu-setting :tag-directory)) + `(a :href ,(url-encode-url + (expand-file-name* tag (ennu-setting :tag-directory))) ,(or desc tag)))))) (org-link-set-parameters -- cgit v1.2.3