org special block with arbitrary attributes to create rst directives with arbitrary options

This commit is contained in:
2025-12-29 22:08:04 +01:00
parent f0dc4ec8cc
commit 2d377dda06

View File

@@ -1432,13 +1432,23 @@ holding contextual information."
(title (plist-get attributes :title))
(class (plist-get attributes :class))
(label (org-element-property :name special-block))
(type (org-element-property :type special-block)))
(type (org-element-property :type special-block))
(attr-str-ignore '(:title))
(attr-str ""))
;; combine with `org-rst--make-attribute-string'?
(cl-loop for (key value) on attributes by 'cddr
do (unless (member key attr-str-ignore)
(setq attr-str
(concat attr-str
(format " %s:" key)
(when value (format " %s" value))
"\n"))))
(concat
(format ".. %s::" type)
(when title (format " %s" title))
"\n"
(when class (format " :class: %s\n" class))
(when label (format " :name: %s\n" label))
(when attr-str attr-str)
"\n"
(when contents
(org-rst--indent-string contents org-rst-quote-margin)))))