Browse Source

ox-org: OPTIONS keyword belong to the template

* lisp/ox-org.el (org-org-keyword): Do not handle OPTIONS keywords
  since those are handled in the template.
(org-org-template): Handle OPTIONS keyword.

As a consequence, OPTIONS keyword do not appear anymore when doing
a body-only export.

Thanks to Thorsten Jolitz for suggesting the idea.
http://permalink.gmane.org/gmane.emacs.orgmode/89633
Nicolas Goaziou 10 years ago
parent
commit
c7a2024f65
1 changed files with 9 additions and 1 deletions
  1. 9 1
      lisp/ox-org.el

+ 9 - 1
lisp/ox-org.el

@@ -147,7 +147,7 @@ keywords targeted at other export back-ends."
 			 org-element-block-name-alist))
 		(member key
 			'("AUTHOR" "CREATOR" "DATE" "DESCRIPTION" "EMAIL"
-			  "KEYWORDS" "TITLE")))
+			  "KEYWORDS" "OPTIONS" "TITLE")))
       (org-element-keyword-interpreter keyword nil))))
 
 (defun org-org-template (contents info)
@@ -157,6 +157,14 @@ as a communication channel."
   (concat
    (and (plist-get info :time-stamp-file)
 	(format-time-string "# Created %Y-%m-%d %a %H:%M\n"))
+   (org-element-normalize-string
+    (mapconcat #'identity
+	       (org-element-map (plist-get info :parse-tree) 'keyword
+		 (lambda (k)
+		   (and (string-equal (org-element-property :key k) "OPTIONS")
+			(concat "#+OPTIONS: "
+				(org-element-property :value k)))))
+	       "\n"))
    (format "#+TITLE: %s\n" (org-export-data (plist-get info :title) info))
    (and (plist-get info :with-date)
 	(let ((date (org-export-data (org-export-get-date info) info)))