From 9df81317ccce4d3e7e71f5bbeaaf9356cf5f76da Mon Sep 17 00:00:00 2001 From: Ayush Goyal Date: Tue, 30 Jul 2019 12:13:48 +0530 Subject: [PATCH] Add support for defining global reveal_extra_attrs Currently, if you want to apply common extra attr to each slide, you need to add a new PROPERTIES section for each heading. This change allows for defining a global value for reveal-extra-attr, which can be applied to all slides. --- Readme.org | 17 +++++++++++++++-- org-re-reveal.el | 12 +++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Readme.org b/Readme.org index 791f3c4..6308e7c 100644 --- a/Readme.org +++ b/Readme.org @@ -11,6 +11,7 @@ # Copyright (C) 2013-2018 Yujie Wen and contributors to org-reveal, see: # https://github.com/yjwen/org-reveal/commits/master # Copyright (C) 2017-2019 Jens Lechtenbörger +# Copyright (C) 2019 Ayush Goyal #+OPTIONS: reveal_center:t reveal_progress:t reveal_history:nil reveal_control:t #+OPTIONS: reveal_rolling_links:t reveal_keyboard:t reveal_overview:t num:nil @@ -864,8 +865,20 @@ embedded figures considerably: ** Extra Slide Attribute - Set property =reveal_extra_attr= to headings to add any necessary attributes - to slides. + Set =REVEAL_EXTRA_ATTR= to add any additional attributes to all slides if + required. +#+BEGIN_SRC org +,#+REVEAL_EXTRA_ATTR: data-autoslide=20000 +#+END_SRC + + This global default value can also be overridden per heading by setting + =reveal_extra_attr= property on the headings. +#+BEGIN_SRC org +,*** Heading with overriden autoslide + :PROPERTIES: + :reveal_extra_attr: data-autoslide=10000 + :END: +#+END_SRC ** Export into Single File diff --git a/org-re-reveal.el b/org-re-reveal.el index 1421490..5dd2395 100644 --- a/org-re-reveal.el +++ b/org-re-reveal.el @@ -5,6 +5,7 @@ ;; https://github.com/yjwen/org-reveal/commits/master ;; Copyright (C) 2017-2019 Jens Lechtenbörger ;; Copyright (C) 2019 Naoya Yamashita +;; Copyright (C) 2019 Ayush Goyal ;; URL: https://gitlab.com/oer/org-re-reveal ;; Version: 1.1.6 @@ -112,6 +113,7 @@ (:reveal-theme "REVEAL_THEME" nil org-re-reveal-theme t) (:reveal-extra-css "REVEAL_EXTRA_CSS" nil org-re-reveal-extra-css newline) (:reveal-extra-js "REVEAL_EXTRA_JS" nil org-re-reveal-extra-js nil) + (:reveal-extra-attr "REVEAL_EXTRA_ATTR" nil org-re-reveal-extra-attr nil) (:reveal-hlevel "REVEAL_HLEVEL" nil nil t) (:reveal-title-slide "REVEAL_TITLE_SLIDE" nil org-re-reveal-title-slide newline) (:reveal-academic-title "REVEAL_ACADEMIC_TITLE" nil nil t) @@ -295,6 +297,13 @@ slide's HTML code (containing the above escape sequences)." :group 'org-export-re-reveal :type 'string) +(defcustom org-re-reveal-extra-attr nil + "Global Reveal Extra Attrs for all slides." + :group 'org-export-re-reveal + :type '(choice + string + (const nil))) + (defcustom org-re-reveal-extra-css "" "URL to extra css file." :group 'org-export-re-reveal @@ -745,7 +754,8 @@ holding contextual information." (footer-div (if footer (format org-re-reveal-slide-footer-html footer) "")) (first-sibling (org-export-first-sibling-p headline info)) (attrs (org-re-reveal--section-attrs headline info)) - (extra-attrs (org-element-property :REVEAL_EXTRA_ATTR headline)) + (extra-attrs (or (org-element-property :REVEAL_EXTRA_ATTR headline) + (plist-get info :reveal-extra-attr))) (slide-section-tag (format "
\n" (format "%s%s" org-re-reveal--slide-id-prefix preferred-id) attrs -- GitLab