emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Wrapping sections in html not possible
@ 2014-11-29  7:43 Henry Hirsch
  2014-11-29 16:57 ` Richard Lawrence
  0 siblings, 1 reply; 3+ messages in thread
From: Henry Hirsch @ 2014-11-29  7:43 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

When the following code snippet is exported to html the 
jumbotron section is not wrapped in the jumbotron class but 
the jumbotron div is in another section and the closing div
is in the content of my jumbotron.

* Another Section
#+BEGIN_HTML
<div class="jumbotron">
#+END_HTML
* content of my jumbotron
This text is all about my jumbotron
#+BEGIN_HTML
</div>
#+END_HTML

* Another Section

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.

I am using macros extensively and a workaround so far
is to not use org-modes sections but use a macro like
#+MACRO: heading #+HTML: <h2>$1</h2>
to create headlines. Which works but is unsatisfactory
for obvious reasons.

I am very interested in your thoughts. 

Regards
Henry

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

* Re: Wrapping sections in html not possible
  2014-11-29  7:43 Wrapping sections in html not possible Henry Hirsch
@ 2014-11-29 16:57 ` Richard Lawrence
  2014-11-30  9:12   ` Henry Hirsch
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Lawrence @ 2014-11-29 16:57 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Henry Hirsch

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

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

* Re: Wrapping sections in html not possible
  2014-11-29 16:57 ` Richard Lawrence
@ 2014-11-30  9:12   ` Henry Hirsch
  0 siblings, 0 replies; 3+ messages in thread
From: Henry Hirsch @ 2014-11-30  9:12 UTC (permalink / raw)
  To: emacs-orgmode

Hello Richard,

Puneeth Chaganti created https://github.com/GlPortal/glportal_website/blob/master/plugins/orgmode/init.el (L 111-128).
Which works good but sadly it is not possible to use macros inside of the org source blocks.

We are currently looking for a solution.

Regards
Henry

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

end of thread, other threads:[~2014-11-30  9:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-29  7:43 Wrapping sections in html not possible Henry Hirsch
2014-11-29 16:57 ` Richard Lawrence
2014-11-30  9:12   ` Henry Hirsch

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