From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Antczak Subject: Re: How to export drawer? Date: Fri, 04 Apr 2014 23:06:11 +0200 Message-ID: <87ob0gajp8.fsf@neutrico-themes.pl> References: <87mwg1xx8w.fsf@neutrico-themes.pl> <87zjk07vwu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWBKl-0007mH-8y for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:07:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWBKd-00077b-S6 for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:07:31 -0400 Received: from 5.mo2.mail-out.ovh.net ([87.98.181.248]:37857 helo=mo2.mail-out.ovh.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWBKd-00077M-Iu for emacs-orgmode@gnu.org; Fri, 04 Apr 2014 17:07:23 -0400 Received: from mail427.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo2.mail-out.ovh.net (Postfix) with SMTP id 4F0BFFF83A1 for ; Fri, 4 Apr 2014 23:07:22 +0200 (CEST) In-reply-to: <87zjk07vwu.fsf@gmail.com> 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > Marcin Antczak writes: > >> I would like to export some org to html with custom backend based on >> 'html. >> >> What I need is to override function org-html-headline from ox-html.el > > OK. But this isn't related to drawers, is it? If you want to alter > drawers export, you need to override `org-html-drawer' too. Unfortunately you misunderstood me. What I want to do is to override drawers export to exclude some predefined drawers. Let's say: LOGBOOK and CLOCKTABLE. Then I want to attach these drawers to headline(!) This is why I want to add a piece of code to return drawer in org-html-headline. > >> I just want to export drawer with some specific name. For example >> LOGBOOK or CLOCKTABLE. > > You can set `org-export-with-drawers'. You can also hard-code the list > into `org-mybackend-drawer': > > (defun org-mybackend-drawer (drawer contents info) > (when (member-ignore-case (org-element-property :drawer-name drawer) > '("LOGBOOK" "CLOCKTABLE")) > (org-export-data-with-backend drawer 'html info))) Yes. I want to hard-code these drawers and ignore them in default export. 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. Regards, -- Marcin