diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d67e215 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +*.html +*.elc \ No newline at end of file diff --git a/Readme.org b/Readme.org index 499bda8..d367f01 100644 --- a/Readme.org +++ b/Readme.org @@ -251,15 +251,6 @@ $ git clone https://github.com/yjwen/org-reveal.git ratio. * =#+REVEAL_MAX_SCALE:= :: a float number, the maximum scaling up ratio. -** 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 @@ -319,7 +310,6 @@ $ git clone https://github.com/yjwen/org-reveal.git =org-reveal-history=, =org-reveal-center=, =org-reveal-rolling-links=, =org-reveal-keyaboard, =org-reveal-overview= For an example, please refer to the heading part of this document. - ** Source Codes Org-reveal use Org-Babel to highlight source codes. @@ -398,7 +388,6 @@ $ git clone https://github.com/yjwen/org-reveal.git is omitted, so it won't disturb slide contents. Check the generated HTML to see how it works. - ** Raw HTML in Slides Besides the Org contents, you can embed raw HTML contents @@ -425,6 +414,27 @@ $ git clone https://github.com/yjwen/org-reveal.git Enter speaker notes here. ,#+END_NOTES #+END_SRC +** 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: url-to-custom-stylesheet.css +#+END_SRC + +** Extra Dependent Script + + Set =REVEAL_EXTRA_JS= to the url of extra reveal.js dependent + script if necessary. +#+BEGIN_SRC org + #+REVEAL_EXTRA_JS: url-to-custom-script.js +#+END_SRC + +** Extra Slide attribute + + Set property =reveal_extra_attr= to headings to add any necessary attributes + to slides. * Tips diff --git a/ox-reveal.el b/ox-reveal.el index 237f622..6021b6b 100644 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -56,6 +56,7 @@ (: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-extra-js "REVEAL_EXTRA_JS" 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) @@ -280,7 +281,7 @@ holding contextual information." ;; into vertical ones. "
\n") ;; Start a new slide. - (format "
\n" + (format "
\n" (or (org-element-property :CUSTOM_ID headline) (concat "sec-" (mapconcat 'number-to-string (org-export-get-headline-number headline info) @@ -289,7 +290,8 @@ holding contextual information." (if-format " data-background=\"%s\"" (org-element-property :REVEAL_BACKGROUND headline)) (if-format " data-background-size=\"%s\"" (org-element-property :REVEAL_BACKGROUND_SIZE headline)) (if-format " data-background-repeat=\"%s\"" (org-element-property :REVEAL_BACKGROUND_REPEAT headline)) - (if-format " data-background-transition=\"%s\"" (org-element-property :REVEAL_BACKGROUND_TRANS headline))) + (if-format " data-background-transition=\"%s\"" (org-element-property :REVEAL_BACKGROUND_TRANS headline)) + (org-element-property :REVEAL_EXTRA_ATTR headline)) ;; The HTML content of this headline. (format "\n%s\n" level1 @@ -343,7 +345,7 @@ using custom variable `org-reveal-root'." (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 "" extra-css) "")) (pdf-css (org-reveal--append-pathes css-dir-name '("print" "pdf.css")))) (format " @@ -369,7 +371,8 @@ custom variable `org-reveal-root'." (lib-dir-name (org-reveal--append-path root-path "lib")) (lib-js-dir-name (org-reveal--append-path lib-dir-name "js")) (plugin-dir-name (org-reveal--append-path root-path "plugin")) - (markdown-dir-name (org-reveal--append-path plugin-dir-name "markdown"))) + (markdown-dir-name (org-reveal--append-path plugin-dir-name "markdown")) + (extra-js (plist-get info :reveal-extra-js))) (concat (format "\n\n" (org-reveal--append-path lib-js-dir-name "head.min.js") @@ -424,14 +427,15 @@ custom variable `org-reveal-root'." (format " // Optional libraries used to extend on reveal.js dependencies: [ - { src: '%s', condition: function() { return !document.body.classList; } }, - { src: '%s', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '%s', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, - { src: '%s', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, - { src: '%s', async: true, condition: function() { return !!document.body.classList; } }, - { src: '%s', async: true, condition: function() { return !!document.body.classList; } } + { src: '%s', condition: function() { return !document.body.classList; } } + ,{ src: '%s', condition: function() { return !!document.querySelector( '[data-markdown]' ); } } + ,{ src: '%s', condition: function() { return !!document.querySelector( '[data-markdown]' ); } } + ,{ src: '%s', async: true, callback: function() { hljs.initHighlightingOnLoad(); } } + ,{ src: '%s', async: true, condition: function() { return !!document.body.classList; } } + ,{ src: '%s', async: true, condition: function() { return !!document.body.classList; } } // { src: '%s', async: true, condition: function() { return !!document.body.classList; } } // { src: '%s', async: true, condition: function() { return !!document.body.classList; } } + %s ] });\n" (org-reveal--append-path lib-js-dir-name "classList.js") @@ -441,7 +445,8 @@ custom variable `org-reveal-root'." (org-reveal--append-pathes plugin-dir-name '("zoom-js" "zoom.js")) (org-reveal--append-pathes plugin-dir-name '("notes" "notes.js")) (org-reveal--append-pathes plugin-dir-name '("search" "search.js")) - (org-reveal--append-pathes plugin-dir-name '("remotes" "remotes.js"))) + (org-reveal--append-pathes plugin-dir-name '("remotes" "remotes.js")) + (if extra-js (concat "," extra-js) "")) "\n"))) (defun org-reveal-toc-headlines-r (headlines info prev_level hlevel prev_x prev_y)