mirror of https://github.com/yjwen/org-reveal.git
Support fragment index for list items.
This commit is contained in:
parent
a79ec359d9
commit
a124e751e4
50
ox-reveal.el
50
ox-reveal.el
|
@ -860,51 +860,39 @@ Assuming BACKEND is `reveal'.
|
||||||
Each `attr_reveal' attribute is mapped to corresponding
|
Each `attr_reveal' attribute is mapped to corresponding
|
||||||
`attr_html' attributes."
|
`attr_html' attributes."
|
||||||
(org-element-map tree (remq 'item org-element-all-elements)
|
(org-element-map tree (remq 'item org-element-all-elements)
|
||||||
(lambda (elem)
|
'org-reveal-append-frag)
|
||||||
"Append ELEM's fragment attributes."
|
|
||||||
(org-reveal-append-frag elem)
|
|
||||||
(org-reveal-append-frag-index elem)))
|
|
||||||
;; Return the updated tree.
|
;; Return the updated tree.
|
||||||
tree)
|
tree)
|
||||||
|
|
||||||
(defun org-reveal--update-attr-html (elem frag-attr)
|
(defun org-reveal--update-attr-html (elem frag &optional frag-index)
|
||||||
"Update ELEM's attr_html atrribute with reveal's
|
"Update ELEM's attr_html atrribute with reveal's
|
||||||
fragment attributes."
|
fragment attributes."
|
||||||
(let ((attr-html (org-element-property :attr_html elem)))
|
(let ((attr-html (org-element-property :attr_html elem)))
|
||||||
(push (cond ((string= frag-attr t) ":class fragment")
|
(when (and frag (not (string= frag "none")))
|
||||||
(t (format ":class fragment %s" frag-attr)))
|
(push (cond ((string= frag t) ":class fragment")
|
||||||
attr-html)
|
(t (format ":class fragment %s" frag)))
|
||||||
|
attr-html)
|
||||||
|
(when frag-index
|
||||||
|
(push (format ":data-fragment-index %s" frag-index) attr-html)))
|
||||||
(org-element-put-property elem :attr_html attr-html)))
|
(org-element-put-property elem :attr_html attr-html)))
|
||||||
|
|
||||||
(defun org-reveal-append-frag (elem)
|
(defun org-reveal-append-frag (elem)
|
||||||
"Read org-reveal's fragment attribute from ELEM and append
|
"Read org-reveal's fragment attribute from ELEM and append
|
||||||
transformed fragment attribute to ELEM's attr_html plist."
|
transformed fragment attribute to ELEM's attr_html plist."
|
||||||
(let ((frag-attr (org-export-read-attribute :attr_reveal elem :frag)))
|
(let ((frag (org-export-read-attribute :attr_reveal elem :frag))
|
||||||
(if frag-attr
|
(frag-index (org-export-read-attribute :attr_reveal elem :frag_idx)))
|
||||||
|
(if frag
|
||||||
(cond ((and (string= (org-element-type elem) 'plain-list)
|
(cond ((and (string= (org-element-type elem) 'plain-list)
|
||||||
(char-equal (string-to-char frag-attr) ?\())
|
(char-equal (string-to-char frag) ?\())
|
||||||
(mapcar*
|
(let ((frag-list (car (read-from-string frag)))
|
||||||
(lambda (item frag)
|
(items (org-element-contents elem)))
|
||||||
"Append reveal's fragment attribute to item's
|
(if frag-index
|
||||||
`:attr_html' property."
|
(mapcar* 'org-reveal--update-attr-html
|
||||||
(and (not (string= frag "none"))
|
items frag-list (car (read-from-string frag-index)))
|
||||||
(org-reveal--update-attr-html item frag))
|
(mapcar* 'org-reveal--update-attr-html items frag-list))))
|
||||||
;; Return nil.
|
(t (org-reveal--update-attr-html elem frag frag-index))))
|
||||||
nil)
|
|
||||||
(org-element-contents elem)
|
|
||||||
(car (read-from-string frag-attr))))
|
|
||||||
(t (org-reveal--update-attr-html elem frag-attr))))
|
|
||||||
elem))
|
elem))
|
||||||
|
|
||||||
(defun org-reveal-append-frag-index (elem)
|
|
||||||
"Read org-reveal's fragment index from ELEM and append
|
|
||||||
transformed fragment index attribute to ELEM's atr_html plist."
|
|
||||||
(let ((frag-index (org-export-read-attribute :attr_reveal elem :frag_idx)))
|
|
||||||
(if frag-index
|
|
||||||
(let ((attr-html (org-element-property :attr_html elem)))
|
|
||||||
(push (concat ":data-fragment-index " frag-index) attr-html)
|
|
||||||
(org-element-put-property elem :attr_html attr-html)))))
|
|
||||||
|
|
||||||
(defvar client-multiplex nil
|
(defvar client-multiplex nil
|
||||||
"used to cause generation of client html file for multiplex")
|
"used to cause generation of client html file for multiplex")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue