Merge pull request #251 from stvol/master

add global header/footer support
This commit is contained in:
Yujie Wen 2016-12-05 17:05:18 +08:00 committed by GitHub
commit 05d107b7ec
2 changed files with 53 additions and 17 deletions

View File

@ -337,6 +337,10 @@
=#+REVEAL_SLIDE_FOOTER:=. The option content will be put into
divisions of class =slide-header= and =slide-footer=, so you can
control their appearance in custom CSS file(see [[Extra Stylesheets]]).
By default header/footer content will only display on content
slides. To show them also on the title and toc slide you can add
~reveal_global_header:t~ and ~reveal_global_footer:t~ to
~#+OPTIONS:~ line.
** Fragmented Contents

View File

@ -64,6 +64,8 @@
(: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-slide-global-header nil "reveal_global_header" org-reveal-global-header t)
(:reveal-slide-global-footer nil "reveal_global_footer" org-reveal-global-footer t)
(: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-position "REVEAL_TITLE_SLIDE_BACKGROUND_POSITION" nil nil t)
@ -296,6 +298,18 @@ content."
:group 'org-export-reveal
:type 'string)
(defcustom org-reveal-global-header nil
"If non nil, slide header defined in org-reveal-slide-header
is displayed also on title and toc slide"
:group 'org-export-reveal
:type 'boolean)
(defcustom org-reveal-global-footer nil
"If non nil, slide footer defined in org-reveal-slide-footer
is displayed also on title and toc slide"
:group 'org-export-reveal
:type 'boolean)
(defcustom org-reveal-slide-footer nil
"HTML content used as Reveal.js slide footer"
:group 'org-export-reveal
@ -720,9 +734,18 @@ dependencies: [
(defun org-reveal-toc (depth info)
"Build a slide of table of contents."
(let ((toc (org-html-toc depth info)))
(if toc
(format "<section id=\"table-of-contents\">\n%s</section>\n"
(replace-regexp-in-string "<a href=\"#" "<a href=\"#/slide-" toc)))))
(when toc
(let ((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\">\n"
(when toc-slide-with-header
(let ((header (plist-get info :reveal-slide-header)))
(when header (format "<div class=\"slide-header\">%s</div>\n" header))))
(replace-regexp-in-string "<a href=\"#" "<a href=\"#/slide-" toc)
(when toc-slide-with-footer
(let ((footer (plist-get info :reveal-slide-footer)))
(when footer (format "<div class=\"slide-footer\">%s</div>\n" footer))))
"</section>\n")))))
(defun org-reveal-inner-template (contents info)
"Return body of document string after HTML conversion.
@ -1044,7 +1067,9 @@ info is a plist holding export options."
(title-slide-background-size (plist-get info :reveal-title-slide-background-size))
(title-slide-background-position (plist-get info :reveal-title-slide-background-position))
(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-transition (plist-get info :reveal-title-slide-background-transition))
(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\""
(when title-slide-background
(concat " data-background=\"" title-slide-background "\""))
@ -1057,10 +1082,17 @@ info is a plist holding export options."
(when title-slide-background-transition
(concat " data-background-transition=\"" title-slide-background-transition "\""))
">"
(when title-slide-with-header
(let ((header (plist-get info :reveal-slide-header)))
(when header (format "<div class=\"slide-header\">%s</div>\n" header))))
(cond ((eq title-slide nil) nil)
((stringp title-slide) (format-spec title-slide (org-html-format-spec info)))
((eq title-slide 'auto) (org-reveal--auto-title-slide-template info)))
"\n</section>\n"))))
"\n"
(when title-slide-with-footer
(let ((footer (plist-get info :reveal-slide-footer)))
(when footer (format "<div class=\"slide-footer\">%s</div>\n" footer))))
"</section>\n"))))
contents
"</div>
</div>\n"