[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] [Exporter] Export of property drawers
From: |
Nicolas Goaziou |
Subject: |
Re: [O] [Exporter] Export of property drawers |
Date: |
Fri, 10 May 2013 10:17:59 +0200 |
Hello,
Christian Moe <address@hidden> writes:
> Nicolas, do I understand correctly that the contents of a property
> drawer will not export?
Correct
> Back before I switched to the new exporter, all
> I had to do to export properties was to add
>
> #+OPTIONS: d:t
>
> but I notice this doesn't work, nor does d:(PROPERTIES).
No, it won't. See docstring for `org-export-with-drawers'. Property
drawers are very different from regular drawers.
> Properties are sometimes used to make simple databases of useful
> stuff. (I compiled a bunch of research notes like that just before
> before switching to the new exporter!) It would be nice to have an easy
> way to print them without having to figure out how to do it with filters
> or defadvices.
Through macros, you can already access to specific properties, e.g.:
{{{property(ARCHIVE)}}}
There is no function to dump the whole database in the export buffer
because it contains many Org-specific entries which are irrelevant and
because there are many ways to dump it.
That's not what you asked, but the following function:
#+begin_emacs-lisp
(defun my-database-dump (backend)
(goto-char (point-min))
(while (re-search-forward "^[ \t]*:PROPERTIES" nil t)
(let ((element (org-element-at-point)))
(when (eq (org-element-type element) 'property-drawer)
(goto-char (org-element-property :end element))
(insert "#+BEGIN_EXAMPLE\n"
(buffer-substring (org-element-property :begin element)
(progn (goto-char
(org-element-property :end element))
(skip-chars-backward " \r\t\n")
(forward-line)
(point)))
"#+END_EXAMPLE\n")))))
#+end_emacs-lisp
when added to `org-export-before-parsing-hook', will wrap every property
drawer within an example block so it can appear in the export output.
Regards,
--
Nicolas Goaziou