emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* publishing a drawer
@ 2010-11-03 11:48 Łukasz Stelmach
  2010-11-03 16:11 ` Jeff Horn
  2010-11-05  9:20 ` Christian Moe
  0 siblings, 2 replies; 5+ messages in thread
From: Łukasz Stelmach @ 2010-11-03 11:48 UTC (permalink / raw)
  To: emacs-orgmode

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 <div class="notes"></div> (or
\note{} for Beamer).

-- 
Miłego dnia,
Łukasz Stelmach

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: publishing a drawer
  2010-11-03 11:48 publishing a drawer Łukasz Stelmach
@ 2010-11-03 16:11 ` Jeff Horn
  2010-11-03 16:32   ` Thomas S. Dye
  2010-11-05  9:20 ` Christian Moe
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Horn @ 2010-11-03 16:11 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: emacs-orgmode

2010/11/3 Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl>:
> 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 <div class="notes"></div> (or
> \note{} for Beamer).

There is the HTML_CONTAINER_CLASS property.[1] I would find a similar
property for LaTeX environments handy, but I don't think
implementation is simple on the user end. LaTeX files have style info
in their headers, not in a separate CSS file, so manual editing of the
LaTeX source would still be necessary.

Best,
Jeff

[1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg31788.html

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: publishing a drawer
  2010-11-03 16:11 ` Jeff Horn
@ 2010-11-03 16:32   ` Thomas S. Dye
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas S. Dye @ 2010-11-03 16:32 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Łukasz Stelmach, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1647 bytes --]

Aloha Jeff,

On Nov 3, 2010, at 6:11 AM, Jeff Horn wrote:

> 2010/11/3 Łukasz Stelmach <lukasz.stelmach@iem.pw.edu.pl>:
>> 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 <div class="notes"></div> (or
>> \note{} for Beamer).
>
> There is the HTML_CONTAINER_CLASS property.[1] I would find a similar
> property for LaTeX environments handy, but I don't think
> implementation is simple on the user end. LaTeX files have style info
> in their headers, not in a separate CSS file, so manual editing of the
> LaTeX source would still be necessary.
>
> Best,
> Jeff
>

Just a remark here that doesn't address the OP's query:  LaTeX class  
files can be written so the user doesn't have to include style  
information in the document header.  This is one of the motivations  
for the org-article.cls, http://orgmode.org/worg/org-contrib/babel/examples/article-class.php 
.  To my mind, this approach is analogous to the separate CSS file  
used by HTML documents.

All the best,
Tom

> [1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg31788.html
>
> -- 
> Jeffrey Horn
> Graduate Lecturer and PhD Student in Economics
> George Mason University
>
> (704) 271-4797
> jhorn@gmu.edu
> jrhorn424@gmail.com
>
> http://www.failuretorefrain.com/jeff/
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 2488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: publishing a drawer
  2010-11-03 11:48 publishing a drawer Łukasz Stelmach
  2010-11-03 16:11 ` Jeff Horn
@ 2010-11-05  9:20 ` Christian Moe
  2010-11-06 11:15   ` Łukasz Stelmach
  1 sibling, 1 reply; 5+ messages in thread
From: Christian Moe @ 2010-11-05  9:20 UTC (permalink / raw)
  To: Łukasz Stelmach; +Cc: emacs-orgmode

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<div class="notes"></div>  (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 "@<div class=\"notes\"> %s @</div>" 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: <style>.notes {color: grey; margin-bottom: 1em} 
.notes:before {content: "Notes: "; font-weight: bold}</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 "@<div class=\"%s\"> %s @</div>" 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: publishing a drawer
  2010-11-05  9:20 ` Christian Moe
@ 2010-11-06 11:15   ` Łukasz Stelmach
  0 siblings, 0 replies; 5+ messages in thread
From: Łukasz Stelmach @ 2010-11-06 11:15 UTC (permalink / raw)
  To: emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

> 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<div class="notes"></div>  (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)
[...]

Looks quite promising :-) I will surely try it. Thanks.

-- 
Miłego dnia,
Łukasz Stelmach

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-06 11:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-03 11:48 publishing a drawer Łukasz Stelmach
2010-11-03 16:11 ` Jeff Horn
2010-11-03 16:32   ` Thomas S. Dye
2010-11-05  9:20 ` Christian Moe
2010-11-06 11:15   ` Łukasz Stelmach

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).