[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to export drawer?
From: |
Nicolas Goaziou |
Subject: |
Re: [O] How to export drawer? |
Date: |
Fri, 04 Apr 2014 23:49:36 +0200 |
Marcin Antczak <address@hidden> writes:
> Yes. I want to hard-code these drawers and ignore them in default
> export.
OK, I get it. You want to move some drawers (relatively to the flow of
the document) and ignore others.
> Anyway thing is that I want to export drawer with specific name while
> I'm in org-html-headline function.
>
> (defun org-html-headline (headline contents info)
> "Transcode a HEADLINE element from Org to HTML.
> CONTENTS holds the contents of the headline. INFO is a plist
> holding contextual information."
> ;; Empty contents?
> (setq contents (or contents ""))
> (let* ((numberedp (org-export-numbered-headline-p headline info))
> (level (org-export-get-relative-level headline info))
>
> And here I wan't to add:
>
> (clocktable (and (plist-get info :with-drawers)
> (let* ((drawers (org-element-map headline 'drawer 'identity
> info nil 'headline)))
> (mapconcat (lambda (d)
> (when (string= (org-element-property
> :drawer-name d) "CLOCKTABLE")
> (org-export-data-with-backend d 'html
> info)))
> drawers ""))))
>
>
> In this way I could attach HTML code with CLOCKTABLE drawer to headline.
> Unfortunately as I mentioned before I don't know how to achieve this
> without recursion. My code returns all CLOCKTABLE drawers in child
> tasks.
>
> org-element-map has optional argument 'no-recursion' but I don't know
> how to set it up properly.
You can set it to `headline', like you did, but you must skip the
current headline or `org-element-map' will never enter it:
(org-element-map (org-element-contents headline) 'drawer #'identity info nil
'headline)
Regards,
--
Nicolas Goaziou