From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Baier Subject: Re: [Exporter] Export of property drawers Date: Fri, 10 May 2013 15:14:49 +0200 Message-ID: <87mws3vuwm.fsf@gmail.com> References: <87r4hgxfrx.fsf@gmail.com> <87fvxwni3q.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57206) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uan9h-0006XJ-Ci for emacs-orgmode@gnu.org; Fri, 10 May 2013 09:14:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uan9f-0003We-Jd for emacs-orgmode@gnu.org; Fri, 10 May 2013 09:14:37 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:33283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uan9f-0003WL-8J for emacs-orgmode@gnu.org; Fri, 10 May 2013 09:14:35 -0400 Received: by mail-ee0-f44.google.com with SMTP id b57so142766eek.31 for ; Fri, 10 May 2013 06:14:34 -0700 (PDT) In-Reply-To: <87fvxwni3q.fsf@gmail.com> (Nicolas Goaziou's message of "Thu, 09 May 2013 20:13:05 +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: Nicolas Goaziou Cc: Alexander Baier , emacs-orgmode@gnu.org Hello Nicolas, thank you for the clarification and examples, they helped a lot and I got it working as I wanted it. Regards, Alex Nicolas Goaziou writes: > Hello, > > Alexander Baier writes: > >> i want to export property drawers of an org-file to ASCII. How do I do >> this? I got the impression, that the exporter does not touch the >> properties drawers. So I started to fiddle with the exporter but got no >> satisfying results out of it. > > You can either define a new back-end, as you did, or defadvice the > current one. >> >> This is what i tried so far: >> >> The elisp i wrote in this process: >> =============================================================================== >> (defun org-tut-ascii-translater-property-drawer (drawer backend info) >> (let ((prop (org-element-property :properties drawer))) >> (format "%S" prop))) ;; i just wanted to see, if anything arrives >> here > > There is no `:properties' attribute for property drawers. Also you are > mixing translators and filters: arguments for translators are ELEMENT > CONTENTS INFO. Use, for example: > > (defun my-ascii-property-drawer (drawer contents info) > contents) > > >> (org-export-define-derived-backend 'my-ascii 'ascii >> :translate-alist '((template . >> org-tut-ascii-translater-property-drawer))) > > Replace `template' with `property-drawer'. You also need to define > a translator for `node-property' elements, e.g., > > (defun my-ascii-node-property (node-prop contents info) > (concat (org-element-property :key node-prop) > ": " > (org-element-property :value node-prop))) > > and > > (org-export-define-derived-backend 'my-ascii 'ascii > :translate-alist '((property-drawer . my-ascii-property-drawer) > (node-property . my-ascii-node-property))) > > > Regards,