[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Export of property key:value
From: |
Edward DeMeulle |
Subject: |
Re: [O] Export of property key:value |
Date: |
Sat, 27 Jul 2013 16:44:17 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
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)