From 704b6e963f4ec9c33f78075a810ed8c9e56a905d Mon Sep 17 00:00:00 2001
From: Kaushal Modi
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
")) - ;; Detect the summary closing tag "". - ;; If found, add the opening 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
- "
" - 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 "
" str1))) - str2)) + (let ((p-open "
"))
+ (setq contents
+ (concat
+ ;; Wrap the "details" portion in the .. \\(?:.\\|\n\\)*
\\)" 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