emacs-orgmode
[Top][All Lists]
Advanced

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

[O] How do I set a class for a paragraph in HTML export?


From: Marcin Borkowski
Subject: [O] How do I set a class for a paragraph in HTML export?
Date: Tue, 02 Dec 2014 02:10:39 +0100

Hi all,

I'd like to get something like this:

<p class="myclass">Hello world</p>

What should I write in the Org file?  Looking at org-html-paragraph, I'm
afraid that it's currently impossible.

If this is indeed the case, what do I do to change it?  A natural idea
is that I could define an org-my-html-paragraph and plug it into a
custom exporter.  However, I do not want to repeat the whole code of
org-html-paragraph, which I don't even fully understand (it would take
me some time to digest it...).  Two ideas that come to me are: either
use an #+ATTR_MY_HTML line (or similar), or enclose my paragraph in
#+BEGIN_MYCLASS ... #+END_MYCLASS and detect this (I already have this:

(defun org-edu-html-check-for-block-type (element block-type)
  "Check whether ELEMENT is inside a BLOCK-TYPE (which is a
string) special block."
  (let ((parent (org-export-get-parent element)))
    (cond ((and (eq (car parent) 'special-block)
                (string= (org-element-property :type parent) block-type))
           t)
          (parent
           (org-edu-html-check-for-block-type parent block-type)))))

so that I can do that easily).  However, it seems that if I take this
route, I will loose all bells and whistles of org-html-paragraph
anyway.

Any suggestions?

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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