From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Is it possible to add a class to a paragraph in HTML export? Date: Tue, 01 Apr 2014 21:37:06 +0200 Message-ID: <8761msdeot.fsf@bzg.ath.cx> References: <20140401212850.157255d1@aga-netbook> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV4V8-0006XH-Eh for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 15:37:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WV4V1-0003xN-3y for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 15:37:38 -0400 Received: from rs249.mailgun.us ([209.61.151.249]:41301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WV4V0-0003xA-Vv for emacs-orgmode@gnu.org; Tue, 01 Apr 2014 15:37:31 -0400 In-Reply-To: <20140401212850.157255d1@aga-netbook> (Marcin Borkowski's message of "Tue, 1 Apr 2014 21:28:50 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Marcin Borkowski Cc: Org-mode mailing list --=-=-= Content-Type: text/plain Hi Marcin, Marcin Borkowski writes: > I'd like to have a

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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=ox-html-add-paragraph-class.patch 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 "\n%s

" extra contents))))) + (t (format "\n%s

" class extra contents))))) ;;;; Plain List --=-=-= Content-Type: text/plain -- Bastien --=-=-=--