org-html-src-block: Treat code blocks without LANG equally

* lisp/ox-html.el (org-html-src-block): Do not treat src blocks
without LANG as example blocks.  Instead, export them using "nil"
language.  This way, such src blocks will get captions, unlike example
blocks.

The new behavior is consistent with ox-latex and ox-ascii.

Reported-by: Johan Bolmsjö <org-mode@johan.bitmaster.se>
Link: https://orgmode.org/list/87zgb90win.fsf@localhost
This commit is contained in:
Ihor Radchenko 2023-01-16 13:04:01 +03:00
parent d98ca046cc
commit 77a1cfb9a4
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 26 additions and 26 deletions

View File

@ -3616,7 +3616,6 @@ contextual information."
(klipsify (and (plist-get info :html-klipsify-src)
(member lang '("javascript" "js"
"ruby" "scheme" "clojure" "php" "html")))))
(if (not lang) (format "<pre class=\"example\"%s>\n%s</pre>" label code)
(format "<div class=\"org-src-container\">\n%s%s\n</div>"
;; Build caption.
(let ((caption (org-export-get-caption src-block)))
@ -3634,14 +3633,15 @@ contextual information."
;; Contents.
(if klipsify
(format "<pre><code class=\"src src-%s\"%s%s>%s</code></pre>"
lang
lang ; lang being nil is OK.
label
(if (string= lang "html")
" data-editor-type=\"html\""
"")
code)
(format "<pre class=\"src src-%s\"%s>%s</pre>"
lang label code)))))))
;; Lang being nil is OK.
lang label code))))))
;;;; Statistics Cookie