mirror of https://github.com/yjwen/org-reveal.git
Add pre-filtering function to map attr_reveal value to corresponding attr_html values.
This commit is contained in:
parent
c276f2739f
commit
53c4aba696
35
ox-reveal.el
35
ox-reveal.el
|
@ -47,23 +47,14 @@ default fragment style, otherwise return \"fragment style\"."
|
||||||
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-attr (org-export-read-attribute :attr_reveal elem :frag)))
|
||||||
(if frag-attr
|
(if frag-attr
|
||||||
(let* ((attr-plist (car (cdr elem)))
|
(let ((attr-html (org-element-property :attr_html elem)))
|
||||||
(html-attr (plist-get attr-plist :attr_html)))
|
|
||||||
(push (cond
|
(push (cond
|
||||||
((string= frag-attr t) ":class fragment")
|
((string= frag-attr t) ":class fragment")
|
||||||
(t (format ":class fragment %s" frag-attr)))
|
(t (format ":class fragment %s" frag-attr)))
|
||||||
html-attr)
|
attr-html)
|
||||||
(plist-put attr-plist :attr_html html-attr)))
|
(org-element-put-property elem :attr_html attr-html)))
|
||||||
elem))
|
elem))
|
||||||
|
|
||||||
(defun org-reveal-append-frag-wrapper (html-transcoder)
|
|
||||||
"Return a wrapped transcoder which update element's HTML
|
|
||||||
attribute with Reveal.js's fragment attribute and call
|
|
||||||
HTML-TRANSCODER to perform the transcoding."
|
|
||||||
`(lambda (elem contents info)
|
|
||||||
(org-reveal-append-frag elem)
|
|
||||||
(,html-transcoder elem contents info)))
|
|
||||||
|
|
||||||
(org-export-define-derived-backend 'reveal 'html
|
(org-export-define-derived-backend 'reveal 'html
|
||||||
|
|
||||||
:menu-entry
|
:menu-entry
|
||||||
|
@ -111,18 +102,17 @@ HTML-TRANSCODER to perform the transcoding."
|
||||||
)
|
)
|
||||||
|
|
||||||
:translate-alist
|
:translate-alist
|
||||||
`((export-block . org-reveal-export-block)
|
'((export-block . org-reveal-export-block)
|
||||||
(headline . org-reveal-headline)
|
(headline . org-reveal-headline)
|
||||||
(inner-template . org-reveal-inner-template)
|
(inner-template . org-reveal-inner-template)
|
||||||
(item . org-reveal-item)
|
(item . org-reveal-item)
|
||||||
(keyword . org-reveal-keyword)
|
(keyword . org-reveal-keyword)
|
||||||
(paragraph . ,(org-reveal-append-frag-wrapper 'org-html-paragraph))
|
|
||||||
(quote-block . org-reveal-quote-block)
|
(quote-block . org-reveal-quote-block)
|
||||||
(table . ,(org-reveal-append-frag-wrapper 'org-html-table))
|
|
||||||
(section . org-reveal-section)
|
(section . org-reveal-section)
|
||||||
(src-block . org-reveal-src-block)
|
(src-block . org-reveal-src-block)
|
||||||
(template . org-reveal-template))
|
(template . org-reveal-template))
|
||||||
|
|
||||||
|
:filters-alist '((:filter-parse-tree . org-reveal-filter-parse-tree))
|
||||||
:export-block '("REVEAL" "NOTES")
|
:export-block '("REVEAL" "NOTES")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -855,6 +845,21 @@ info is a plist holding export options."
|
||||||
"</body>
|
"</body>
|
||||||
</html>\n"))
|
</html>\n"))
|
||||||
|
|
||||||
|
(defun org-reveal-filter-parse-tree (tree backend info)
|
||||||
|
"Do filtering before parsing TREE.
|
||||||
|
|
||||||
|
Tree is the parse tree being exported. BACKEND is the export
|
||||||
|
back-end used. INFO is a plist-used as a communication channel.
|
||||||
|
|
||||||
|
Assuming BACKEND is `reveal'.
|
||||||
|
|
||||||
|
Each `attr_reveal' attribute is mapped to corresponding
|
||||||
|
`attr_html' attributes."
|
||||||
|
(org-element-map tree (remq 'item org-element-all-elements)
|
||||||
|
'org-reveal-append-frag)
|
||||||
|
;; Return the updated tree.
|
||||||
|
tree)
|
||||||
|
|
||||||
|
|
||||||
(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