ox-reveal update

This commit is contained in:
2022-04-25 18:47:51 +02:00
parent 2ff6f7e396
commit 2db1c0afe0
84 changed files with 15869 additions and 5383 deletions

View File

@@ -2311,5 +2311,13 @@ a:link::selection, a:link::-moz-selection {
(org-export-to-file 'article-html file async subtreep
visible-only body-only ext-plist)))
(defun my-org-article-help ()
"Open the `org-ref' manual."
(interactive)
(find-file (expand-file-name
"my-org-article.org"
(file-name-directory
(find-library-name "my-org-article")))))
(provide 'my-org-article)
;;; my-org-article.el ends here

View File

@@ -5,8 +5,8 @@
;; Author: Yujie Wen <yjwen.ty at gmail dot com>
;; Created: 2013-04-27
;; Version: 1.0
;; Package-Version: 20211128.1509
;; Package-Commit: 59adea80013e962811b204403cc500a4d28b85a0
;; Package-Version: 20220410.1533
;; Package-Commit: 862b41df7734f57019543f6bd82ff7dad7183358
;; Package-Requires: ((org "8.3"))
;; Keywords: outlines, hypermedia, slideshow, presentation
@@ -75,6 +75,7 @@
(: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)
@@ -103,6 +104,7 @@
(:reveal-single-file nil "reveal_single_file" org-reveal-single-file t)
(: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)
@@ -323,7 +325,12 @@ Example:
:type 'string)
(defcustom org-reveal-extra-script-src '()
"Custom script source that will be embedded in a <script src> tag."
"Custom script source that will be embedded in a <script src> tag, after the call to Reveal.initialize()."
:group 'org-export-reveal
:type 'list)
(defcustom org-reveal-extra-script-before-src '()
"Custom script source that will be embedded in a <script src> tag, before the call to Reveal.initialize()."
:group 'org-export-reveal
:type 'list)
@@ -736,6 +743,44 @@ dependencies: [
(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 <script> tag for including scripts from the given
file name. If in single file mode, the <script> tag encloses the
contents of the file, otherwise it is a tag pointing to the file"
(if in-single-file
(let ((local-fname (org-reveal--file-url-to-path fname)))
(if (file-readable-p local-fname)
;; Embed script into HTML
(concat "<script>\n"
(org-reveal--read-file local-fname)
"\n</script>\n")
;; Cannot read fname, just error out
(error (concat "Cannot generate single file presentation due to "
local-fname
" is not readable"))))
(format "<script src=\"%s\"></script>\n" fname)))
(defun org-reveal--script-tags-by-auto-file-names (fnames in-single-file)
"Create multiple <script> tags for multiple file names, but
also accept single file name and create only one tag."
(if (stringp fnames)
(org-reveal--script-tag-by-file-name fnames in-single-file)
(mapconcat (lambda (fname)
(org-reveal--script-tag-by-file-name fname in-single-file))
fnames
"")))
(defun org-reveal--multi-level-mapconcat (func sequence seperator)
"Multilevel mapconcat. FUNC is applied to each element of seq
unless the element itself is a list, in which case func is
lifted and applied."
(mapconcat (lambda (e)
(if (listp e)
(org-reveal--multi-level-mapconcat func e seperator)
(funcall func e)))
sequence seperator))
(defun org-reveal-scripts (info)
"Return the necessary scripts for initializing reveal.js using
custom variable `org-reveal-root'."
@@ -746,31 +791,20 @@ custom variable `org-reveal-root'."
(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"))
(plugins (org-reveal--get-plugins info))
(in-single-file (plist-get info :reveal-single-file))
(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)))
(org-reveal-plugin-scripts-4 plugins info in-single-file)
(cons nil nil))))
(concat
;; reveal.js/js/reveal.js
(if (and in-single-file
(file-readable-p local-reveal-js))
;; Embed scripts into HTML
(concat "<script>\n"
(org-reveal--read-file local-reveal-js)
"\n</script>")
;; 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
"<script src=\"" reveal-js "\"></script>\n"))
(org-reveal--script-tag-by-file-name local-reveal-js in-single-file)
;; plugin headings
(if-format "%s\n" (car reveal-4-plugin))
;; Extra <script src="..."></script> 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))
@@ -822,15 +856,8 @@ Reveal.initialize({
;; 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"))))))
(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)))
@@ -875,12 +902,11 @@ Reveal.initialize({
;; nil, no %s or %% found
fmt)))
(defun org-reveal-plugin-scripts-4 (plugins info)
"Return scripts for initializing reveal.js 4.x builtin scripts"
;; 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
(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
@@ -915,23 +941,13 @@ Reveal.initialize({
plugins))))
(if (not (null plugin-js))
(cons
;; First value of the tuple, a list of scripts HTML tags
;; First value of the pair, a list of script file names
(let ((root-path (org-reveal-root-path info)))
(mapconcat
(org-reveal--multi-level-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
""))
(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]"
@@ -1332,7 +1348,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))))
@@ -1366,9 +1382,9 @@ info is a plist holding export options."
(if-format " lang=\"%s\"" (plist-get info :language)))
"<meta charset=\"utf-8\"/>\n"
(if-format "<title>%s</title>\n" (org-export-data (plist-get info :title) info))
(if-format "<meta name=\"author\" content=\"%s\"/>\n" (plist-get info :author))
(if-format "<meta name=\"description\" content=\"%s\"/>\n" (plist-get info :description))
(if-format "<meta name=\"keywords\" content=\"%s\"/>\n" (plist-get info :keywords))
(if-format "<meta name=\"author\" content=\"%s\"/>\n" (org-export-data (plist-get info :author) info))
(if-format "<meta name=\"description\" content=\"%s\"/>\n" (org-export-data (plist-get info :description) info))
(if-format "<meta name=\"keywords\" content=\"%s\"/>\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)
@@ -1388,6 +1404,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 "<section id=\"sec-title-slide\""
@@ -1403,6 +1420,8 @@ info is a plist holding export options."
(concat " data-background-transition=\"" title-slide-background-transition "\""))
(when title-slide-background-opacity
(concat " data-background-opacity=\"" title-slide-background-opacity "\""))
(when title-slide-state
(concat " data-state=\"" title-slide-state "\""))
">"
(when title-slide-with-header
(let ((header (plist-get info :reveal-slide-header)))

View File

@@ -80,7 +80,7 @@
| org-table-sticky-header.el | [[https://melpa.org/#/org-table-sticky-header][melpa]] | 0.1.0 | 20190924.506 | | | (alternative orgtbl-show-header) |
| orgit.el | [[https://melpa.org/#/orgit][mepla]] | 1.6.0 | 20210620.1943 | 1.6.0 | 20200714.1943 | |
| ov.el | [[https://melpa.org/#/ov][melpa]] | 1.0.6 | 20200326.1042 | | | |
| ox-reveal.el | [[https://melpa.org/#/ox-reveal][melpa]] | 1.0 | 20211128.1509 | 1.0 | 20201211.1518 | requires https://github.com/hakimel/reveal.js |
| ox-reveal.el | [[https://melpa.org/#/ox-reveal][melpa]] | 1.0 | 20220410.1533 | 1.0 | 20211128.1509 | requires https://github.com/hakimel/reveal.js |
| ox-tufte.el | [[https://melpa.org/#/ox-tufte][melpa]] | 1.0.0 | 20160926.1607 | | | |
| page-break-lines.el | [[https://melpa.org/#/page-break-lines][melpa]] | 0 | 20210104.2224 | 0 | 20200305.244 | required by dashboard |
| parsebib.el | [[https://melpa.org/#/parsebib][melpa]] | 3.0 | 20211208.2335 | 2.3 | 20200513.2352 | required by org-ref |