Extract local file name from script URL

This commit is contained in:
Yujie Wen 2022-02-16 23:06:11 +08:00
parent 3f5ae4df8a
commit fed9be1f4c
1 changed files with 10 additions and 9 deletions

View File

@ -746,15 +746,16 @@ dependencies: [
file name. If in single file mode, the <script> tag encloses the file name. If in single file mode, the <script> tag encloses the
contents of the file, otherwise it is a tag pointing to the file" contents of the file, otherwise it is a tag pointing to the file"
(if in-single-file (if in-single-file
(if (file-readable-p fname) (let ((local-fname (org-reveal--file-url-to-path fname)))
(if (file-readable-p local-fname)
;; Embed script into HTML ;; Embed script into HTML
(concat "<script>\n" (concat "<script>\n"
(org-reveal--read-file fname) (org-reveal--read-file local-fname)
"\n</script>\n") "\n</script>\n")
;; Cannot read fname, just error out ;; Cannot read fname, just error out
(error (concat "Cannot generate single file presentation due to " (error (concat "Cannot generate single file presentation due to "
fname local-fname
" is not readable"))) " is not readable"))))
(format "<script src=\"%s\"></script>\n" fname))) (format "<script src=\"%s\"></script>\n" fname)))
(defun org-reveal--script-tags-by-auto-file-names (fnames in-single-file) (defun org-reveal--script-tags-by-auto-file-names (fnames in-single-file)