From 5d4fa5c3e0a7933d10d8f1ece3e368d35e4838ad Mon Sep 17 00:00:00 2001 From: Suhail Date: Mon, 17 Jun 2024 22:00:35 -0400 Subject: [PATCH 2/2] ox-html: Add support for attr_html in fixed-width blocks * 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 675d85ffe..848017f1d 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 "
\n%s
" - (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 "\n%s" + (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.45.2