From: Bastien <bzg@gnu.org>
To: Marcin Borkowski <mbork@wmi.amu.edu.pl>
Cc: Org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Is it possible to add a class to a paragraph in HTML export?
Date: Tue, 01 Apr 2014 21:37:06 +0200 [thread overview]
Message-ID: <8761msdeot.fsf@bzg.ath.cx> (raw)
In-Reply-To: <20140401212850.157255d1@aga-netbook> (Marcin Borkowski's message of "Tue, 1 Apr 2014 21:28:50 +0200")
[-- Attachment #1: Type: text/plain, Size: 237 bytes --]
Hi Marcin,
Marcin Borkowski <mbork@wmi.amu.edu.pl> writes:
> I'd like to have a <p class="myfunnyclass"> in export. I tried
> #+ATTR_HTML :class myfunnyclass
> but it didn't work.
You can't for now but this patch will make it work.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ox-html-add-paragraph-class.patch --]
[-- Type: text/x-diff, Size: 915 bytes --]
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index a843441..76472c7 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2899,6 +2899,8 @@ the plist used as a communication channel."
(let* ((parent (org-export-get-parent paragraph))
(parent-type (org-element-type parent))
(style '((footnote-definition " class=\"footpara\"")))
+ (class0 (org-export-read-attribute :attr_html paragraph :class))
+ (class (if class0 (format " class=\"%s\"" class0)))
(extra (or (cadr (assoc parent-type style)) "")))
(cond
((and (eq (org-element-type parent) 'item)
@@ -2925,7 +2927,7 @@ the plist used as a communication channel."
(label (org-element-property :name paragraph)))
(org-html--wrap-image contents info caption label)))
;; Regular paragraph.
- (t (format "<p%s>\n%s</p>" extra contents)))))
+ (t (format "<p%s%s>\n%s</p>" class extra contents)))))
;;;; Plain List
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
next prev parent reply other threads:[~2014-04-01 19:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-01 19:28 Is it possible to add a class to a paragraph in HTML export? Marcin Borkowski
2014-04-01 19:37 ` Bastien [this message]
2014-04-01 19:45 ` Marcin Borkowski
2014-04-02 7:06 ` Nicolas Goaziou
2014-04-02 7:58 ` Christian Moe
2014-04-17 1:13 ` Rick Frankel
2014-04-17 6:20 ` Bastien
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=8761msdeot.fsf@bzg.ath.cx \
--to=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=mbork@wmi.amu.edu.pl \
/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).