From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: [PATCH 3/3] add html attributes to special blocks. Date: Mon, 28 Mar 2016 15:06:52 -0400 Message-ID: <1459192012-82531-3-git-send-email-jkitchin@andrew.cmu.edu> References: <1459192012-82531-1-git-send-email-jkitchin@andrew.cmu.edu> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akcVB-0000w3-Dq for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:07:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1akcVA-0002Ii-7P for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:07:01 -0400 Received: from mail-qg0-x22b.google.com ([2607:f8b0:400d:c04::22b]:34041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1akcVA-0002IT-37 for emacs-orgmode@gnu.org; Mon, 28 Mar 2016 15:07:00 -0400 Received: by mail-qg0-x22b.google.com with SMTP id c67so82806086qgc.1 for ; Mon, 28 Mar 2016 12:07:00 -0700 (PDT) In-Reply-To: <1459192012-82531-1-git-send-email-jkitchin@andrew.cmu.edu> 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: emacs-orgmode@gnu.org Cc: John Kitchin Enables #+attr_html and puts an id in when the special block is named. --- lisp/ox-html.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 5bdfc14..da67958 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -3209,22 +3209,28 @@ contextual information." "Transcode a SPECIAL-BLOCK element from Org to HTML. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." - (let* ((block-type (org-element-property :type special-block)) - (contents (or contents "")) - (html5-fancy (and (org-html--html5-fancy-p info) - (member block-type org-html-html5-elements))) - (attributes (org-export-read-attribute :attr_html special-block))) + (let* ((block-type (downcase + (org-element-property :type special-block))) + (contents (or contents "")) + (html5-fancy (and (org-html-html5-p info) + (plist-get info :html-html5-fancy) + (member block-type org-html-html5-elements))) + (attributes (org-export-read-attribute :attr_html special-block))) (unless html5-fancy (let ((class (plist-get attributes :class))) - (setq attributes (plist-put attributes :class - (if class (concat class " " block-type) - block-type))))) + (setq attributes (plist-put attributes :class + (if class (concat class " " block-type) + block-type))) + (when (org-element-property :name special-block) + (setq attributes (plist-put + attributes :id + (org-element-property :name special-block)))))) (setq attributes (org-html--make-attribute-string attributes)) (when (not (equal attributes "")) (setq attributes (concat " " attributes))) (if html5-fancy - (format "<%s%s>\n%s" block-type attributes - contents block-type) + (format "<%s%s>\n%s" block-type attributes + contents block-type) (format "\n%s\n" attributes contents)))) ;;;; Src Block -- 2.4.4