From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: SUMMARY: [Feature Request] Make property-drawers exportable Date: Wed, 25 Sep 2013 13:51:51 +0200 Message-ID: <87a9j115m0.fsf@gmail.com> References: <8738shvzaj.fsf@gmail.com> <87ppvkiz8b.fsf@gmail.com> <87vc5cviu6.fsf@gmail.com> <871u80imo6.fsf@gmail.com> <33429FE3-CAA5-4F58-8536-135F96CA9C11@gmail.com> <406B4BB5-5A38-44EB-AC97-DEA17644164C@gmail.com> <3EAEACD0-1B99-40B7-8A5D-AE491C9F8528@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOndD-0008M5-Dp for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 07:51:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOnd5-0003RN-0p for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 07:51:47 -0400 Received: from mail-we0-x22a.google.com ([2a00:1450:400c:c03::22a]:35505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOnd4-0003R8-QK for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 07:51:38 -0400 Received: by mail-we0-f170.google.com with SMTP id w62so6029045wes.1 for ; Wed, 25 Sep 2013 04:51:37 -0700 (PDT) In-Reply-To: <3EAEACD0-1B99-40B7-8A5D-AE491C9F8528@gmail.com> (Carsten Dominik's message of "Wed, 25 Sep 2013 12:33:17 +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: Carsten Dominik Cc: Thorsten Jolitz , emacs-orgmode@gnu.org Hello, Carsten Dominik writes: > One possible remaining option would be to introduce user variables > org-BACKEND-format-property-drawer-function in analogy > org-BACKEND-format-drawer-function. This would provide an easy way > to configure export of the property drawer as a whole, in a way > that could be file-local. > > I would like to have this option. Nicolas, would you agree to a patch > in this direction? Unfortunately, this is a bit more difficult. Indeed, `node-property' elements are distinct from `property-drawer' elements. I.e., if we want to export property drawers as examples, as you suggested earlier in this thread, we need to implement two functions in each back-end: a transcoder for `node-property' and another one for the `property-drawer' itself. Similarly, in order to implement your current suggestion, we need both `org-BACKEND-format-property-drawer-function' and `org-BACKEND-format-node-property-function'. IMO, this is a bit much for defcustoms, which are sold as an easy way to configure Org behaviour. There may be a slightly different option available: we can introduce a new defcustom, e.g., `org-export-with-node-properties' (what symbol to use for short item in OPTIONS?), which will trigger the following behaviour: - when t, export completely all property drawers as examples; - when nil, do not export property drawers (default value); - when set to a list of strings, export property drawers as examples but only include properties matching these strings; In that case, we need to: 1. patch ox.el to previous behaviour; 2. write two transcoder functions for each back-end where property drawers make sense and install them in back-end definitions. For example, in the `latex' back-end, such functions could be: (defun org-latex-property-drawer (property-drawer contents info) "Transcode a PROPERTY-DRAWER element from Org to LaTeX. CONTENTS is the contents of the drawer, as a string. INFO is a plist holding contextual information." (and (org-string-nw-p contents) (format "\\begin{verbatim}\n%s\\end{verbatim}" contents))) (defun org-latex-node-property (node-property contents info) "Transcode a NODE-PROPERTY element from Org to LaTeX. CONTENTS is nil. INFO is a plist holding contextual information." (format "%s:%s" (org-element-property :key node-property) (let ((value (org-element-property :value node-property))) (if value (concat " " value) "")))) Regards, -- Nicolas Goaziou