From: Joshua Honeycutt <joshua.honeycutt@gmail.com>
To: emacs-orgmode@gnu.org
Date: Tue, 20 Sep 2022 11:30:04 -0500 [thread overview]
Message-ID: <YynqjPiskB5OdFR0@chaos.honeycutt> (raw)
To: emacs-orgmode@gnu.org
Subject: Bug: org-html-example-block can produce multiple class attributes [9.4 (9.4-dist @ /usr/share/emacs/site-lisp/elpa/org-9.4/)]
From: Joshua Honeycutt <coweater@chaos.honeycutt>
--text follows this line--
Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
of 2021-03-27, modified by Debian
Package: Org mode version 9.4 (9.4-dist @ /usr/share/emacs/site-lisp/elpa/org-9.4/)
I added a class attribute to an example block as in:
#+ATTR_HTML :class cmdout
#+BEGIN_EXAMPLE
text text text
#+END_EXAMPLE
I expected this to produce a html tag like:
<pre class="cmdout example">
but the output was instead:
<pre class="example" class="cmdout">
In my browser this second class assignment was ignored.
org-html-example-block could instead add the 'example' class to other
attributes which get placed in the <pre> tag. I modified it to achieve
this outcome like this (from be2246a550b444560ec1718c11185ac7bfcfa646):
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 9024701aa..7036f44cd 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2546,8 +2546,11 @@ 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>"
+ (format "<pre%s>\n%s</pre>"
(let* ((reference (org-html--reference example-block info))
+ (class (plist-get attributes :class))
+ (attributes (plist-put attributes :class
+ (if class (concat class " example") "example")))
(a (org-html--make-attribute-string
(if (or (not reference) (plist-member attributes :id))
attributes
next reply other threads:[~2022-09-20 21:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 16:30 Joshua Honeycutt [this message]
2022-10-09 3:28 ` Bug: org-html-example-block can produce multiple class attributes [9.4 (9.4-dist @/usr/share/emacs/site-lisp/elpa/org-9.4/)] Ihor Radchenko
2024-02-03 14:10 ` Ihor Radchenko
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YynqjPiskB5OdFR0@chaos.honeycutt \
--to=joshua.honeycutt@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.