Table of Contents

  1. Properties in org-mode
    1. Approach 1
    2. Useful links:

TODO Properties in org-mode

Approach 1

Given an org document, I’d like to traverse all headlines of the given level and extract the headline title, provided that:

  1. Headline title can be generated by inline source blocks that use node properties, and
  2. I don’t know beforehand what are the names of the node properties that are going to be used to generate the headline.

For example for the document given below:

* Section about src_elisp{(org-entry-get nil "Name")} :this:
:PROPERTIES:
:Name:     J.S. Bach
:END:

* Section about src_elisp{(org-entry-get nil "Composer")} :this:
:PROPERTIES:
:Composer:     W.A. Mozart
:END:

* Code
#+begin_src elisp :eval yes :results output :exports both

(defun level1-headlines-filter ()
  (setq headline (org-entry-get nil "ITEM"))
  (setq props (org-get-entry))
  (setq string (concat headline "\n" props))
  (setq string (org-export-string-as string 'org t '(:with-toc nil)))
  (setq all (list string)))

(setq HEADLINES-PARSED (org-map-entries #'level1-headlines-filter "LEVEL=1+this") )

(print HEADLINES-PARSED)

#+end_src

HEADLINES-PARSED should contain strings:

"Section about J.S. Bach"
"Section about W.A. Mozart"

Now the results are:

"Section about "
"Section about "