emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edward DeMeulle <ed@demeulle.org>
To: emacs-orgmode@gnu.org
Subject: Re: Export of property key:value
Date: Sat, 27 Jul 2013 16:44:17 -0700	[thread overview]
Message-ID: <87ppu38t66.fsf@demeulle.org> (raw)
In-Reply-To: 87mwpnypdn.fsf@gmail.com

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)

  reply	other threads:[~2013-07-27 23:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-07-30  3:11   ` Edward DeMeulle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppu38t66.fsf@demeulle.org \
    --to=ed@demeulle.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).