From 3f998031a50b027c2eaf49cc0c35e33e5009a12b Mon Sep 17 00:00:00 2001 From: Yujie Wen Date: Sun, 30 Mar 2014 15:59:06 +0800 Subject: [PATCH] Add default fragment style. --- Readme.org | 2 ++ ox-reveal.el | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Readme.org b/Readme.org index e64460c..d2ff711 100755 --- a/Readme.org +++ b/Readme.org @@ -291,6 +291,8 @@ $ git clone https://github.com/yjwen/org-reveal.git * highlight-green #+ATTR_REVEAL: :frag highlight-blue * highlight-blue + + Use default fragment style by setting ":frag t". ** Data State :PROPERTIES: diff --git a/ox-reveal.el b/ox-reveal.el index cdf631b..de1b092 100755 --- a/ox-reveal.el +++ b/ox-reveal.el @@ -225,6 +225,13 @@ can be include." (defun if-format (fmt val) (if val (format fmt val) "")) +(defun frag-class (frag) + ;; Return proper HTML string description of fragment style. + (cond + ((string= frag t) " class=\"fragment\"") + (frag (format " class=\"fragment %s\"" frag)))) + + (defun org-reveal-export-block (export-block contents info) "Transocde a EXPORT-BLOCK element from Org to Reveal. CONTENTS is nil. NFO is a plist holding contextual information." @@ -549,19 +556,19 @@ holding export options." (concat "" (if headline (concat headline "
")))) (unordered (concat "" (if headline (concat headline "
")))) (descriptive (concat "" (concat checkbox (or term-counter-id "(no term)")) "
"))) @@ -635,8 +642,8 @@ the plist used as a communication channel." (replace-match (concat "class=\"figure fragment " frag " \"") t t contents)) contents))) (t (format "\n%s

" - (if-format " class=\"fragment %s\"" - (org-export-read-attribute :attr_reveal paragraph :frag)) + (or (frag-class (org-export-read-attribute :attr_reveal paragraph :frag)) + "") contents))))) (defun org-reveal--build-pre/postamble (type info) @@ -673,18 +680,19 @@ contextual information." (if (not lbl) "" (format " id=\"%s\"" (org-export-solidify-link-text lbl)))))) - (if (not lang) (format "
\n%s
" - (if frag (format "fragment %s" frag) "example") - label code) + (if (not lang) + (format "
\n%s
" + (or (frag-class frag) " class=\"example\"") + label + code) (format "
\n%s%s\n
" (if (not caption) "" (format "" (org-export-data caption info))) - (format "\n
%s
" - (if frag - (format "fragment %s" frag) - (format "src src-%s" lang)) + (format "\n
%s
" + (or (frag-class frag) + (format " class=\"src src-%s" lang)) label code)))))) (defun org-reveal-template (contents info)