Merge pull request #473 from tinloaf/extra-scripts

Move extra scripts before initialize
This commit is contained in:
Yujie Wen 2022-02-05 18:46:51 +08:00 committed by GitHub
commit 844ef73957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -101,6 +101,7 @@
(:reveal-single-file nil "reveal_single_file" org-reveal-single-file t)
(:reveal-extra-script "REVEAL_EXTRA_SCRIPT" nil org-reveal-extra-script space)
(:reveal-extra-script-src "REVEAL_EXTRA_SCRIPT_SRC" nil org-reveal-extra-script-src split)
(:reveal-extra-script-before-src "REVEAL_EXTRA_SCRIPT_BEFORE_SRC" nil org-reveal-extra-script-before-src split)
(:reveal-init-options "REVEAL_INIT_OPTIONS" nil org-reveal-init-options newline)
(:reveal-highlight-css "REVEAL_HIGHLIGHT_CSS" nil org-reveal-highlight-css nil)
(:reveal-reveal-js-version "REVEAL_REVEAL_JS_VERSION" nil nil t)
@ -321,7 +322,12 @@ Example:
:type 'string)
(defcustom org-reveal-extra-script-src '()
"Custom script source that will be embedded in a <script src> tag."
"Custom script source that will be embedded in a <script src> tag, after the call to Reveal.initialize()."
:group 'org-export-reveal
:type 'list)
(defcustom org-reveal-extra-script-before-src '()
"Custom script source that will be embedded in a <script src> tag, before the call to Reveal.initialize()."
:group 'org-export-reveal
:type 'list)
@ -769,6 +775,18 @@ custom variable `org-reveal-root'."
;; plugin headings
(if-format "%s\n" (car reveal-4-plugin))
;; Extra <script src="..."></script> tags before the call to Reveal.initialize()
(let ((before-src-list (let ((l (plist-get info :reveal-extra-script-before-src)))
;; map to a single string to a list.
(if (stringp l)
(list l)
l))))
(and before-src-list
(mapconcat (lambda (src) (format "<script src=\"%s\"></script>" src))
before-src-list
"\n")))
;; Reveal.initialize
(let ((reveal-4-plugin-statement (cdr reveal-4-plugin))
(init-options (plist-get info :reveal-init-options))