emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Marcin Antczak <marcin.antczak@neutrico-themes.pl>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to export drawer?
Date: Fri, 04 Apr 2014 23:49:36 +0200	[thread overview]
Message-ID: <87r45c7ojz.fsf@gmail.com> (raw)
In-Reply-To: <87ob0gajp8.fsf@neutrico-themes.pl> (Marcin Antczak's message of "Fri, 04 Apr 2014 23:06:11 +0200")

Marcin Antczak <marcin.antczak@neutrico-themes.pl> 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

  reply	other threads:[~2014-04-04 21:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-04  9:25 How to export drawer? Marcin Antczak
2014-04-04 19:10 ` Nicolas Goaziou
2014-04-04 21:06   ` Marcin Antczak
2014-04-04 21:49     ` Nicolas Goaziou [this message]
2014-04-04 22:06       ` Marcin Antczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r45c7ojz.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=marcin.antczak@neutrico-themes.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).