Fixed #427. Keep one initialization script.

This commit is contained in:
Yujie Wen 2020-06-20 09:14:14 +08:00
parent 84039bb499
commit 18e57df3ba
1 changed files with 9 additions and 7 deletions

View File

@ -683,6 +683,9 @@ custom variable `org-reveal-root'."
;; Local files
(local-root-path (org-reveal--file-url-to-path root-path))
(local-reveal-js (org-reveal--choose-path local-root-path version "dist/reveal.js" "js/reveal.js"))
(reveal-4-plugin (if (eq 4 (org-reveal--get-reveal-js-version info))
(org-reveal-plugin-scripts-4 info)
(cons "" "")))
(in-single-file (plist-get info :reveal-single-file)))
(concat
;; reveal.js/js/reveal.js
@ -703,12 +706,14 @@ custom variable `org-reveal-root'."
(concat
"<script src=\"" reveal-js "\"></script>\n"))
;; plugin headings
(if-format "%s\n" (car reveal-4-plugin))
"
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
"
(if-format "%s,\n" (cdr reveal-4-plugin))
(let ((options (plist-get info :reveal-init-options)))
(and (string< "" options)
@ -806,7 +811,7 @@ dependencies: [
(plist-get available-plugins p))
plugins))))
(if (not (null plugin-info))
(concat
(cons
;; Plugin initialization script
(let ((root-path (file-name-as-directory (plist-get info :reveal-root))))
(mapconcat
@ -815,13 +820,13 @@ dependencies: [
plugin-info
""))
;; Reveal initialization for plugins
(format "<script>Reveal.initialize({plugins: [%s]})</script>\n"
(format "plugins: [%s]"
(mapconcat #'car plugin-info ",")))
;; No available plugin info found. Perhaps wrong plugin
;; names are given
""))
(cons nil nil)))
;; No plugins, return empty string
"")))
(cons nil nil))))
(defun org-reveal-toc (depth info)
"Build a slide of table of contents."
(let ((toc (org-html-toc depth info)))
@ -1291,9 +1296,6 @@ info is a plist holding export options."
</div>\n"
(org-reveal--build-pre/postamble 'postamble info)
(org-reveal-scripts info)
(if (eq 4 (org-reveal--get-reveal-js-version info))
(org-reveal-plugin-scripts-4 info)
"")
"</body>
</html>\n"))