Hi Aaron,
I really appreciate your feedback. That helped fine-tune my implementation of details/summary.
I now moved that code to the ox-blackfriday library when I have this in org-blackfriday-special-block:
It's basically QOL code:
1. Wraps the "details" portion in "<p class="details"> .. </p>".
2. Accepts only ":open t" as a "true condition" to keep the details widget open by default. Detecting that inserts just "open" in the "details" element. So ":open nil" or ":open foo" would not result in inserting any open attr at all.
The modified contents and attr-str in the below snippet are later used as: (format "<%s%s>\n%s\n</%s>"
block-type attr-str contents block-type)
((string= block-type "details")
(setq contents
(let* ((str1 (concat contents "\n</p>"))
(str2 (replace-regexp-in-string
"<summary>\\(?:.\\|\n\\)*</summary>"
"\\&\n<p class=\"details\">"
str1))
(has-summary (not (string= str1 str2))))
(unless has-summary
(setq str2 (concat "<p class=\"details\">" str1)))
str2))
;; Insert the "open" attribute only if user has ":open t" in
;; "#+attr_html".
(when (org-string-nw-p attr-str)
(when (string-match "\\(?1:open\\(?2:=\"\\(?3:t\\)\"\\)\\)" attr-str)
(if (match-string 3 attr-str) ;if attr-str contains `open="t"'
(setq attr-str (replace-match "" nil nil attr-str 2))
(setq attr-str (replace-match "" nil nil attr-str 1))))))
--