added multiplex support via a few additional options

This commit is contained in:
Stephen Barrett 2014-11-04 10:33:03 +00:00
parent 9ea30500e9
commit 2622596302
1 changed files with 103 additions and 42 deletions

View File

@ -137,6 +137,28 @@ can be include."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-multiplex-id ""
"The ID to use for multiplexing."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-multiplex-secret ""
"The secret to use for master slide."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-multiplex-url ""
"The url of the socketio server."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-multiplex-socketio-url
""
"the url of the socketio.js library"
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-control t
"Reveal control applet."
:group 'org-export-reveal
@ -239,7 +261,8 @@ can be include."
(const zoom)
(const notes)
(const search)
(const remotes)))
(const remotes)
(const multiplex)))
(defun if-format (fmt val)
(if val (format fmt val) ""))
@ -461,6 +484,21 @@ transition: Reveal.getQueryHash().transition || '%s', // default/cube/page/conca
transitionSpeed: '%s',\n"
(plist-get info :reveal-trans)
(plist-get info :reveal-speed))
;; multiplexing - depends on defvar 'client-multiplex'
(when (plist-get info :reveal-multiplex-id)
(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)))
;; optional JS library heading
"
// Optional libraries used to extend on reveal.js
@ -475,7 +513,17 @@ dependencies: [
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)))
remotes (format " { src: '%splugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }" root-path)
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)
@ -744,15 +792,28 @@ info is a plist holding export options."
</html>\n"))
(defvar client-multiplex nil
"used to cause generation of client html file for multiplex")
(defun org-reveal-export-to-html
(&optional async subtreep visible-only body-only ext-plist)
"Export current buffer to a reveal.js HTML file."
(interactive)
(let* ((extension (concat "." org-html-extension))
(file (org-export-output-file-name extension subtreep)))
(org-export-to-file 'reveal file
async subtreep visible-only body-only ext-plist)))
(file (org-export-output-file-name extension subtreep))
(clientfile (org-export-output-file-name (concat "_client" extension) subtreep)))
; export filename_client HTML file if multiplexing
(setq client-multiplex nil)
(setq retfile (org-export-to-file 'reveal file
async subtreep visible-only body-only ext-plist))
; export the client HTML file if client-multiplex is set true
; by previous call to org-export-to-file
(if (eq client-multiplex t)
(org-export-to-file 'reveal clientfile
async subtreep visible-only body-only ext-plist))
(cond (t retfile))))
(defun org-reveal-export-to-html-and-browse
(&optional async subtreep visible-only body-only ext-plist)