GNU bug report logs -
#72945
29.4; Org: ox-html: attr_html not supported in source code and fixed-width blocks during HTML export
Previous Next
Full log
View this message in rfc822 format
* 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
This bug report was last modified 312 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.