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)))
;; Embed script into HTML (if (file-readable-p local-fname)
(concat "<script>\n" ;; Embed script into HTML
(org-reveal--read-file fname) (concat "<script>\n"
"\n</script>\n") (org-reveal--read-file local-fname)
;; Cannot read fname, just error out "\n</script>\n")
(error (concat "Cannot generate single file presentation due to " ;; Cannot read fname, just error out
fname (error (concat "Cannot generate single file presentation due to "
" is not readable"))) local-fname
" 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)