From 648ca73f52834bb494fb403bc321e67e06d8480f Mon Sep 17 00:00:00 2001 From: Constantine Vetoshev Date: Fri, 7 Jun 2013 17:13:33 -0700 Subject: [PATCH] Add support for loading extra stylesheets to customize themes. --- Readme.org | 9 +++++++++ ox-reveal.el | 14 ++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Readme.org b/Readme.org index ebd4c38..435ba67 100644 --- a/Readme.org +++ b/Readme.org @@ -168,6 +168,15 @@ $ git clone https://github.com/yjwen/org-reveal.git Available transitions are: default|cube|page|concave|zoom|linear|fade|none. +** Extra Stylesheets + + Set =REVEAL_EXTRA_CSS= to a stylesheet file path in order to load extra custom + styles after loading a theme. + +#+BEGIN_SRC org + #+REVEAL_EXTRA_CSS: my-custom-stylesheet.css +#+END_SRC + ** Fragmented Contents Make contents fragmented (show up one-by-one) by setting option =ATTR_REVEAL= with diff --git a/ox-reveal.el b/ox-reveal.el index 15e3dd0..016d839 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -50,6 +50,7 @@ (:reveal-trans "REVEAL_TRANS" nil org-reveal-transition t) (:reveal-speed "REVEAL_SPEED" nil org-reveal-transition-speed t) (:reveal-theme "REVEAL_THEME" nil org-reveal-theme t) + (:reveal-extra-css "REVEAL_EXTRA_CSS" nil nil nil) (:reveal-hlevel "REVEAL_HLEVEL" nil nil t) (:reveal-mathjax nil "reveal_mathjax" org-reveal-mathjax t) (:reveal-mathjax-url "REVEAL_MATHJAX_URL" nil org-reveal-mathjax-url t) @@ -271,7 +272,7 @@ to form a legal path name." (cdr pathes)) dir-name)) - + (defun org-reveal-stylesheets (info) "Return the HTML contents for declaring reveal stylesheets using custom variable `org-reveal-root'." @@ -280,10 +281,15 @@ using custom variable `org-reveal-root'." (min-css-file-name (org-reveal--append-path css-dir-name "reveal.min.css")) (theme-file (format "%s.css" (plist-get info :reveal-theme))) (theme-path (org-reveal--append-path css-dir-name "theme")) - (theme-full (org-reveal--append-path theme-path theme-file))) + (theme-full (org-reveal--append-path theme-path theme-file)) + (extra-css (plist-get info :reveal-extra-css)) + (extra-css-link-tag (if extra-css + (format "" extra-css) + ""))) (format " -\n" - min-css-file-name theme-full))) + +%s\n" + min-css-file-name theme-full extra-css-link-tag))) (defun org-reveal-mathjax-scripts (info) "Return the HTML contents for declaring MathJax scripts"