From 44ea78886e25d36ed8545aaece090ffd6d434349 Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Thu, 3 Mar 2016 21:40:02 -0500 Subject: [PATCH 1/7] Attach data-transition attribute at outer section The attribute to override slide transitions must be attached to the outer section to have an effect. --- ox-reveal.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ox-reveal.el b/ox-reveal.el index 9c9c772..eb5a438 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -417,14 +417,19 @@ holding contextual information." "\n"))) (if (<= level hlevel) ;; Add an extra "
" to group following slides - ;; into vertical slide group. - "
\n") + ;; into vertical slide group. Transition override + ;; attributes are attached at this level, too. + (let ((attrs + (org-html--make-attribute-string + `(:data-transition ,(org-element-property :REVEAL_DATA_TRANSITION headline))))) + (if (string-empty-p attrs) + "
\n" + (format "
\n" attrs)))) ;; Start a new slide. (format "
\n" (org-html--make-attribute-string `(:id ,(format "slide-%s" preferred-id) :data-state ,(org-element-property :REVEAL_DATA_STATE headline) - :data-transition ,(org-element-property :REVEAL_DATA_TRANSITION headline) :data-background ,(org-element-property :REVEAL_BACKGROUND headline) :data-background-size ,(org-element-property :REVEAL_BACKGROUND_SIZE headline) :data-background-repeat ,(org-element-property :REVEAL_BACKGROUND_REPEAT headline) From ca05044846d8491a7641ec1e0429a5717611f72d Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Tue, 8 Mar 2016 01:11:10 -0500 Subject: [PATCH 2/7] Don't use subr-x function. This library wasn't properly required, so the previous patch for data-transition didn't work with a compiled ox-reveal. Now we simply inline the definition of string-empty-p ourselves as it is trivial. --- ox-reveal.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ox-reveal.el b/ox-reveal.el index eb5a438..62a3fef 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -422,7 +422,7 @@ holding contextual information." (let ((attrs (org-html--make-attribute-string `(:data-transition ,(org-element-property :REVEAL_DATA_TRANSITION headline))))) - (if (string-empty-p attrs) + (if (string= attrs "") "
\n" (format "
\n" attrs)))) ;; Start a new slide. From 414ccf16260f28c9310ccfa130c9787584203331 Mon Sep 17 00:00:00 2001 From: yujie Date: Tue, 12 Apr 2016 17:14:44 +0800 Subject: [PATCH 3/7] Fixed #202: Embed extra CSS when in reveal_single_file --- ox-reveal.el | 54 +++++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/ox-reveal.el b/ox-reveal.el index 62a3fef..48dbbf5 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -474,6 +474,25 @@ holding contextual information." (if (string-equal system-type "windows-nt") "^file:///" "^file://") "" url)) +(defun org-reveal--css-label (in-single-file file-name style-id) + "Generate an HTML label for including a CSS file, if + IN-SINGLE-FILE is t, the content of FILE-NAME is embedded, + otherwise, a `' label is generated." + (when (and file-name (not (string= file-name ""))) + (if in-single-file + ;; Single-file + (let ((local-file-name (org-reveal--file-url-to-path file-name))) + (if (file-readable-p local-file-name) + (concat "\n") + ;; But file is not readable. + (error "Cannot read %s" file-name))) + ;; Not in-single-file + (concat "\n")))) + (defun org-reveal-stylesheets (info) "Return the HTML contents for declaring reveal stylesheets using custom variable `org-reveal-root'." @@ -481,10 +500,7 @@ using custom variable `org-reveal-root'." (reveal-css (concat root-path "css/reveal.css")) (theme (plist-get info :reveal-theme)) (theme-css (concat root-path "css/theme/" theme ".css")) - ;; Local file names. - (local-root (org-reveal--file-url-to-path root-path)) - (local-reveal-css (concat local-root "css/reveal.css")) - (local-theme-css (concat local-root "css/theme/" theme ".css")) + (extra-css (plist-get info :reveal-extra-css)) (in-single-file (plist-get info :reveal-single-file))) (concat ;; Default embedded style sheets @@ -493,30 +509,12 @@ using custom variable `org-reveal-root'." " ;; stylesheets - (if (and in-single-file - (file-readable-p local-reveal-css) - (file-readable-p local-theme-css)) - ;; CSS files exist and are readable. Embed them. - (concat "\n") - ;; Fall-back to external CSS links. - (if in-single-file - ;; Tried to embed CSS files 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-css local-theme-css))) - ", ")))) - ;; Create links to CSS files. - (concat "\n" - "\n")) - ;; extra css - (let ((extra-css (plist-get info :reveal-extra-css))) - (if (string= extra-css "") "" - (format "\n" extra-css))) + (mapconcat (lambda (elem) (org-reveal--css-label in-single-file (car elem) (cdr elem))) + (list (cons reveal-css nil) + (cons theme-css "theme") + (cons extra-css nil)) + "\n") + ;; Include CSS for highlight.js if necessary (if (org-reveal--using-highlight.js info) (format "" From 2ce8c935128b95c4f28b03679abd460f55febe67 Mon Sep 17 00:00:00 2001 From: yujie Date: Wed, 13 Apr 2016 18:27:37 +0800 Subject: [PATCH 4/7] Fixed #199: Automatic title slide to honor exporting options. --- ox-reveal.el | 93 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 32 deletions(-) diff --git a/ox-reveal.el b/ox-reveal.el index 48dbbf5..3b5617f 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -64,7 +64,6 @@ (:reveal-extra-js "REVEAL_EXTRA_JS" nil org-reveal-extra-js nil) (:reveal-hlevel "REVEAL_HLEVEL" nil nil t) (:reveal-title-slide nil "reveal_title_slide" org-reveal-title-slide t) - (:reveal-title-slide-template "REVEAL_TITLE_SLIDE_TEMPLATE" nil org-reveal-title-slide-template space) (:reveal-title-slide-background "REVEAL_TITLE_SLIDE_BACKGROUND" nil nil t) (:reveal-title-slide-background-size "REVEAL_TITLE_SLIDE_BACKGROUND_SIZE" nil nil t) (:reveal-title-slide-background-repeat "REVEAL_TITLE_SLIDE_BACKGROUND_REPEAT" nil nil t) @@ -125,27 +124,22 @@ else get value from custom variable `org-reveal-hlevel'." (if hlevel-str (string-to-number hlevel-str) org-reveal-hlevel))) -(defcustom org-reveal-title-slide t - "Include a title slide." - :group 'org-export-reveal - :type 'boolean) +(defcustom org-reveal-title-slide 'auto + "Non-nil means insert a title slide. -(defcustom org-reveal-title-slide-template - "

%t

-

%a

-

%e

-

%d

" - "Format template to specify title page slide. The format string -can contain the following escaping elements: +When set to `auto', an automatic title slide is generated. When +set to a string, use this string as a format string for title +slide, where the following escaping elements are allowed: - %s stands for the title. + %s stands for the title %a stands for the author's name. %e stands for the author's email. - %d stands for the date. - %% stands for a literal %. -" + %d stands for the data. + %% stands for a literal %." :group 'org-export-reveal - :type 'string) + :type '(choice (const :tag "No title slide" nil) + (const :tag "Auto title slide" 'auto) + (string :tag "Custom title slide"))) (defcustom org-reveal-transition "default" @@ -958,6 +952,35 @@ contextual information." contents)) +(defun org-reveal--auto-title-slide-template (info) + "Generate the automatic title slide template." + (let* ((spec (org-html-format-spec info)) + (title (org-export-data (plist-get info :title) info)) + (author (cdr (assq ?a spec))) + (email (cdr (assq ?e spec))) + (date (cdr (assq ?d spec)))) + (message "date=%s" date) + (concat + (when (and (plist-get info :with-title) + (org-string-nw-p title)) + (concat "

" title "

")) + (when (and (plist-get info :with-author) + (org-string-nw-p author)) + (concat "

" author "

")) + (when (and (plist-get info :with-email) + (org-string-nw-p email)) + (concat "

" email "

")) + (when (and (plist-get info :with-date) + (org-string-nw-p date)) + (concat "

" date "

")) + (when (plist-get info :time-stamp-file) + (concat "

" + (org-html--translate "Created" info) + ": " + (format-time-string + (plist-get info :html-metadata-timestamp-format)) + "

"))))) + (defun org-reveal-template (contents info) "Return complete document string after HTML conversion. contents is the transcoded contents string. @@ -978,21 +1001,27 @@ info is a plist holding export options." (org-reveal--build-pre/postamble 'preamble info) "
\n" - (if (and (plist-get info :reveal-title-slide) - (not (plist-get info :reveal-subtree))) - (concat - (format "
\n" - (if-format " data-background=\"%s\"" - (plist-get info :reveal-title-slide-background)) - (if-format " data-background-size=\"%s\"" - (plist-get info :reveal-title-slide-background-size)) - (if-format " data-background-repeat=\"%s\"" - (plist-get info :reveal-title-slide-background-repeat)) - (if-format " data-background-transition=\"%s\"" - (plist-get info :reveal-title-slide-background-transition))) - (format-spec (plist-get info :reveal-title-slide-template) (org-html-format-spec info)) - "\n
\n") - "") + ;; Title slides + (let ((title-slide (plist-get info :reveal-title-slide))) + (when (and title-slide (not (plist-get info :reveal-subtree))) + (let ((title-slide-background (plist-get info :reveal-title-slide-background)) + (title-slide-background-size (plist-get info :reveal-title-slide-background-size)) + (title-slide-background-repeat (plist-get info :reveal-title-slide-background-repeat)) + (title-slide-background-transition (plist-get info :reveal-title-slide-background-transition))) + (concat "
" + (cond ((eq title-slide nil) nil) + ((stringp title-slide) (format-spec title-slide (org-html-format-spec))) + ((eq title-slide 'auto) (org-reveal--auto-title-slide-template info))) + "\n
\n")))) contents "
\n" From e9e2c6293ab459b14c6488935c1a734b559c09be Mon Sep 17 00:00:00 2001 From: yujie Date: Thu, 14 Apr 2016 14:26:58 +0800 Subject: [PATCH 5/7] Add documents for setting the title slide. --- Readme.org | 22 ++++++++++++++++++++++ ox-reveal.el | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Readme.org b/Readme.org index 89f953c..703e3af 100644 --- a/Readme.org +++ b/Readme.org @@ -214,6 +214,28 @@ Available themes can be found in "css/theme/" in the reveal.js directory. Available transitions are: default|cube|page|concave|zoom|linear|fade|none. +** Set The Title Slide + By default, Org-reveal generates a title slide displaying the + title, the author, the Email, the date and the time-stamp of the + Org document, controlled by Org's [[http://orgmode.org/org.html#Export-settings][export settings]]. + + To avoid a title slide, please set variable + ~org-reveal-title-slide~ to ~nil~, or add ~reveal_title_slide:nil~ to + ~#+OPTIONS:~ line. + + To restore the default title slide, please set variable + ~org-reveal-title-slide~ to ~'auto~. + +*** Customize the Title Slide + + To customize the title slide, please set ~org-reveal-title-slide~ + to a string of HTML markups. The following escaping character can + be used to retrieve document information: + | ~%s~ | Title | + | ~%a~ | Author | + | ~%e~ | Email | + | ~%d~ | Date | + | ~%%~ | Literal % | ** Set Slide Background diff --git a/ox-reveal.el b/ox-reveal.el index 3b5617f..8f39a26 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -134,7 +134,7 @@ slide, where the following escaping elements are allowed: %s stands for the title %a stands for the author's name. %e stands for the author's email. - %d stands for the data. + %d stands for the date. %% stands for a literal %." :group 'org-export-reveal :type '(choice (const :tag "No title slide" nil) From bba166fa6a51a67608da0df4b5f8df75b4b5864a Mon Sep 17 00:00:00 2001 From: yujie Date: Wed, 4 May 2016 17:33:44 +0800 Subject: [PATCH 6/7] Fixed 182, add data-transition on both outer and inner
tags. --- ox-reveal.el | 1 + 1 file changed, 1 insertion(+) diff --git a/ox-reveal.el b/ox-reveal.el index 8f39a26..9942d84 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -423,6 +423,7 @@ holding contextual information." (format "
\n" (org-html--make-attribute-string `(:id ,(format "slide-%s" preferred-id) + :data-transition ,(org-element-property :REVEAL_DATA_TRANSITION headline) :data-state ,(org-element-property :REVEAL_DATA_STATE headline) :data-background ,(org-element-property :REVEAL_BACKGROUND headline) :data-background-size ,(org-element-property :REVEAL_BACKGROUND_SIZE headline) From a8e841aaa4e1fb1e6c8dab3ceafa4e7472a7882f Mon Sep 17 00:00:00 2001 From: yujie Date: Wed, 4 May 2016 17:33:44 +0800 Subject: [PATCH 7/7] Fixed #182, add data-transition to both outer and inner
tag --- ox-reveal.el | 1 + 1 file changed, 1 insertion(+) diff --git a/ox-reveal.el b/ox-reveal.el index 8f39a26..9942d84 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -423,6 +423,7 @@ holding contextual information." (format "
\n" (org-html--make-attribute-string `(:id ,(format "slide-%s" preferred-id) + :data-transition ,(org-element-property :REVEAL_DATA_TRANSITION headline) :data-state ,(org-element-property :REVEAL_DATA_STATE headline) :data-background ,(org-element-property :REVEAL_BACKGROUND headline) :data-background-size ,(org-element-property :REVEAL_BACKGROUND_SIZE headline)