emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers


From: Nicolas Goaziou
Subject: Re: [O] [PATCH] fix hook calling in org-export-remove-or-extract-drawers
Date: Wed, 02 May 2012 14:35:53 +0200

Bill Wishon <address@hidden> writes:

> What I was trying to achieve when I got into trying out the
> org-export-format-drawer-function was to try and customize the look of the
> properties drawers when they're exported to html.  By default they are
> exported as pre formatted text with the class=example.  What would be the
> right way to reformat this during output so that I could present this in
> another format, say a table or bullet list?

This is an area I'm still working on in the next export engine.

Filters allow to modify output from a back-end. But back-ends ignore
properties drawers. Therefore, filters aren't useful in this case, since
there's no output to modify in the first place.

Though, you can provide a function telling a back-end how to export
a property drawer. As every call-back function, it must accept three
arguments: the parsed drawer, its contents (nil in this case) and
a plist containing export directives (named the communication channel).

For now, you have to follow strict naming conventions (but I'll remove
them) and call it org-BACKEND-ELEMENT. Here BACKEND is `e-html' and
element `property-drawer'.

Also, all properties in the drawer are stored in an alist under
`:properties' attribute.

So `org-e-html-property-drawer' might look like the following:

#+begin_src emacs-lisp
(defun org-e-html-property-drawer (p-drawer contents info)
  (format "<dl>\n%s\n</dl>"
          (mapconcat
           (lambda (prop)
             (format "<dt>%s</dt><dd>%s</dd>" (car prop) (cdr prop)))
           (org-element-property :properties p-drawer) "\n")))
#+end_src

Now every call to `e-html' back-end will change property drawers into
a description list.

This isn't good enough though, because once this function has been
defined, there's no clean way back and it will affect all HTML export in
the same session. I'm working on providing a way to fix it.


Regards,
        
-- 
Nicolas Goaziou



reply via email to

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