* Export of property key:value
@ 2013-07-16 6:21 Edward DeMeulle
2013-07-16 6:45 ` Nicolas Goaziou
0 siblings, 1 reply; 4+ messages in thread
From: Edward DeMeulle @ 2013-07-16 6:21 UTC (permalink / raw)
To: emacs-orgmode
I've been trying to get a handle on this the past couple of days since I
wanted to use column mode for revising properties and then export
(print) the subtree out showing those properties under the heading. I
understand that the exporter changed and now doesn't export the
properties drawer in total (and I think I understand why). It appears,
though, that I have to duplicate the syntax "key: {{{property(key)}}}
for every subheading. It would seem to me that the simplest solution, at
least from the users perspective, would be to have a way to specify
certain property keys to be exported for a particular subtree but I
haven't found that option yet.
This is my simple example. Is there a simpler way to export the amount
property without duplicating "amount: {{{property(amount)}}}" in every
subheading?
#+OPTIONS: toc:nil d:t
* Buy stuff
:PROPERTIES:
:COLUMNS: %25ITEM %TODO %15amount(Amount){$}
:END:
** DONE Buy something
:PROPERTIES:
:amount: 1234.56
:END:
amount: {{{property(amount)}}}
** TODO Buy something else
:PROPERTIES:
:ID: db34ed38-7658-48b4-9770-9a572efcdb11
:amount: 5445.43
:END:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Export of property key:value
2013-07-16 6:21 Export of property key:value Edward DeMeulle
@ 2013-07-16 6:45 ` Nicolas Goaziou
2013-07-27 23:44 ` Edward DeMeulle
2013-07-30 3:11 ` Edward DeMeulle
0 siblings, 2 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2013-07-16 6:45 UTC (permalink / raw)
To: Edward DeMeulle; +Cc: emacs-orgmode
Hello,
Edward DeMeulle <ed@demeulle.org> writes:
> This is my simple example. Is there a simpler way to export the amount
> property without duplicating "amount: {{{property(amount)}}}" in every
> subheading?
>
> #+OPTIONS: toc:nil d:t
>
> * Buy stuff
> :PROPERTIES:
> :COLUMNS: %25ITEM %TODO %15amount(Amount){$}
> :END:
> ** DONE Buy something
> :PROPERTIES:
> :amount: 1234.56
> :END:
> amount: {{{property(amount)}}}
>
> ** TODO Buy something else
> :PROPERTIES:
> :ID: db34ed38-7658-48b4-9770-9a572efcdb11
> :amount: 5445.43
> :END:
You can use a hook (e.g., `org-export-before-processing-hook) to insert
"amount : {{{property(amount)}}}" (or with `org-entry-get', you don't
need the macro in that case) after each property drawer with an amount
property.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Export of property key:value
2013-07-16 6:45 ` Nicolas Goaziou
@ 2013-07-27 23:44 ` Edward DeMeulle
2013-07-30 3:11 ` Edward DeMeulle
1 sibling, 0 replies; 4+ messages in thread
From: Edward DeMeulle @ 2013-07-27 23:44 UTC (permalink / raw)
To: emacs-orgmode
Thanks for the info. I took it up as a challenge to finally learn a
little elisp. This is what I have so far, which appears to work as long
as I expand the entire subtree to be exported. I'd appreciate any
criticism since I really don't know if I'm handling things the best
possible way.
(defun ewd/export-properties (backend)
"Export all property names listed in EXPORT_PROPERTIES in the format:
- <name>: <value> after each heading of specified level
NOTE: 1st value in EXPORT_PROPERTIES is heading level"
(if (org-entry-get (point) "EXPORT_PROPERTIES")
(let* (
(export_properties (split-string
(org-entry-get (point) "EXPORT_PROPERTIES") " "))
(export-level (string-to-number (car export_properties)))
(export-list (cdr export_properties))
)
(org-map-entries
(lambda ()
(next-line)
(open-line 1)
(dolist (prop export-list)
(if (= export-level (car (org-heading-components)))
(progn (insert "- " prop ": "
(if (org-entry-get (point) prop)
(org-entry-get (point) prop) "N/A"))
(newline)))))))))
(add-hook 'org-export-before-processing-hook 'ewd/export-properties)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Export of property key:value
2013-07-16 6:45 ` Nicolas Goaziou
2013-07-27 23:44 ` Edward DeMeulle
@ 2013-07-30 3:11 ` Edward DeMeulle
1 sibling, 0 replies; 4+ messages in thread
From: Edward DeMeulle @ 2013-07-30 3:11 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> You can use a hook (e.g., `org-export-before-processing-hook) to insert
> "amount : {{{property(amount)}}}" (or with `org-entry-get', you don't
> need the macro in that case) after each property drawer with an amount
> property.
(apologies if this is a double-post, the first didn't seem to have been sent)
Thanks for the info. I took it up as a challenge to finally learn a
little elisp. This is what I have so far, which appears to work as long
as I expand the entire subtree to be exported. I'd appreciate any
criticism since I really don't know if I'm handling things the best
possible way.
(defun ewd/export-properties (backend)
"Export all properties whose names listed in EXPORT_PROPERTIES in the format:
- <name>: <value> after each heading of specified level
NOTE: 1st value in EXPORT_PROPERTIES is heading level"
(if (org-entry-get (point) "EXPORT_PROPERTIES")
(let* (
(export_properties (split-string
(org-entry-get (point) "EXPORT_PROPERTIES") " "))
(export-level (string-to-number (car export_properties)))
(export-list (cdr export_properties))
)
(org-map-entries
(lambda ()
(next-line)
(open-line 1)
(dolist (prop export-list)
(if (= export-level (car (org-heading-components)))
(progn (insert "- " prop ": "
(if (org-entry-get (point) prop)
(org-entry-get (point) prop) "N/A"))
(newline)))))))))
(add-hook 'org-export-before-processing-hook 'ewd/export-properties)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-07-30 3:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-16 6:21 Export of property key:value Edward DeMeulle
2013-07-16 6:45 ` Nicolas Goaziou
2013-07-27 23:44 ` Edward DeMeulle
2013-07-30 3:11 ` Edward DeMeulle
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).