emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Marcin Borkowski <mbork@wmi.amu.edu.pl>
To: Org-Mode mailing list <emacs-orgmode@gnu.org>
Subject: How do I set a class for a paragraph in HTML export?
Date: Tue, 02 Dec 2014 02:10:39 +0100	[thread overview]
Message-ID: <871toihn5c.fsf@wmi.amu.edu.pl> (raw)

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	other threads:[~2014-12-02  1:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-02  1:10 Marcin Borkowski [this message]
2014-12-02  4:36 ` How do I set a class for a paragraph in HTML export? Richard Lawrence

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=871toihn5c.fsf@wmi.amu.edu.pl \
    --to=mbork@wmi.amu.edu.pl \
    --cc=emacs-orgmode@gnu.org \
    /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).