From c4998ccdda500f9f9052bb26f6fb650b030cea19 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Nov 2023 16:19:34 +0100 Subject: [PATCH] update ox-reveal Signed-off-by: Andreas Gerler --- elpa/ox-reveal-20190918.1627/ox-reveal-pkg.el | 2 - .../ox-reveal-autoloads.el | 17 +- elpa/ox-reveal-20221127.814/ox-reveal-pkg.el | 13 + .../ox-reveal.el | 781 +++++++++++++----- 4 files changed, 580 insertions(+), 233 deletions(-) delete mode 100644 elpa/ox-reveal-20190918.1627/ox-reveal-pkg.el rename elpa/{ox-reveal-20190918.1627 => ox-reveal-20221127.814}/ox-reveal-autoloads.el (60%) create mode 100644 elpa/ox-reveal-20221127.814/ox-reveal-pkg.el rename elpa/{ox-reveal-20190918.1627 => ox-reveal-20221127.814}/ox-reveal.el (62%) diff --git a/elpa/ox-reveal-20190918.1627/ox-reveal-pkg.el b/elpa/ox-reveal-20190918.1627/ox-reveal-pkg.el deleted file mode 100644 index 295d95a7..00000000 --- a/elpa/ox-reveal-20190918.1627/ox-reveal-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "ox-reveal" "20190918.1627" "reveal.js Presentation Back-End for Org Export Engine" '((org "8.3")) :commit "5fd940e01ae76ba305d46a0c0cfc4d27aa131d33" :keywords '("outlines" "hypermedia" "slideshow" "presentation") :authors '(("Yujie Wen ")) :maintainer '("Yujie Wen ")) diff --git a/elpa/ox-reveal-20190918.1627/ox-reveal-autoloads.el b/elpa/ox-reveal-20221127.814/ox-reveal-autoloads.el similarity index 60% rename from elpa/ox-reveal-20190918.1627/ox-reveal-autoloads.el rename to elpa/ox-reveal-20221127.814/ox-reveal-autoloads.el index 04974066..85fb540f 100644 --- a/elpa/ox-reveal-20190918.1627/ox-reveal-autoloads.el +++ b/elpa/ox-reveal-20221127.814/ox-reveal-autoloads.el @@ -1,10 +1,12 @@ -;;; ox-reveal-autoloads.el --- automatically extracted autoloads +;;; ox-reveal-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "ox-reveal" "ox-reveal.el" (23994 46390 928438 -;;;;;; 537000)) +;;;### (autoloads nil "ox-reveal" "ox-reveal.el" (0 0 0 0)) ;;; Generated autoloads from ox-reveal.el (autoload 'org-reveal-publish-to-reveal "ox-reveal" "\ @@ -18,11 +20,18 @@ Return output file name. \(fn PLIST FILENAME PUB-DIR)" nil nil) +(register-definition-prefixes "ox-reveal" '("frag-" "if-format" "org-reveal-")) + +;;;*** + +;;;### (autoloads nil nil ("ox-reveal-pkg.el") (0 0 0 0)) + ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; ox-reveal-autoloads.el ends here diff --git a/elpa/ox-reveal-20221127.814/ox-reveal-pkg.el b/elpa/ox-reveal-20221127.814/ox-reveal-pkg.el new file mode 100644 index 00000000..88cda634 --- /dev/null +++ b/elpa/ox-reveal-20221127.814/ox-reveal-pkg.el @@ -0,0 +1,13 @@ +(define-package "ox-reveal" "20221127.814" "reveal.js Presentation Back-End for Org Export Engine" + '((org "8.3")) + :commit "f55c851bf6aeb1bb2a7f6cf0f2b7bd0e79c4a5a0" :authors + '(("Yujie Wen ")) + :maintainers + '(("Yujie Wen ")) + :maintainer + '("Yujie Wen ") + :keywords + '("outlines" "hypermedia" "slideshow" "presentation")) +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/ox-reveal-20190918.1627/ox-reveal.el b/elpa/ox-reveal-20221127.814/ox-reveal.el similarity index 62% rename from elpa/ox-reveal-20190918.1627/ox-reveal.el rename to elpa/ox-reveal-20221127.814/ox-reveal.el index 93a587b9..f4d4e947 100644 --- a/elpa/ox-reveal-20190918.1627/ox-reveal.el +++ b/elpa/ox-reveal-20221127.814/ox-reveal.el @@ -5,7 +5,6 @@ ;; Author: Yujie Wen ;; Created: 2013-04-27 ;; Version: 1.0 -;; Package-Version: 20190918.1627 ;; Package-Requires: ((org "8.3")) ;; Keywords: outlines, hypermedia, slideshow, presentation @@ -33,7 +32,7 @@ ;;; Code: (require 'ox-html) -(require 'cl) +(require 'cl-lib) (org-export-define-derived-backend 'reveal 'html @@ -74,6 +73,13 @@ (:reveal-title-slide-background-repeat "REVEAL_TITLE_SLIDE_BACKGROUND_REPEAT" nil nil t) (:reveal-title-slide-background-transition "REVEAL_TITLE_SLIDE_BACKGROUND_TRANSITION" nil nil t) (:reveal-title-slide-background-opacity "REVEAL_TITLE_SLIDE_BACKGROUND_OPACITY" nil nil t) + (:reveal-title-slide-state "REVEAL_TITLE_SLIDE_STATE" nil nil t) + (:reveal-toc-slide-background "REVEAL_TOC_SLIDE_BACKGROUND" nil nil t) + (:reveal-toc-slide-background-size "REVEAL_TOC_SLIDE_BACKGROUND_SIZE" nil nil t) + (:reveal-toc-slide-background-position "REVEAL_TOC_SLIDE_BACKGROUND_POSITION" nil nil t) + (:reveal-toc-slide-background-repeat "REVEAL_TOC_SLIDE_BACKGROUND_REPEAT" nil nil t) + (:reveal-toc-slide-background-transition "REVEAL_TOC_SLIDE_BACKGROUND_TRANSITION" nil nil t) + (:reveal-toc-slide-background-opacity "REVEAL_TOC_SLIDE_BACKGROUND_OPACITY" nil nil t) (:reveal-default-slide-background "REVEAL_DEFAULT_SLIDE_BACKGROUND" nil nil t) (:reveal-default-slide-background-size "REVEAL_DEFAULT_SLIDE_BACKGROUND_SIZE" nil nil t) (:reveal-default-slide-background-position "REVEAL_DEFAULT_SLIDE_BACKGROUND_POSITION" nil nil t) @@ -84,6 +90,8 @@ (:reveal-preamble "REVEAL_PREAMBLE" nil org-reveal-preamble t) (:reveal-head-preamble "REVEAL_HEAD_PREAMBLE" nil org-reveal-head-preamble newline) (:reveal-postamble "REVEAL_POSTAMBLE" nil org-reveal-postamble t) + (:reveal-prologue "REVEAL_PROLOGUE" nil org-reveal-prologue t) + (:reveal-epilogue "REVEAL_EPILOGUE" nil org-reveal-epilogue t) (:reveal-multiplex-id "REVEAL_MULTIPLEX_ID" nil org-reveal-multiplex-id nil) (:reveal-multiplex-secret "REVEAL_MULTIPLEX_SECRET" nil org-reveal-multiplex-secret nil) (:reveal-multiplex-url "REVEAL_MULTIPLEX_URL" nil org-reveal-multiplex-url nil) @@ -91,12 +99,15 @@ (: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-extra-script-before-src "REVEAL_EXTRA_SCRIPT_BEFORE_SRC" nil org-reveal-extra-script-before-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) ) :translate-alist @@ -122,7 +133,8 @@ (defcustom org-reveal-root "./reveal.js" "The root directory of reveal.js packages. It is the directory within which js/reveal.js is." - :group 'org-export-reveal) + :group 'org-export-reveal + :type 'string) (defcustom org-reveal-hlevel 1 "The minimum level of headings that should be grouped into @@ -157,13 +169,13 @@ slide, where the following escaping elements are allowed: (defcustom org-reveal-init-options "" "Reveal.js initialization options, JS code snippet to be -embedded into Reveal.initilize()." +embedded into Reveal.initialize()." :group 'org-export-reveal :type 'string) (defcustom org-reveal-transition "default" - "Reveal transistion style." + "Reveal transition style." :group 'org-export-reveal :type 'string) @@ -234,6 +246,16 @@ embedded into Reveal.initilize()." :group 'org-export-reveal :type 'string) +(defcustom org-reveal-prologue nil + "Prologue contents to be inserted between opening
and
." + :group 'org-export-reveal + :type 'string) + +(defcustom org-reveal-epilogue nil + "Prologue contents to be inserted between closing
and
." + :group 'org-export-reveal + :type 'string) + (defcustom org-reveal-slide-header nil "HTML content used as Reveal.js slide header" :group 'org-export-reveal @@ -262,11 +284,10 @@ embedded into Reveal.initilize()." :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) @@ -277,10 +298,28 @@ embedded into Reveal.initilize()." (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" (plist-get info :reveal-mathjax-url)))) +(defun org-reveal--get-plugins (info) + (let ((buffer-plugins (condition-case e + (car (read-from-string (plist-get info :reveal-plugins))) + (end-of-file nil) + (wrong-type-argument nil)))) + (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--script-tag-by-file-name (fname in-single-file) + "Create a \n") + ;; Cannot read fname, just error out + (error (concat "Cannot generate single file presentation due to " + local-fname + " is not readable")))) + (format "\n" fname))) + +(defun org-reveal--script-tags-by-auto-file-names (fnames in-single-file) + "Create multiple ") - ;; Fall-back to extern script links - (if in-single-file - ;; Tried to embed scripts but failed. Print a message about possible errors. - (error (concat "Cannot read " - (mapconcat 'identity - (delq nil (mapcar (lambda (file) (if (not (file-readable-p file)) file)) - (list local-reveal-js))) - ", ")))) - (concat - "\n")) + (org-reveal--script-tag-by-file-name local-reveal-js in-single-file) ;; plugin headings - " - tags before the call to Reveal.initialize() + (org-reveal--script-tags-by-auto-file-names (plist-get info :reveal-extra-script-before-src) + in-single-file) + + ;; 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' + (let ((multiplex-id (plist-get info :reveal-multiplex-id))) + (when (not (string-empty-p multiplex-id)) ;Multiplex setup found + (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")) + 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 " + " - ;; 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 (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))) - (let ((buffer-plugins (condition-case e - (car (read-from-string (plist-get info :reveal-plugins))) - (end-of-file nil) - (wrong-type-argument nil)))) - (or (and buffer-plugins (listp buffer-plugins) buffer-plugins) - org-reveal-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)))))) - - (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\n"))) - + (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 tags + (org-reveal--script-tags-by-auto-file-names (plist-get info :reveal-extra-script-src) + in-single-file)))) + +(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--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 in-single-file) + "Return scripts for initializing reveal.js 4.x builtin scripts." + ;; Return a pair whose first value is the HTML contents for the + ;; plugin scripts, the second value is a list of import statements + ;; 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 pair, a list of script file names + (let ((root-path (org-reveal-root-path info))) + (org-reveal--multi-level-mapconcat + (lambda (p) + (org-reveal--script-tag-by-file-name (org-reveal--replace-first-%s p root-path) + in-single-file)) + plugin-js "")) + ;; Second value of the tuple, a list of Reveal plugin + ;; initialization statements + (format "plugins: [%s]" + (mapconcat 'symbol-name + ;; Remove multiplex from plugins, as + ;; the multiplex plugin has been moved + ;; out of reveal.js. + (seq-filter (lambda (p) (not (eq p 'multiplex))) 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))) (when toc - (let ((toc-slide-with-header (plist-get info :reveal-slide-global-header)) + (let ((toc-slide-background (plist-get info :reveal-toc-slide-background)) + (toc-slide-background-size (plist-get info :reveal-toc-slide-background-size)) + (toc-slide-background-position (plist-get info :reveal-toc-slide-background-position)) + (toc-slide-background-repeat (plist-get info :reveal-toc-slide-background-repeat)) + (toc-slide-background-transition (plist-get info :reveal-toc-slide-background-transition)) + (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 "
\n" + (concat "
" (when toc-slide-with-header (let ((header (plist-get info :reveal-slide-header))) (when header (format "
%s
\n" header)))) @@ -706,7 +1028,7 @@ holding export options." (defun org-reveal-parse-token (keyword info key &optional value) "Return HTML tags or perform SIDE EFFECT according to key. Use the previous section tag as the tag of the split section. " - (case (intern key) + (cl-case (intern key) (split (let ((headline (org-element-property :parent @@ -761,7 +1083,7 @@ Use the previous section tag as the tag of the split section. " (and checkbox " "))) (br (org-html-close-tag "br" nil info))) (concat - (case type + (cl-case type (ordered (let* ((counter term-counter-id) (extra (if counter (format " value=\"%s\"" counter) ""))) @@ -780,10 +1102,10 @@ Use the previous section tag as the tag of the split section. " ;; Check-boxes in descriptive lists are associated to tag. (concat (format "%s" attr-html (concat checkbox term)) - (format "" attr-html))))) + (format "" attr-html))))) (unless (eq type 'descriptive) checkbox) (and contents (org-trim contents)) - (case type + (cl-case type (ordered "") (unordered "") (descriptive ""))))) @@ -811,7 +1133,7 @@ and may change custom variables as SIDE EFFECT. CONTENTS is nil. INFO is a plist holding contextual information." (let ((key (org-element-property :key keyword)) (value (org-element-property :value keyword))) - (case (intern key) + (cl-case (intern key) (REVEAL (org-reveal-parse-keyword-value keyword value info)) (REVEAL_HTML value) (HTML value)))) @@ -892,7 +1214,7 @@ CONTENTS is the contents of the list. INFO is a plist holding contextual information. Extract and set `attr_html' to plain-list tag attributes." - (let ((tag (case (org-element-property :type plain-list) + (let ((tag (cl-case (org-element-property :type plain-list) (ordered "ol") (unordered "ul") (descriptive "dl"))) @@ -964,13 +1286,12 @@ contextual information." (when num-start (format num-fmt line-num)) loc))) num-start)))) - (frag (org-export-read-attribute :attr_reveal src-block :frag)) (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") @@ -978,12 +1299,13 @@ contextual information." ((string= lang "scheme") "selector_eval_scheme") ((string= lang "ruby") "selector_eval_ruby") ((string= lang "html") "selector_eval_html")) - ) -) + )) (if (not lang) - (format "
\n%s
" - (or (frag-class frag info) " class=\"example\"") - label + (format "
\n%s
" + (string-join (list (or (frag-class src-block info) " class=\"example\"") + label) + " ") + code) (if klipsify (concat @@ -1011,26 +1333,34 @@ window.klipse_settings = { " langselector ": \".klipse\" }; '> ") (format - "
\n%s%s\n
" - (if (not caption) "" - (format "" - (org-export-data caption info))) - (if use-highlight - (format "\n%s" - (or (frag-class frag info) "") - label lang code-attribs code) - (format "\n
%s
" - (or (frag-class frag info) - (format " class=\"src src-%s\"" lang)) - label code) - ))))))) + "
\n%s%s\n
" + (if (not caption) "" + (format "" + (org-export-data caption info))) + (if use-highlight + (format "\n
%s
" + (string-join (list (or (frag-class src-block info) "") + label + data-id) + " ") + lang code-attribs code) + (format "\n
%s
" + (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. CONTENTS holds the contents of the block INFO is a plist holding contextual information." (format "
\n%s
" - (frag-class (org-export-read-attribute :attr_reveal quote-block :frag) info) + (or (frag-class quote-block info) + "") contents)) @@ -1038,7 +1368,7 @@ contextual information." "Generate the automatic title slide template." (let* ((spec (org-html-format-spec info)) (title (org-export-data (plist-get info :title) info)) - (subtitle (plist-get info :subtitle)) + (subtitle (cdr (assq ?s spec))) (author (cdr (assq ?a spec))) (email (cdr (assq ?e spec))) (date (cdr (assq ?d spec)))) @@ -1072,9 +1402,9 @@ info is a plist holding export options." (if-format " lang=\"%s\"" (plist-get info :language))) "\n" (if-format "%s\n" (org-export-data (plist-get info :title) info)) - (if-format "\n" (plist-get info :author)) - (if-format "\n" (plist-get info :description)) - (if-format "\n" (plist-get info :keywords)) + (if-format "\n" (org-export-data (plist-get info :author) info)) + (if-format "\n" (org-export-data (plist-get info :description) info)) + (if-format "\n" (org-export-data (plist-get info :keywords) info)) (org-reveal-stylesheets info) (org-reveal-mathjax-scripts info) (org-reveal--build-pre/postamble 'head-preamble info) @@ -1083,8 +1413,9 @@ info is a plist holding export options." " \n" (org-reveal--build-pre/postamble 'preamble info) - "
-
\n" + "
\n" + (org-reveal--build-pre/postamble 'prologue info) + "
\n" ;; Title slides (let ((title-slide (plist-get info :reveal-title-slide))) (when (and title-slide (not (plist-get info :reveal-subtree))) @@ -1094,6 +1425,7 @@ info is a plist holding export options." (title-slide-background-repeat (plist-get info :reveal-title-slide-background-repeat)) (title-slide-background-transition (plist-get info :reveal-title-slide-background-transition)) (title-slide-background-opacity (plist-get info :reveal-title-slide-background-opacity)) + (title-slide-state (plist-get info :reveal-title-slide-state)) (title-slide-with-header (plist-get info :reveal-slide-global-header)) (title-slide-with-footer (plist-get info :reveal-slide-global-footer))) (concat "
" (when title-slide-with-header (let ((header (plist-get info :reveal-slide-header))) @@ -1122,8 +1456,9 @@ info is a plist holding export options." (when footer (format "
%s
\n" footer)))) "
\n")))) contents - "
-
\n" + "
\n" + (org-reveal--build-pre/postamble 'epilogue info) + "
\n" (org-reveal--build-pre/postamble 'postamble info) (org-reveal-scripts info) " @@ -1163,7 +1498,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 @@ -1226,41 +1561,39 @@ transformed fragment attribute to ELEM's attr_html plist." frag-list)) (items (org-element-contents elem)) (default-style-list - (mapcar (lambda (a) default-style) - (number-sequence 1 (length items))))) + (mapcar (lambda (a) default-style) + (number-sequence 1 (length items))))) (if frag-index - (mapcar* 'org-reveal--update-attr-html - items frag-list default-style-list (car (read-from-string frag-index))) + (cl-mapcar 'org-reveal--update-attr-html + items frag-list default-style-list (car (read-from-string frag-index))) (let* ((last-frag (car (last frag-list))) (tail-list (mapcar (lambda (a) last-frag) (number-sequence (+ (length frag-list) 1) (length items))))) (nconc frag-list tail-list) - (mapcar* 'org-reveal--update-attr-html items frag-list default-style-list))))) + (cl-mapcar 'org-reveal--update-attr-html items frag-list default-style-list))))) (t (org-reveal--update-attr-html elem frag default-style frag-index))) elem))) -(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)) - (clientfile (org-export-output-file-name (concat "_client" extension) subtreep))) + (clientfile (org-export-output-file-name (concat "_client" extension) subtreep)) + (org-export-exclude-tags (cons "noexport_reveal" org-export-exclude-tags)) + (client-multiplex nil)) ; 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)) + (let ((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) + ; export the client HTML file if client-multiplex is set true + ; by previous call to org-export-to-file + (when client-multiplex (org-export-to-file 'reveal clientfile async subtreep visible-only body-only ext-plist)) - retfile)) + retfile))) (defun org-reveal-export-to-html-and-browse (&optional async subtreep visible-only body-only ext-plist) @@ -1275,7 +1608,6 @@ transformed fragment attribute to ELEM's attr_html plist." (org-narrow-to-subtree) (let ((ret (org-reveal-export-to-html async subtreep visible-only body-only (plist-put ext-plist :reveal-subtree t)))) (widen) - (message "Obsoleting soon. Use the \"Export scope\" switch instead to utilize parent heading properties.") ret)) ;; Generate a heading of ToC for current buffer and write to current @@ -1322,15 +1654,10 @@ is the property list for the given project. PUB-DIR is the publishing directory. Return output file name." - (org-publish-org-to 'reveal filename ".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")))) + (let ((client-multiplex nil)) + (org-publish-org-to 'reveal filename ".html" plist pub-dir) + (when client-multiplex + (org-publish-org-to 'reveal filename "_client.html" plist pub-dir)))) (provide 'ox-reveal) -- 2.47.3