From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: How to export drawer? Date: Fri, 04 Apr 2014 23:49:36 +0200 Message-ID: <87r45c7ojz.fsf@gmail.com> References: <87mwg1xx8w.fsf@neutrico-themes.pl> <87zjk07vwu.fsf@gmail.com> <87ob0gajp8.fsf@neutrico-themes.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWBz8-00007S-QF for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:49:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWBz3-0002MT-3B for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:49:14 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:49740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWBz2-0002ML-SY for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:49:09 -0400 Received: by mail-wg0-f44.google.com with SMTP id m15so4130796wgh.27 for ; Fri, 04 Apr 2014 14:49:07 -0700 (PDT) In-Reply-To: <87ob0gajp8.fsf@neutrico-themes.pl> (Marcin Antczak's message of "Fri, 04 Apr 2014 23:06:11 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Marcin Antczak Cc: emacs-orgmode@gnu.org Marcin Antczak 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