emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [Exporter] Export of property drawers


From: Christian Moe
Subject: Re: [O] [Exporter] Export of property drawers
Date: Fri, 10 May 2013 15:37:48 +0200
User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1

Thanks, Nicolas,

That's very useful to know. And although "d:t" was a lot simpler, I
understand the point that people will want to customize how they want to
export their databases anyway. Your information below is enough to get
me started and may save me days of work.

Yours,
Christian

Nicolas Goaziou writes:

> 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,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]