update packages
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
;; Author: Yujie Wen <yjwen.ty at gmail dot com>
|
||||
;; Created: 2013-04-27
|
||||
;; Version: 1.0
|
||||
;; Package-Version: 20201211.1518
|
||||
;; Package-Commit: e8673f4825b1c6e97f8ba895ccaf8c460cba5a09
|
||||
;; Package-Version: 20211128.1509
|
||||
;; Package-Commit: 59adea80013e962811b204403cc500a4d28b85a0
|
||||
;; Package-Requires: ((org "8.3"))
|
||||
;; Keywords: outlines, hypermedia, slideshow, presentation
|
||||
|
||||
@@ -98,10 +98,11 @@
|
||||
(: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-external-plugins "REVEAL_EXTERNAL_PLUGINS" nil nil space)
|
||||
(: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)
|
||||
(: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-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)
|
||||
@@ -271,11 +272,10 @@ embedded into Reveal.initialize()."
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-reveal-plugins
|
||||
'(classList markdown zoom notes)
|
||||
'(markdown zoom notes)
|
||||
"Default builtin plugins"
|
||||
:group 'org-export-reveal
|
||||
:type '(set
|
||||
(const classList)
|
||||
(const markdown)
|
||||
(const highlight)
|
||||
(const zoom)
|
||||
@@ -286,10 +286,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 <script> tag in the output HTML.
|
||||
|
||||
Example:
|
||||
|
||||
(setq org-reveal-external-plugins
|
||||
'((CopyCode .
|
||||
(\"https://cdn.jsdelivr.net/npm/reveal.js-copycode@1.0.2/plugin/copycode/copycode.js\"
|
||||
\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js\"))))
|
||||
"
|
||||
:group 'org-export-reveal
|
||||
:type 'alist)
|
||||
|
||||
@@ -299,28 +317,21 @@ BEFORE the plugins that depend on them."
|
||||
:group 'org-export-reveal
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-reveal-init-script nil
|
||||
"Custom script that will be passed to Reveal.initialize."
|
||||
(defcustom org-reveal-extra-script nil
|
||||
"Custom script that will be passed added to the script block, after Reveal.initialize."
|
||||
:group 'org-export-reveal
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-reveal-extra-script-src '()
|
||||
"Custom script source that will be embedded in a <script src> tag."
|
||||
:group 'org-export-reveal
|
||||
:type 'list)
|
||||
|
||||
(defcustom org-reveal-highlight-css "%r/lib/css/zenburn.css"
|
||||
"Highlight.js CSS file."
|
||||
: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
|
||||
Reveal.js notes. When `<' followed by the key character are
|
||||
typed and then the completion key is pressed, which is usually
|
||||
`TAB', \"#+BEGIN_NOTES\" and \"#+END_NOTES\" is inserted.
|
||||
|
||||
The default value is \"n\". Set the variable to nil to disable
|
||||
registering the completion"
|
||||
:group 'org-export-reveal
|
||||
:type 'string)
|
||||
|
||||
(defcustom org-reveal-klipsify-src nil
|
||||
"Set to non-nil if you would like to make source code blocks editable in exported presentation."
|
||||
:group 'org-export-reveal
|
||||
@@ -613,10 +624,12 @@ holding contextual information."
|
||||
(concat root-path file-path-0)
|
||||
(concat root-path file-path-1)))
|
||||
|
||||
(defun org-reveal-root-path (info)
|
||||
(file-name-as-directory (plist-get info :reveal-root)))
|
||||
(defun org-reveal-stylesheets (info)
|
||||
"Return the HTML contents for declaring reveal stylesheets
|
||||
using custom variable `org-reveal-root'."
|
||||
(let* ((root-path (file-name-as-directory (plist-get info :reveal-root)))
|
||||
(let* ((root-path (org-reveal-root-path info))
|
||||
(version (org-reveal--get-reveal-js-version info))
|
||||
(reveal-css (org-reveal--choose-path root-path version "dist/reveal.css" "css/reveal.css"))
|
||||
(theme (plist-get info :reveal-theme))
|
||||
@@ -646,7 +659,7 @@ using custom variable `org-reveal-root'."
|
||||
(format-spec (plist-get info :reveal-highlight-css)
|
||||
`((?r . ,(directory-file-name root-path))))))
|
||||
;; print-pdf
|
||||
(if in-single-file ""
|
||||
(if (or in-single-file (eq version 4)) ""
|
||||
(format "
|
||||
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
|
||||
<script>
|
||||
@@ -676,17 +689,65 @@ using custom variable `org-reveal-root'."
|
||||
(or (and buffer-plugins (listp buffer-plugins) buffer-plugins)
|
||||
org-reveal-plugins)))
|
||||
|
||||
(defun org-reveal--legacy-dependency (root-path plugins info)
|
||||
(concat
|
||||
"
|
||||
// Optional libraries used to extend on reveal.js
|
||||
dependencies: [
|
||||
"
|
||||
;; JS libraries
|
||||
(let* ((builtins
|
||||
'(
|
||||
classList (format " { src: '%slib/js/classList.js', condition: function() { return !document.body.classList; } }" root-path)
|
||||
markdown (format " { src: '%splugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||
{ src: '%splugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }" root-path root-path)
|
||||
highlight (format " { src: '%splugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }" root-path)
|
||||
zoom (format " { src: '%splugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
notes (format " { src: '%splugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
search (format " { src: '%splugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
remotes (format " { src: '%splugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
;; multiplex setup for reveal.js 3.x
|
||||
multiplex (format " { src: '%s', async: true },\n%s"
|
||||
(plist-get info :reveal-multiplex-socketio-url)
|
||||
; following ensures that either client.js or master.js is included depending on defva client-multiplex value state
|
||||
(if (not client-multiplex)
|
||||
(progn
|
||||
(if (plist-get info :reveal-multiplex-secret)
|
||||
(setq client-multiplex t))
|
||||
(format " { src: '%splugin/multiplex/master.js', async: true }" root-path))
|
||||
(format " { src: '%splugin/multiplex/client.js', async: true }" root-path)))))
|
||||
(builtin-codes
|
||||
(mapcar (lambda (p)
|
||||
(eval (plist-get builtins p)))
|
||||
plugins))
|
||||
(external-plugins
|
||||
(append
|
||||
;; Global setting
|
||||
(cl-loop for (key . value) in org-reveal-external-plugins
|
||||
collect (org-reveal--replace-first-%s value root-path ))
|
||||
;; Local settings
|
||||
(let ((local-plugins (plist-get info :reveal-external-plugins)))
|
||||
(and local-plugins
|
||||
(list (org-reveal--replace-first-%s 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
|
||||
(if (string= "" extra-codes) all-plugins (append (list extra-codes) all-plugins))))
|
||||
(mapconcat 'identity total-codes ",\n"))
|
||||
"]\n"))
|
||||
(defun org-reveal-scripts (info)
|
||||
"Return the necessary scripts for initializing reveal.js using
|
||||
custom variable `org-reveal-root'."
|
||||
(let* ((root-path (file-name-as-directory (plist-get info :reveal-root)))
|
||||
(let* ((root-path (org-reveal-root-path info))
|
||||
(version (org-reveal--get-reveal-js-version info))
|
||||
(reveal-js (org-reveal--choose-path root-path version "dist/reveal.js" "js/reveal.js"))
|
||||
;; 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)
|
||||
(plugins (org-reveal--get-plugins info))
|
||||
(reveal-4-plugin (if (eq 4 version)
|
||||
(org-reveal-plugin-scripts-4 plugins info)
|
||||
(cons nil nil)))
|
||||
(in-single-file (plist-get info :reveal-single-file)))
|
||||
(concat
|
||||
@@ -709,136 +770,177 @@ custom variable `org-reveal-root'."
|
||||
"<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)
|
||||
(format "%s,\n" options)))
|
||||
|
||||
;; multiplexing - depends on defvar 'client-multiplex'
|
||||
(when (plist-get info :reveal-multiplex-id)
|
||||
(format
|
||||
"multiplex: {
|
||||
;; Reveal.initialize
|
||||
(let ((reveal-4-plugin-statement (cdr reveal-4-plugin))
|
||||
(init-options (plist-get info :reveal-init-options))
|
||||
(multiplex-statement
|
||||
;; multiplexing - depends on defvar 'client-multiplex'
|
||||
(when (memq 'multiplex plugins)
|
||||
(concat
|
||||
(format "multiplex: {
|
||||
secret: %s, // null if client
|
||||
id: '%s', // id, obtained from socket.io server
|
||||
url: '%s' // Location of socket.io server
|
||||
},\n"
|
||||
(if (eq client-multiplex nil)
|
||||
(format "'%s'" (plist-get info :reveal-multiplex-secret))
|
||||
(format "null"))
|
||||
(plist-get info :reveal-multiplex-id)
|
||||
(plist-get info :reveal-multiplex-url)))
|
||||
|
||||
(let ((extra-initial-js (plist-get info :reveal-extra-initial-js)))
|
||||
(unless (string= extra-initial-js "")
|
||||
(format "%s,\n" extra-initial-js)))
|
||||
|
||||
;; optional JS library heading
|
||||
(if in-single-file ""
|
||||
(concat
|
||||
"
|
||||
// Optional libraries used to extend on reveal.js
|
||||
dependencies: [
|
||||
(if (eq client-multiplex nil)
|
||||
(format "'%s'" (plist-get info :reveal-multiplex-secret))
|
||||
(format "null"))
|
||||
(plist-get info :reveal-multiplex-id)
|
||||
(plist-get info :reveal-multiplex-url))
|
||||
(let ((url (plist-get info :reveal-multiplex-url)))
|
||||
(format "dependencies: [ { src: '%s/socket.io/socket.io.js', async: true }, { src: '%s/%s', async: true } ]"
|
||||
url url
|
||||
(if client-multiplex "client.js"
|
||||
(progn
|
||||
(setq client-multiplex t)
|
||||
"master.js")))))
|
||||
))
|
||||
(extra-initial-js-statement (plist-get info :reveal-extra-initial-js))
|
||||
(legacy-dependency-statement
|
||||
(unless (or in-single-file (eq version 4))
|
||||
(org-reveal--legacy-dependency root-path plugins info))))
|
||||
(format "
|
||||
<script>
|
||||
// Full list of configuration options available here:
|
||||
// https://github.com/hakimel/reveal.js#configuration
|
||||
Reveal.initialize({
|
||||
%s
|
||||
});
|
||||
%s
|
||||
</script>
|
||||
"
|
||||
;; JS libraries
|
||||
(let* ((builtins
|
||||
'(classList (format " { src: '%slib/js/classList.js', condition: function() { return !document.body.classList; } }" root-path)
|
||||
markdown (format " { src: '%splugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
|
||||
{ src: '%splugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }" root-path root-path)
|
||||
highlight (format " { src: '%splugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }" root-path)
|
||||
zoom (format " { src: '%splugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
notes (format " { src: '%splugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
search (format " { src: '%splugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
remotes (format " { src: '%splugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
|
||||
;; multiplex setup for reveal.js 3.x
|
||||
multiplex (format " { src: '%s', async: true },\n%s"
|
||||
(plist-get info :reveal-multiplex-socketio-url)
|
||||
; following ensures that either client.js or master.js is included depending on defva client-multiplex value state
|
||||
(if (not client-multiplex)
|
||||
(progn
|
||||
(if (plist-get info :reveal-multiplex-secret)
|
||||
(setq client-multiplex t))
|
||||
(format " { src: '%splugin/multiplex/master.js', async: true }" root-path))
|
||||
(format " { src: '%splugin/multiplex/client.js', async: true }" root-path)))))
|
||||
(builtin-codes
|
||||
(let ((plugins (org-reveal--get-plugins info)))
|
||||
(if (eq version 4)
|
||||
;; For reveal.js 4.x, skip the builtin plug-in
|
||||
;; codes except multiplex as all other plug-ins
|
||||
;; in 4.x are specified by separate <script>
|
||||
;; blocks
|
||||
(let ((url (plist-get info :reveal-multiplex-url)))
|
||||
(if (memq 'multiplex plugins)
|
||||
(list (format " { src: '%s/socket.io/socket.io.js', async: true }, { src: '%s/%s', async: true } "
|
||||
url url
|
||||
(if client-multiplex "client.js"
|
||||
(progn
|
||||
(setq client-multiplex t)
|
||||
"master.js"))))
|
||||
'()))
|
||||
(mapcar (lambda (p)
|
||||
(eval (plist-get builtins p)))
|
||||
plugins))))
|
||||
(external-plugins
|
||||
(append
|
||||
;; Global setting
|
||||
(cl-loop for (key . value) in org-reveal-external-plugins
|
||||
collect (format value root-path ))
|
||||
;; Local settings
|
||||
(let ((local-plugins (plist-get info :reveal-external-plugins)))
|
||||
(and local-plugins
|
||||
(list (format local-plugins root-path))))))
|
||||
(mapconcat 'identity
|
||||
(seq-filter (lambda (x) ;; Remove nil and ""
|
||||
(and x (not (string= x ""))))
|
||||
(list reveal-4-plugin-statement
|
||||
init-options
|
||||
multiplex-statement
|
||||
(org-reveal--replace-first-%s extra-initial-js-statement root-path)
|
||||
legacy-dependency-statement))
|
||||
",\n")
|
||||
;; Extra initialization scripts
|
||||
(or (plist-get info :reveal-extra-script) "")))
|
||||
;; Extra <script src="..."></script> tags
|
||||
(let ((src-list (let ((l (plist-get info :reveal-extra-script-src)))
|
||||
;; map to a single string to a list.
|
||||
(if (stringp l)
|
||||
(list l)
|
||||
l))))
|
||||
(and src-list
|
||||
(mapconcat (lambda (src) (format "<script src=\"%s\"></script>" src))
|
||||
src-list
|
||||
"\n"))))))
|
||||
|
||||
(all-plugins (if external-plugins (append external-plugins builtin-codes) builtin-codes))
|
||||
(extra-codes (plist-get info :reveal-extra-js))
|
||||
(total-codes
|
||||
(if (string= "" extra-codes) all-plugins (append (list extra-codes) all-plugins))))
|
||||
(mapconcat 'identity total-codes ",\n"))
|
||||
"]\n"
|
||||
))
|
||||
(let ((init-script (plist-get info :reveal-init-script)))
|
||||
(if init-script (concat (if in-single-file "" ",") init-script)))
|
||||
"});\n</script>\n")))
|
||||
(defun org-reveal--read-sexps-from-string (s)
|
||||
(let ((s (string-trim s)))
|
||||
(and (not (string-empty-p s))
|
||||
(let ((r (read-from-string s)))
|
||||
(let ((obj (car r))
|
||||
(remain-index (cdr r)))
|
||||
(and obj
|
||||
(cons obj (org-reveal--read-sexps-from-string (substring s remain-index)))))))))
|
||||
|
||||
(defun org-reveal-plugin-scripts-4 (info)
|
||||
(defun org-reveal--search-first-%s-or-%% (s start)
|
||||
"Search the first appearance of '%s' or '%%' in fmt from
|
||||
start. Return the location (of the '%') if found, nil
|
||||
otherwise"
|
||||
(when (< start (length s))
|
||||
(if (eq (aref s start) ?%)
|
||||
(let ((next (1+ start)))
|
||||
(when (< next (length s))
|
||||
;; Only when % is not the last character
|
||||
(let ((next-c (aref s next)))
|
||||
(if (or (eq next-c ?s) (eq next-c ?%))
|
||||
;; ^ Found the first %s or %%. Return the index
|
||||
start
|
||||
;; Not a %s or %%. Keep searching
|
||||
(org-reveal--search-first-%s-or-%% s (1+ next))))))
|
||||
;; Not a %. Keep search
|
||||
(org-reveal--search-first-%s-or-%% s (1+ start)))))
|
||||
|
||||
(defun org-reveal--replace-first-%s (fmt str)
|
||||
(let ((idx (org-reveal--search-first-%s-or-%% fmt 0)))
|
||||
(if idx
|
||||
(concat
|
||||
;; Pre
|
||||
(substring fmt 0 idx)
|
||||
;; To be replaced
|
||||
(if (eq ?% (aref fmt (1+ idx)))
|
||||
"%" ;; %% -> %
|
||||
str ;; %s -> str
|
||||
)
|
||||
;; Post
|
||||
(substring fmt (+ 2 idx) nil))
|
||||
;; nil, no %s or %% found
|
||||
fmt)))
|
||||
|
||||
(defun org-reveal-plugin-scripts-4 (plugins info)
|
||||
"Return scripts for initializing reveal.js 4.x builtin scripts"
|
||||
(let ((plugins (org-reveal--get-plugins info)))
|
||||
(if (not (null plugins))
|
||||
;; Generate plugin scripts
|
||||
(let* ((available-plugins
|
||||
'(highlight ("RevealHighlight" . "highlight/highlight.js")
|
||||
markdown ("RevealMarkdown" . "markdown/markdown.js")
|
||||
search ("RevealSearch" . "search/search.js")
|
||||
notes ("RevealNotes" . "notes/notes.js")
|
||||
math ("RevealMath" . "math/math.js")
|
||||
zoom ("RevealZoom" . "zoom/zoom.js")))
|
||||
(plugin-info (seq-filter 'identity
|
||||
(seq-map (lambda (p)
|
||||
(plist-get available-plugins p))
|
||||
plugins))))
|
||||
(if (not (null plugin-info))
|
||||
(cons
|
||||
;; Plugin initialization script
|
||||
(let ((root-path (file-name-as-directory (plist-get info :reveal-root))))
|
||||
(mapconcat
|
||||
(lambda (p)
|
||||
(format "<script src=\"%splugin/%s\"></script>\n" root-path (cdr p)))
|
||||
plugin-info
|
||||
""))
|
||||
;; Reveal initialization for plugins
|
||||
(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))))
|
||||
;; Return a tuple (represented as a list), the first value is a list of script
|
||||
;; tags that are going to be inlined to the final HTML output, the second
|
||||
;; value is a list of import statements that are going to be embedded in the
|
||||
;; Reveal.initialize call
|
||||
(if (not (null plugins))
|
||||
;; Generate plugin scripts
|
||||
(let* ((plugins (mapcar
|
||||
(lambda (p)
|
||||
;; Convert legacy
|
||||
;; plugin names into
|
||||
;; reveal.js 4.0 ones
|
||||
(cond
|
||||
((eq p 'highlight) 'RevealHighlight)
|
||||
((eq p 'markdown) 'RevealMarkdown)
|
||||
((eq p 'search) 'RevealSearch)
|
||||
((eq p 'notes) 'RevealNotes)
|
||||
((eq p 'math) 'RevealMath)
|
||||
((eq p 'zoom) 'RevealZoom)
|
||||
(t p)))
|
||||
plugins))
|
||||
(available-plugins
|
||||
(append '((RevealHighlight . "%splugin/highlight/highlight.js")
|
||||
(RevealMarkdown . "%splugin/markdown/markdown.js")
|
||||
(RevealSearch . "%splugin/search/search.js")
|
||||
(RevealNotes . "%splugin/notes/notes.js")
|
||||
(RevealMath . "%splugin/math/math.js")
|
||||
(RevealZoom . "%splugin/zoom/zoom.js"))
|
||||
org-reveal-external-plugins
|
||||
;; Buffer local plugins
|
||||
(let ((local-plugins (plist-get info :reveal-external-plugins)))
|
||||
(and local-plugins
|
||||
(org-reveal--read-sexps-from-string local-plugins)))))
|
||||
(plugin-js (seq-filter 'identity ;; Filter out nil
|
||||
(mapcar (lambda (p)
|
||||
(cdr (assoc p available-plugins)))
|
||||
plugins))))
|
||||
(if (not (null plugin-js))
|
||||
(cons
|
||||
;; First value of the tuple, a list of scripts HTML tags
|
||||
(let ((root-path (org-reveal-root-path info)))
|
||||
(mapconcat
|
||||
(lambda (p)
|
||||
;; when it is a list, create a script tag for every entry
|
||||
(cond
|
||||
((listp p)
|
||||
(mapconcat (lambda (pi)
|
||||
(format "<script src=\"%s\"></script>\n"
|
||||
(org-reveal--replace-first-%s pi root-path)))
|
||||
p
|
||||
""))
|
||||
;; when it is a single string, create a single script tag
|
||||
(t (format "<script src=\"%s\"></script>\n"
|
||||
(org-reveal--replace-first-%s p root-path)))))
|
||||
plugin-js
|
||||
""))
|
||||
;; 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
|
||||
;; 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)))
|
||||
@@ -851,7 +953,7 @@ dependencies: [
|
||||
(toc-slide-background-opacity (plist-get info :reveal-toc-slide-background-opacity))
|
||||
(toc-slide-with-header (plist-get info :reveal-slide-global-header))
|
||||
(toc-slide-with-footer (plist-get info :reveal-slide-global-footer)))
|
||||
(concat "<section id=\"table-of-contents\""
|
||||
(concat "<section id=\"sec-table-of-contents\""
|
||||
(when toc-slide-background
|
||||
(concat " data-background=\"" toc-slide-background "\""))
|
||||
(when toc-slide-background-size
|
||||
@@ -1149,11 +1251,11 @@ contextual information."
|
||||
loc)))
|
||||
num-start))))
|
||||
(code-attribs (or (org-export-read-attribute
|
||||
:attr_reveal src-block :code_attribs) ""))
|
||||
(label (let ((lbl (org-element-property :name src-block)))
|
||||
(if (not lbl) ""
|
||||
(format " id=\"%s\"" lbl))))
|
||||
(klipsify (and org-reveal-klipsify-src
|
||||
:attr_reveal src-block :code_attribs) ""))
|
||||
(data-id (if-format " data-id=\"%s\"" (org-export-read-attribute
|
||||
:attr_reveal src-block :data_id)))
|
||||
(label (if-format "id=\"%s\"" (org-element-property :name src-block)))
|
||||
(klipsify (and org-reveal-klipsify-src
|
||||
(member lang '("javascript" "js" "ruby" "scheme" "clojure" "php" "html"))))
|
||||
(langselector (cond ((or (string= lang "js") (string= lang "javascript")) "selector_eval_js")
|
||||
((string= lang "clojure") "selector")
|
||||
@@ -1163,9 +1265,11 @@ contextual information."
|
||||
((string= lang "html") "selector_eval_html"))
|
||||
))
|
||||
(if (not lang)
|
||||
(format "<pre %s%s>\n%s</pre>"
|
||||
(or (frag-class src-block info) " class=\"example\"")
|
||||
label
|
||||
(format "<pre %s>\n%s</pre>"
|
||||
(string-join (list (or (frag-class src-block info) " class=\"example\"")
|
||||
label)
|
||||
" ")
|
||||
|
||||
code)
|
||||
(if klipsify
|
||||
(concat
|
||||
@@ -1198,13 +1302,21 @@ window.klipse_settings = { " langselector ": \".klipse\" };
|
||||
(format "<label class=\"org-src-name\">%s</label>"
|
||||
(org-export-data caption info)))
|
||||
(if use-highlight
|
||||
(format "\n<pre%s%s><code class=\"%s\" %s>%s</code></pre>"
|
||||
(or (frag-class src-block info) "")
|
||||
label lang code-attribs code)
|
||||
(format "\n<pre %s%s><code trim>%s</code></pre>"
|
||||
(or (frag-class src-block info)
|
||||
(format " class=\"src src-%s\"" lang))
|
||||
label code))))))))
|
||||
(format "\n<pre %s><code class=\"%s\" %s>%s</code></pre>"
|
||||
(string-join (list (or (frag-class src-block info) "")
|
||||
label
|
||||
data-id)
|
||||
" ")
|
||||
lang code-attribs code)
|
||||
(format "\n<pre %s><code trim>%s</code></pre>"
|
||||
(string-join (list (or (frag-class src-block info)
|
||||
(format " class=\"src src-%s\"" lang))
|
||||
label
|
||||
data-id
|
||||
code-attribs)
|
||||
" ")
|
||||
|
||||
code))))))))
|
||||
|
||||
(defun org-reveal-quote-block (quote-block contents info)
|
||||
"Transcode a QUOTE-BLOCK element from Org to Reveal.
|
||||
@@ -1345,7 +1457,7 @@ Each `attr_reveal' attribute is mapped to corresponding
|
||||
:reveal-speed)))
|
||||
(with-output-to-temp-buffer
|
||||
"* ox-reveal hints *"
|
||||
(princ "
|
||||
(princ "
|
||||
Note: Options and custom variables for initializing reveal.js are
|
||||
obsolete. Use '#+REVEAL_INIT_OPTIONS:' instead to give JS code
|
||||
snippet for initializing reveal.js. The following is a such
|
||||
@@ -1506,14 +1618,6 @@ Return output file name."
|
||||
(when client-multiplex
|
||||
(org-publish-org-to 'reveal filename "_client.html" plist pub-dir))))
|
||||
|
||||
;; Register auto-completion for speaker notes.
|
||||
(when org-reveal-note-key-char
|
||||
(if (version< (cdr (get 'org-structure-template-alist 'custom-package-version)) "9.2")
|
||||
(add-to-list 'org-structure-template-alist
|
||||
(list org-reveal-note-key-char "#+BEGIN_NOTES\n\?\n#+END_NOTES"))
|
||||
(add-to-list 'org-structure-template-alist
|
||||
(cons org-reveal-note-key-char "notes"))))
|
||||
|
||||
(provide 'ox-reveal)
|
||||
|
||||
;;; ox-reveal.el ends here
|
||||
|
||||
Reference in New Issue
Block a user