From cac63b6bc3612d5dba642fc3cc30e3a4ec5c180a Mon Sep 17 00:00:00 2001 From: Roman Gonzalez Date: Fri, 1 Oct 2021 10:31:43 -0700 Subject: [PATCH] feat: enhance external plugins configuration Context: Some Reveal.js plugins rely on more than a single Javascript file to function properly (e.g. CopyCode[1]). This commit extends the capabilites of org-reveal to allow the `org-reveal-external-plugins` variable to have multiple import scripts if desired. [1] https://github.com/Martinomagnifico/reveal.js-copycode --- ox-reveal.el | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/ox-reveal.el b/ox-reveal.el index 45c7cab..397f9e8 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -284,10 +284,28 @@ embedded into Reveal.initialize()." (defcustom org-reveal-external-plugins nil "Additional third-party Plugins to load with reveal. + +* When \"REVEAL_REVEAL_JS_VERSION\" is lower than 4 + Each entry should contain a name and an expression of the form \"{src: '%srelative/path/from/reveal/root', async:true/false,condition: jscallbackfunction(){}}\" Note that some plugins have dependencies such as jquery; these must be included here as well, -BEFORE the plugins that depend on them." +BEFORE the plugins that depend on them. + +* When \"REVEAL_REVEAL_JS_VERSION\" is 4 or higher + +The value should be an association list where the key of an entry +is the name of the RevealJS plugin (e.g. RevealHighlight), and +the value is either a string or a list of strings. Each string is +going to be translated to an \n" - (format p root-path))) + (lambda (p) + ;; when it is a list, create a script tag for every entry + (cond + ((listp p) + (mapconcat (lambda (pi) + (format "" + (format pi root-path))) + p + "\n")) + ;; when it is a single string, create a single script tag + (t (format "\n" + (format p root-path)))))) plugin-js "")) - ;; Reveal initialization for plugins + ;; Second value of the tuple, a list of Reveal plugin + ;; initialization statements (format "plugins: [%s]" (mapconcat 'symbol-name plugins ", "))) ;; No available plugin info found. Perhaps wrong plugin