Re: [Orgmode] publishing a drawer

2010-11-05 Thread Christian Moe

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: .notes {color: grey; margin-bottom: 1em} 
.notes:before {content: "Notes: "; font-weight: bold}


* 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

___
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


Re: [Orgmode] publishing a drawer


Aloha Jeff,

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


2010/11/3 Łukasz Stelmach :
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).


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
jh...@gmu.edu
jrhorn...@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


___
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


Re: [Orgmode] publishing a drawer

2010/11/3 Łukasz Stelmach :
> 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).

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
jh...@gmu.edu
jrhorn...@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


[Orgmode] publishing a drawer

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

-- 
Miłego dnia,
Łukasz Stelmach


___
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