瀏覽代碼

ox-html: Add html attributes to quote-block

* lisp/ox-html.el (org-html-quote-block): Enables #+attr_html: and puts
  a id attribute when the block is named into the html element.
John Kitchin 9 年之前
父節點
當前提交
8f4f7dfd14
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10 2
      lisp/ox-html.el

+ 10 - 2
lisp/ox-html.el

@@ -3153,11 +3153,19 @@ holding contextual information."
 
 ;;;; Quote Block
 
-(defun org-html-quote-block (_quote-block contents _info)
+(defun org-html-quote-block (quote-block contents _info)
   "Transcode a QUOTE-BLOCK element from Org to HTML.
 CONTENTS holds the contents of the block.  INFO is a plist
 holding contextual information."
-  (format "<blockquote>\n%s</blockquote>" contents))
+  (format "<blockquote%s>\n%s</blockquote>"
+	  (let* ((name (org-element-property :name quote-block))
+		 (attributes (org-export-read-attribute :attr_html quote-block))
+		 (a (org-html--make-attribute-string
+		     (if (or (not name) (plist-member attributes :id))
+			 attributes
+		       (plist-put attributes :id name)))))
+	    (if (org-string-nw-p a) (concat " " a) ""))
+	  contents))
 
 ;;;; Section