Hi,

Marcin Borkowski <mb...@wmi.amu.edu.pl> writes:

> #+BEGIN_FOO :bar baz qux
> whatever
> #+END_FOO
>
> and I want to extract the value of the header argument "bar" (i.e., the
> string "baz qux" in this case).  How do I do it?

Here's something to get you started.

#+BEGIN_FOO :bar baz qux
whatever
#+END_FOO

#+BEGIN_SRC emacs-lisp
  (goto-char (point-min)) ; to make the example work
  (let ((str (and (search-forward-regexp org-block-regexp nil t)
                  (match-string 3))))
    (when str
      (string-match "[ \t]:\\w+[ \t]+\\([^:]+\\)" str)
      (org-trim (match-string 1 str))))
#+END_SRC

#+RESULTS:
: baz qux

There's a similar "parser" in org-export-expand-include-keyword.  If you
know which argument you are looking for you can replace the \\w+ above.

Hope it helps,
Rasmus

-- 
Send from my Emacs



Reply via email to