Set default to rst-format-drawer-function

This commit is contained in:
Masanao Igarashi
2025-04-03 16:57:19 +09:00
parent de143fbf6b
commit b4ba5c7e95

View File

@@ -254,7 +254,7 @@ the same number of blank lines as in the original document."
;;;; Drawers ;;;; Drawers
(defcustom org-rst-format-drawer-function nil (defcustom org-rst-format-drawer-function (lambda (_name contents) contents)
"Function called to format a drawer in reStructuredText code. "Function called to format a drawer in reStructuredText code.
The function must accept two parameters: The function must accept two parameters:
@@ -589,18 +589,13 @@ channel."
;;;; Drawer ;;;; Drawer
(defun org-rst-drawer (drawer contents _info) (defun org-rst-drawer (drawer contents info)
"Transcode a DRAWER element from Org to reStructuredText. "Transcode a DRAWER element from Org to reStructuredText.
CONTENTS holds the contents of the block. INFO is a plist CONTENTS holds the contents of the block. INFO is a plist
holding contextual information." holding contextual information."
(let* ((name (org-element-property :drawer-name drawer)) (funcall (plist-get info :rst-format-drawer-function)
(output (if (functionp org-rst-format-drawer-function) (org-element-property :drawer-name drawer)
(funcall org-rst-format-drawer-function contents))
name contents)
;; If there's no user defined function: simply
;; display contents of the drawer.
contents)))
output))
;;;; Dynamic Block ;;;; Dynamic Block