emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: Bill Wishon <bill@wishon.org>
Cc: Bastien <bzg@gnu.org>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] fix hook calling in org-export-remove-or-extract-drawers
Date: Wed, 02 May 2012 14:35:53 +0200	[thread overview]
Message-ID: <87havyrc9i.fsf@gmail.com> (raw)
In-Reply-To: <CAP2uJAsorrLuExBzeVFyTXjaLAK-UbYOHKKgJ9odChdQYuC3mg@mail.gmail.com> (Bill Wishon's message of "Tue, 1 May 2012 11:29:13 -0700")

Bill Wishon <bill@wishon.org> 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	other threads:[~2012-05-02 12:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01  1:20 [PATCH] fix hook calling in org-export-remove-or-extract-drawers Bill Wishon
2012-05-01 10:01 ` Bastien
2012-05-01 14:46   ` Bill Wishon
2012-05-01 17:58     ` Bastien
2012-05-01 18:02       ` Bill Wishon
2012-05-01 18:18       ` Nicolas Goaziou
2012-05-01 18:29         ` Bill Wishon
2012-05-02 12:35           ` Nicolas Goaziou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87havyrc9i.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=bill@wishon.org \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).