From 0c15bf694f8051eb58fd131868059460f28f2e0d Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 18 Jan 2012 18:34:11 +0100 Subject: [PATCH] org-exp: Set neutral behaviour towards drawers * lisp/org-exp.el (org-export-with-drawers): Change default value so all drawers are exportable as a default. (org-export-preprocess-string): Handle drawers earlier in the preprocess, so their contents can be modified further. (org-export-format-drawer): Change default behaviour contents of drawers are exported as Org code. As a special case, property drawers are still ignored. --- lisp/org-exp.el | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index c7e1a94..d9b0a3e 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -406,7 +406,7 @@ This option can also be set with the +OPTIONS line, e.g. \"tags:nil\"." (const :tag "Not in TOC" not-in-toc) (const :tag "On" t))) -(defcustom org-export-with-drawers nil +(defcustom org-export-with-drawers t "Non-nil means export with drawers like the property drawer. When t, all drawers are exported. This may also be a list of drawer names to export." @@ -1156,6 +1156,10 @@ on this string to produce the exported version." ;; Get rid of tasks, depending on configuration (org-export-remove-tasks (plist-get parameters :tasks)) + ;; Get rid of drawers + (org-export-remove-or-extract-drawers + drawers (plist-get parameters :drawers)) + ;; Prepare footnotes for export. During that process, footnotes ;; actually included in the exported part of the buffer go ;; though some transformations: @@ -1209,10 +1213,6 @@ on this string to produce the exported version." ;; Find HTML special classes for headlines (org-export-remember-html-container-classes) - ;; Get rid of drawers - (org-export-remove-or-extract-drawers - drawers (plist-get parameters :drawers)) - ;; Get the correct stuff before the first headline (when (plist-get parameters :skip-before-1st-heading) (goto-char (point-min)) @@ -1500,19 +1500,9 @@ EXP-DRAWERS will be removed." name content)) (insert content))))))) -(defun org-export-format-drawer (name content) - "Format the content of a drawer as a colon example." - (if (string-match "[ \t]+\\'" content) - (setq content (substring content (match-beginning 0)))) - (while (string-match "\\`[ \t]*\n" content) - (setq content (substring content (match-end 0)))) - (setq content (org-remove-indentation content)) - (setq content (concat ": " (mapconcat 'identity - (org-split-string content "\n") - "\n: ") - "\n")) - (setq content (concat " : " (upcase name) "\n" content)) - (org-add-props content nil 'org-protected t)) +(defun org-export-format-drawer (name contents) + "Export contents of a drawer as-is." + (if (string= "PROPERTIES" name) "" contents)) (defun org-export-handle-export-tags (select-tags exclude-tags) "Modify the buffer, honoring SELECT-TAGS and EXCLUDE-TAGS. -- 1.7.8.3