From: "Suhail Singh" <suhailsingh247@gmail.com>
To: 72945@debbugs.gnu.org
Subject: bug#72945: [PATCH 2/2] ox-html: Add support for attr_html in fixed-width blocks
Date: Sun, 01 Sep 2024 21:58:02 -0400 [thread overview]
Message-ID: <87o7566clx.fsf@gmail.com> (raw)
In-Reply-To: <87seui27tf.fsf@gmail.com> (Suhail Singh's message of "Sun, 01 Sep 2024 20:55:08 -0400")
* lisp/ox-html.el (org-html-fixed-width): Handle attr_html in a manner
similar to example blocks.
TINYCHANGE
---
lisp/ox-html.el | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 3e83f02e2..a85b1e6ac 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2728,13 +2728,23 @@ (defun org-html-export-block
;;;; Fixed Width
-(defun org-html-fixed-width (fixed-width _contents _info)
+(defun org-html-fixed-width (fixed-width _contents info)
"Transcode a FIXED-WIDTH element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
- (format "<pre class=\"example\">\n%s</pre>"
- (org-html-do-format-code
- (org-remove-indentation
- (org-element-property :value fixed-width)))))
+ (let ((attributes (org-export-read-attribute :attr_html fixed-width)))
+ (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 fixed-width info))
+ (a (org-html--make-attribute-string
+ (if (or (not reference) (plist-member attributes :id))
+ attributes
+ (plist-put attributes :id reference)))))
+ (if (org-string-nw-p a) (concat " " a) ""))
+ (org-html-do-format-code
+ (org-remove-indentation
+ (org-element-property :value fixed-width))))))
;;;; Footnote Reference
--
2.46.0
next prev parent reply other threads:[~2024-09-02 1:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 0:55 bug#72945: 29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export Suhail Singh
2024-09-02 1:56 ` bug#72945: [PATCH 1/2] ox-html: Add support for attr_html for source code blocks Suhail Singh
2024-09-02 1:58 ` Suhail Singh [this message]
2024-09-02 11:30 ` bug#72945: 29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export Eli Zaretskii
2024-09-02 12:26 ` Suhail Singh
2024-09-02 12:32 ` Eli Zaretskii
2024-09-07 9:26 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7566clx.fsf@gmail.com \
--to=suhailsingh247@gmail.com \
--cc=72945@debbugs.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).