From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: publishing a drawer Date: Fri, 05 Nov 2010 10:20:59 +0100 Message-ID: <4CD3CC7B.1000505@christianmoe.com> References: <87pqum7hmq.fsf@dasa3.iem.pw.edu.pl> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from [140.186.70.92] (port=43603 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEISS-00055y-Id for emacs-orgmode@gnu.org; Fri, 05 Nov 2010 05:19:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PEISM-0003PQ-Kr for emacs-orgmode@gnu.org; Fri, 05 Nov 2010 05:19:40 -0400 Received: from mars.hitrost.net ([91.185.193.39]:40643) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PEISM-0003MC-91 for emacs-orgmode@gnu.org; Fri, 05 Nov 2010 05:19:34 -0400 In-Reply-To: <87pqum7hmq.fsf@dasa3.iem.pw.edu.pl> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?UTF-8?B?xYF1a2FzeiBTdGVsbWFjaA==?= Cc: emacs-orgmode@gnu.org On 11/3/10 12:48 PM, Ɓukasz Stelmach wrote: > Hello. > > Is it possible to publish drawer's content during export (both HTML and > LaTeX)? I am creating a presentation with S5 and I'd love to have > :LOGBOOK: (or :NOTES:) published as
(or > \note{} for Beamer). > The following ought to work, but doesn't for Latex. Code improvements welcome. * Set option to include drawers in export : #+OPTIONS: d:t For some reason, this doesn't work for me with Latex export. I've filed a bug report. * Customize drawer export Make org-export-format-drawer-function point to a custom function, e.g. like this for your exact case (improvements welcome): #+begin_src emacs-lisp (defun my-org-export-format-drawer (name content backend) "Export :NOTES: and :LOGBOOK: drawers to HTML class or LaTeX command" (cond ((string-match "NOTES\\|LOGBOOK" name) (cond ((eq backend 'html) (format "@
%s @
" content)) ((eq backend 'latex) ; FIXME: This doesn't work (format "#+BEGIN_LATEX:\n\note{%s}\n#+END_LATEX " content)) (t nil))) (t nil))) (setq org-export-format-drawer-function 'my-org-export-format-drawer) #+end_src * Style the HTML `notes' class as you want it e.g. with : #+STYLE: * Options You can add more conditional clauses for other drawers you want styled a different way. The function could be written more simply if you simply want all your drawers exported with the drawer name as HTML class/LaTeX command. #+begin_src emacs-lisp (defun my-org-export-format-drawer (name content backend) "Export drawers to HTML class or LaTeX command with same name" (setq name (downcase name)) (cond ((eq backend 'html) (format "@
%s @
" name content)) ((eq backend 'latex) ; FIXME: This doesn't work (format "#+BEGIN_LATEX:\n\%s{%s}\n#+END_LATEX " name content)) (t nil))) #+end_src ...and if you're using org-special-blocks, you can do the same simply with: #+begin_src emacs-lisp (defun my-org-export-format-drawer (name content backend) "Export drawers to HTML class or LaTeX command with same name" (setq name (downcase name)) (format "#+BEGIN_%s\n%s\n#+END_%s" name content name)) #+end_src Let me know how it turns out. It's an interesting alternative route to extensible block-level markup. HTH, Christian