|
|
|
|
@ -705,27 +705,20 @@ This function is adapted from `org-html-special-block'." |
|
|
|
|
;; #+end_summary |
|
|
|
|
;; Here are the details. |
|
|
|
|
;; #+end_details |
|
|
|
|
(setq contents |
|
|
|
|
(let* (;; A closing </p> tag is added at the end.. the |
|
|
|
|
;; opening <p> tag for that is later added in |
|
|
|
|
;; the `str2' var. Insert a newline before |
|
|
|
|
;; that tag for the reason explained below |
|
|
|
|
;; using the emacs-lisp Markdown code block. |
|
|
|
|
(str1 (concat contents "\n</p>")) |
|
|
|
|
;; Detect the summary closing tag "</summary>". |
|
|
|
|
;; If found, add the opening <p> tag with |
|
|
|
|
;; "details" class after that, so that CSS |
|
|
|
|
;; rules can be set specific to the details |
|
|
|
|
;; portion using "details .details". |
|
|
|
|
(str2 (replace-regexp-in-string |
|
|
|
|
"<summary>\\(?:.\\|\n\\)*</summary>" |
|
|
|
|
"\\&\n<p class=\"details\">" |
|
|
|
|
str1)) |
|
|
|
|
(has-summary (not (string= str1 str2)))) |
|
|
|
|
;; (message "[DBG details/summary]: is-open:%S `%s' `%s'" is-open str1 str2) |
|
|
|
|
(unless has-summary |
|
|
|
|
(setq str2 (concat "<p class=\"details\">" str1))) |
|
|
|
|
str2)) |
|
|
|
|
(let ((p-open "<p class=\"details\">")) |
|
|
|
|
(setq contents |
|
|
|
|
(concat |
|
|
|
|
;; Wrap the "details" portion in the <details> tag |
|
|
|
|
;; with '<p class="details"> .. </p>'. With that, |
|
|
|
|
;; CSS rules can be set specific to that details |
|
|
|
|
;; portion using "details .details". |
|
|
|
|
(if (string-match "\\(?1:<summary>\\(?:.\\|\n\\)*</summary>\\)" contents) ;If summary exists |
|
|
|
|
(replace-match (format "\\1\n%s" p-open) nil nil contents 1) |
|
|
|
|
(concat p-open contents)) |
|
|
|
|
;; A newline is inserted before the closing </p> |
|
|
|
|
;; tag for the reason explained below using the |
|
|
|
|
;; emacs-lisp Markdown code block. |
|
|
|
|
"\n</p>"))) |
|
|
|
|
;; Insert the "open" attribute only if user has ":open t" in |
|
|
|
|
;; "#+attr_html". |
|
|
|
|
(when (org-string-nw-p attr-str) |
|
|
|
|
|