Add default fragment style.

This commit is contained in:
Yujie Wen 2014-03-30 15:59:06 +08:00
parent b4f4aa1e33
commit 3f998031a5
2 changed files with 22 additions and 12 deletions

View File

@ -291,6 +291,8 @@ $ git clone https://github.com/yjwen/org-reveal.git
* highlight-green * highlight-green
#+ATTR_REVEAL: :frag highlight-blue #+ATTR_REVEAL: :frag highlight-blue
* highlight-blue * highlight-blue
Use default fragment style by setting ":frag t".
** Data State ** Data State
:PROPERTIES: :PROPERTIES:

View File

@ -225,6 +225,13 @@ can be include."
(defun if-format (fmt val) (defun if-format (fmt val)
(if val (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) (defun org-reveal-export-block (export-block contents info)
"Transocde a EXPORT-BLOCK element from Org to Reveal. "Transocde a EXPORT-BLOCK element from Org to Reveal.
CONTENTS is nil. NFO is a plist holding contextual information." CONTENTS is nil. NFO is a plist holding contextual information."
@ -549,19 +556,19 @@ holding export options."
(concat (concat
"<li" "<li"
(if-format " value=\"%s\"" term-counter-id) (if-format " value=\"%s\"" term-counter-id)
(if-format " class=\"fragment %s\"" frag) (frag-class frag)
">" ">"
(if headline (concat headline "<br/>")))) (if headline (concat headline "<br/>"))))
(unordered (unordered
(concat (concat
"<li" "<li"
(if-format " class=\"fragment %s\"" frag) (frag-class frag)
">" ">"
(if headline (concat headline "<br/>")))) (if headline (concat headline "<br/>"))))
(descriptive (descriptive
(concat (concat
"<dt" "<dt"
(if-format " class=\"fragment %s\"" frag) (frag-class frag)
"><b>" "><b>"
(concat checkbox (or term-counter-id "(no term)")) (concat checkbox (or term-counter-id "(no term)"))
"</b></dt><dd>"))) "</b></dt><dd>")))
@ -635,8 +642,8 @@ the plist used as a communication channel."
(replace-match (concat "class=\"figure fragment " frag " \"") t t contents)) (replace-match (concat "class=\"figure fragment " frag " \"") t t contents))
contents))) contents)))
(t (format "<p%s>\n%s</p>" (t (format "<p%s>\n%s</p>"
(if-format " class=\"fragment %s\"" (or (frag-class (org-export-read-attribute :attr_reveal paragraph :frag))
(org-export-read-attribute :attr_reveal paragraph :frag)) "")
contents))))) contents)))))
(defun org-reveal--build-pre/postamble (type info) (defun org-reveal--build-pre/postamble (type info)
@ -673,18 +680,19 @@ contextual information."
(if (not lbl) "" (if (not lbl) ""
(format " id=\"%s\"" (format " id=\"%s\""
(org-export-solidify-link-text lbl)))))) (org-export-solidify-link-text lbl))))))
(if (not lang) (format "<pre class=\"%s\"%s>\n%s</pre>" (if (not lang)
(if frag (format "fragment %s" frag) "example") (format "<pre %s%s>\n%s</pre>"
label code) (or (frag-class frag) " class=\"example\"")
label
code)
(format (format
"<div class=\"org-src-container\">\n%s%s\n</div>" "<div class=\"org-src-container\">\n%s%s\n</div>"
(if (not caption) "" (if (not caption) ""
(format "<label class=\"org-src-name\">%s</label>" (format "<label class=\"org-src-name\">%s</label>"
(org-export-data caption info))) (org-export-data caption info)))
(format "\n<pre class=\"%s\"%s>%s</pre>" (format "\n<pre %s%s>%s</pre>"
(if frag (or (frag-class frag)
(format "fragment %s" frag) (format " class=\"src src-%s" lang))
(format "src src-%s" lang))
label code)))))) label code))))))
(defun org-reveal-template (contents info) (defun org-reveal-template (contents info)