1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

org-html-example-block: Combine :class attributes using space

* lisp/ox-html.el (org-html-example-block): Avoid creating duplicate
class= attributes when example block has #+ATTR_HTML: :class foo.

Multiple class attributes must be combined with space, as per
https://www.w3schools.com/html/html_classes.asp

Reported-by: Joshua Honeycutt <joshua.honeycutt@gmail.com>
Link: https://orgmode.org/list/87fsfxfzex.fsf@localhost
This commit is contained in:
Ihor Radchenko 2024-02-03 15:07:32 +01:00
parent 3f4bdf80cb
commit 5cb52f379b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -2682,7 +2682,10 @@ information."
(let ((attributes (org-export-read-attribute :attr_html example-block)))
(if (plist-get attributes :textarea)
(org-html--textarea-block example-block)
(format "<pre class=\"example\"%s>\n%s</pre>"
(if-let ((class-val (plist-get attributes :class)))
(setq attributes (plist-put attributes :class (concat "example " class-val)))
(setq attributes (plist-put attributes :class "example")))
(format "<pre%s>\n%s</pre>"
(let* ((reference (org-html--reference example-block info))
(a (org-html--make-attribute-string
(if (or (not reference) (plist-member attributes :id))