Hello,
Yesterday, I came up with a way to generate the HTML details disclosure
fairly easily using Org Special Blocks. I implemented that in ox-hugo. But
I believe the same would be useful for ox-html too.
Here's the relevant code snippet:
((string= block-type "details")
;; Recognize Org Special blocks like:
;; #+begin_details
;; summary. This will be wrapped in
;; tag is later added in the `str2' var if summary is ;; present, else in `str3' var. (str1 (replace-regexp-in-string "\\'" "\n
\\&" str1)) ;; Detect the summary divider special string "---". It ;; must begin at the beginning of a line. Also ensure to ;; replace only the first match, if any. ;; Also add the opening tag with "details" class
;; so that just as CSS rules can be set for summary
;; ("details summary"), they can be set for the details
;; portion following the
"
str1 nil nil 1))
(has-summary (not (string= str1 str2)))
str3)
;; (message "[DBG details/summary]: is-open:%S `%s' `%s'" is-open
str1 str2)
(setq str3 (if has-summary
(replace-regexp-in-string "\\` " str2)))
(if is-open
(replace-regexp-in-string "\\`\\(" str2)
(replace-regexp-in-string "\\`