From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: SUMMARY: [Feature Request] Make property-drawers exportable Date: Wed, 25 Sep 2013 14:08:16 +0200 Message-ID: <39CF3890-4884-4894-8670-627AC5B4E935@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> <87a9j115m0.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/signed; boundary="Apple-Mail=_DA5599A7-5D0B-4B9B-86C3-9A7E814304B1"; protocol="application/pgp-signature"; micalg=pgp-sha1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOntS-00031n-LD for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 08:08:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOntJ-0000eS-Jr for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 08:08:34 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:60756) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOntJ-0000eO-9f for emacs-orgmode@gnu.org; Wed, 25 Sep 2013 08:08:25 -0400 Received: by mail-we0-f179.google.com with SMTP id x55so5840713wes.24 for ; Wed, 25 Sep 2013 05:08:24 -0700 (PDT) In-Reply-To: <87a9j115m0.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: Thorsten Jolitz , emacs-orgmode@gnu.org --Apple-Mail=_DA5599A7-5D0B-4B9B-86C3-9A7E814304B1 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 25.9.2013, at 13:51, Nicolas Goaziou wrote: > 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; This sounds good to me. How about allowing also a function as a value and that function will receive the list of properties and do with it as it pleases. I like it! - Carsten > > 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 --Apple-Mail=_DA5599A7-5D0B-4B9B-86C3-9A7E814304B1 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJSQtIwAAoJEO+gg/nAZuwMgO8IAIB55N7Lr886Guxg9URSt5sG aMJ+Jzvm99MRSNiz8iXxmUmYc1/6WoXxIomX50fgGKwTlN5kvo3QHzzQGpqF1KT8 0BfeRS/EYbTncCg1uP/tg7jQHiGygVW9YMFwREZQUVRfakilMLY+5n5oagnle9Bf fswlR+jiKLKIjtNHLRGryWFsTTArGFvdYTlh8YgARxjZJdyEoOmSYWss3H87DF77 KEAIfUgzaVI4QV6O1ixqDsFAcfTlh692XZ3sy5ADk4Ba4K/Bh9lvxkm/HnLVrzDS qnnciPNP275RrwxQ9A+7hqyeYfmjYL00nRxCEFQO84YvmE1xtkXnFWTxRd3le3A= =YgPR -----END PGP SIGNATURE----- --Apple-Mail=_DA5599A7-5D0B-4B9B-86C3-9A7E814304B1--