emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Cc: Henry Hirsch <henry@w3-net.de>
Subject: Re: Wrapping sections in html not possible
Date: Sat, 29 Nov 2014 08:57:37 -0800	[thread overview]
Message-ID: <877fyet05a.fsf@berkeley.edu> (raw)
In-Reply-To: 20141129074326.GM21741@w3-net.de

Hi Henry,

Henry Hirsch <henry@w3-net.de> 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	other threads:[~2014-11-29 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29  7:43 Wrapping sections in html not possible Henry Hirsch
2014-11-29 16:57 ` Richard Lawrence [this message]
2014-11-30  9:12   ` Henry Hirsch

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=877fyet05a.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=henry@w3-net.de \
    /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).