[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] SUMMARY: [Feature Request] Make property-drawers exportable

From: Carsten Dominik
Subject: Re: [O] SUMMARY: [Feature Request] Make property-drawers exportable
Date: Wed, 25 Sep 2013 14:08:16 +0200

On 25.9.2013, at 13:51, Nicolas Goaziou <address@hidden> wrote:

> Hello,
> Carsten Dominik <address@hidden> 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

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

reply via email to

[Prev in Thread] Current Thread [Next in Thread]