Fixed #254. An option line for specifying external plugins.

This commit is contained in:
Yujie Wen 2019-07-22 00:09:15 +08:00
parent 6434b31143
commit f72ed8c080
2 changed files with 26 additions and 11 deletions

View File

@ -577,20 +577,27 @@
** Third-Party Plugins
Reveal.js is also extensible through third-party plugins. Org-reveal
now includes a mechanism to load these as well. It's a little more
complicated, because we need to store the specific javascript loading
code in a defcustom.
now includes a mechanism to load these as well, either for all org buffers
by defining variable, or for local org buffer by setting option line.
*** By Defining Variable
Store the names and loading instructions for each plugin in the
defcustom ~org-reveal-external-plugins~. This defcustom is an
associative list. The first element of each Assoc cell is a symbol --
the name of the plugin -- and the second is a string that will be
expanded by the ~format~ function when the plugin is loaded. So, this
second element should have the form ~" {src:
\"%srelative/path/toplugin/from/reveal/root.js\"}'. If you need the
customizable variable ~org-reveal-external-plugins~. This variable is
an associative list. The first element of each Assoc cell is a symbol
-- the name of the plugin -- and the second is the string of the code
for enabling the plugin. The string can have ONE optional ~%s~, which
will be replaced by `reveal-root`.
So, this second element should have the form ~"{src:
\"%srelative/path/toplugin/from/reveal/root.js\"}~. If you need the
async or callback parameters, include those too. Ox-reveal will add
the plugin to the dependencies parameter when Reveal is initialized.
*** By Local Option Line
Specify the plugin by option line ~#+REVEAL_EXTERNAL_PLUGINS: string
of code~. Similiar to the global plugin definition, the string of code
can have one optional ~%s~ to be replaced by ~reveal-root~.
** Highlight Source Code
There are two ways to highlight source code.

View File

@ -90,6 +90,7 @@
(:reveal-slide-header "REVEAL_SLIDE_HEADER" nil org-reveal-slide-header t)
(:reveal-slide-footer "REVEAL_SLIDE_FOOTER" nil org-reveal-slide-footer t)
(:reveal-plugins "REVEAL_PLUGINS" nil nil t)
(:reveal-external-plugins "REVEAL_EXTERNAL_PLUGINS" nil nil newline)
(: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)
@ -763,8 +764,15 @@ dependencies: [
(or (and buffer-plugins (listp buffer-plugins) buffer-plugins)
org-reveal-plugins))))
(external-plugins
(cl-loop for (key . value) in org-reveal-external-plugins
collect (format value root-path )) )
(append
;; Global setting
(cl-loop for (key . value) in org-reveal-external-plugins
collect (format value root-path ))
;; Local settings
(list (let ((local-plugins (plist-get info :reveal-external-plugins)))
(and local-plugins
(format local-plugins root-path))))))
(all-plugins (if external-plugins (append external-plugins builtin-codes) builtin-codes))
(extra-codes (plist-get info :reveal-extra-js))
(total-codes