From c36d736dc08de91a7c512d625e2a76f889f9f9d4 Mon Sep 17 00:00:00 2001 From: Yujie Wen Date: Tue, 13 Oct 2015 01:01:15 +0800 Subject: [PATCH] Add custom JS to reveal.initialize. --- Readme.org | 6 ++++++ ox-reveal.el | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Readme.org b/Readme.org index f299fc0..0c0638b 100755 --- a/Readme.org +++ b/Readme.org @@ -639,6 +639,12 @@ fibs = 0 : 1 : next fibs * [[Tips]]. * [[#my-heading][Heading]] with a =CUSTOM_ID= property. +** Custom JS + + To pass custom JS code to ~Reveal.initialize~, state the code by + ~#+REVEAL_INIT_SCRIPT~ (multiple statements are concatenated) or by + custom variable ~org-reveal-init-script~. + * Thanks Courtesy to: diff --git a/ox-reveal.el b/ox-reveal.el index e8aa571..3dc5601 100755 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -83,6 +83,7 @@ (:reveal-plugins "REVEAL_PLUGINS" nil nil t) (:reveal-default-frag-style "REVEAL_DEFAULT_FRAG_STYLE" nil org-reveal-default-frag-style t) (:reveal-single-file nil "reveal_single_file" org-reveal-single-file t) + (:reveal-init-script "REVEAL_INIT_SCRIPT" nil org-reveal-init-script space) ) :translate-alist @@ -321,6 +322,11 @@ can contain the following escaping elements: :group 'org-export-reveal :type 'boolean) +(defcustom org-reveal-init-script nil + "Custom script that will be passed to Reveal.initialize." + :group 'org-export-reveal + :type 'string) + (defcustom org-reveal-note-key-char "n" "If not nil, org-reveal-note-key-char's value is registered as the key character to Org-mode's structure completion for @@ -655,8 +661,9 @@ dependencies: [ (append (list extra-codes) builtin-codes)))) (mapconcat 'identity total-codes ",\n")) "]\n" - ) - ) + (let ((init-script (plist-get info :reveal-init-script))) + (if init-script (concat "," init-script))) + )) "});\n\n"))) (defun org-reveal-toc (depth info)