emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Wrapping sections in html not possible


From: Richard Lawrence
Subject: Re: [O] Wrapping sections in html not possible
Date: Sat, 29 Nov 2014 08:57:37 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Hi Henry,

Henry Hirsch <address@hidden> writes:

> So how can org mode support wrapping sections in html?
> Especially for more complex cases where a section or
> multiple sections will be wrapped in multiple divs.

You can do this with an export filter or filters.  See the "Advanced
Configuration" section in the "Exporting" chapter of the manual.

Here is a simple example to get you started:
#+BEGIN_SRC elisp
(defun my-html-headline-wrap-filter (text backend info)
  "Wrap headlines in div.jumbotron during export."
  (when (org-export-derived-backend-p backend 'html)
    (concat "<div class=\"jumbotron\">" text "</div>")))

(add-to-list 'org-export-filter-headline-functions
             'my-html-headline-wrap-filter)
#+END_SRC

As written, this will wrap *all* sections (including their headline) in
divs with the jumbotron class during HTML export.  You probably want to
do this for just some headlines, in just some documents.  So, you'll
need to add a test in my-html-headline-wrap-filter so that it only wraps
the relevant headlines, and leaves others unchanged.  Perhaps you can do
this based on the title of the headline, or the presence of some tag or
property.  If you need help with this, just ask!
 
Best,
Richard




reply via email to

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