Browse Source

org-export: Remove NOEXPAND optional argument from `org-export-as'

* contrib/lisp/org-export.el (org-export-options-alist): Fix
  docstring.
(org-export-as): Remove NOEXPAND argument.
(org-export-to-buffer, org-export-to-file): Apply argument removal.

This argument is not needed since a function removing macros, babel
code and include keywords can be added to
`org-export-before-processing-hook'.
Nicolas Goaziou 13 years ago
parent
commit
27d7d0ea17
1 changed files with 31 additions and 37 deletions
  1. 31 37
      contrib/lisp/org-export.el

+ 31 - 37
contrib/lisp/org-export.el

@@ -153,7 +153,7 @@ KEYWORD is a string representing a buffer keyword, or nil.  Each
   property).
   property).
 OPTION is a string that could be found in an #+OPTIONS: line.
 OPTION is a string that could be found in an #+OPTIONS: line.
 DEFAULT is the default value for the property.
 DEFAULT is the default value for the property.
-BEHAVIOUR determine how Org should handle multiple keywords for
+BEHAVIOUR determines how Org should handle multiple keywords for
   the same property.  It is a symbol among:
   the same property.  It is a symbol among:
   nil       Keep old value and discard the new one.
   nil       Keep old value and discard the new one.
   t         Replace old value with the new one.
   t         Replace old value with the new one.
@@ -163,7 +163,8 @@ BEHAVIOUR determine how Org should handle multiple keywords for
   `split'   Split values at white spaces, and cons them to the
   `split'   Split values at white spaces, and cons them to the
 	    previous list.
 	    previous list.
 
 
-KEYWORD and OPTION have precedence over DEFAULT.
+Values set through KEYWORD and OPTION have precedence over
+DEFAULT.
 
 
 All these properties should be back-end agnostic.  Back-end
 All these properties should be back-end agnostic.  Back-end
 specific properties are set through `org-export-define-backend'.
 specific properties are set through `org-export-define-backend'.
@@ -2591,7 +2592,7 @@ Return the updated communication channel."
 ;; associated to the file, that is before parsing.
 ;; associated to the file, that is before parsing.
 
 
 (defun org-export-as
 (defun org-export-as
-  (backend &optional subtreep visible-only body-only ext-plist noexpand)
+  (backend &optional subtreep visible-only body-only ext-plist)
   "Transcode current Org buffer into BACKEND code.
   "Transcode current Org buffer into BACKEND code.
 
 
 If narrowing is active in the current buffer, only transcode its
 If narrowing is active in the current buffer, only transcode its
@@ -2613,9 +2614,6 @@ Optional argument EXT-PLIST, when provided, is a property list
 with external parameters overriding Org default settings, but
 with external parameters overriding Org default settings, but
 still inferior to file-local settings.
 still inferior to file-local settings.
 
 
-Optional argument NOEXPAND, when non-nil, prevents included files
-to be expanded and Babel code to be executed.
-
 Return code as a string."
 Return code as a string."
   ;; Barf if BACKEND isn't registered.
   ;; Barf if BACKEND isn't registered.
   (org-export-barf-if-invalid-backend backend)
   (org-export-barf-if-invalid-backend backend)
@@ -2634,20 +2632,19 @@ Return code as a string."
       ;; Initialize communication channel with original buffer
       ;; Initialize communication channel with original buffer
       ;; attributes, unavailable in its copy.
       ;; attributes, unavailable in its copy.
       (let ((info (org-export--get-buffer-attributes)) tree)
       (let ((info (org-export--get-buffer-attributes)) tree)
+	;; Update communication channel and get parse tree.  Buffer
+	;; isn't parsed directly.  Instead, a temporary copy is
+	;; created, where include keywords, macros are expanded and
+	;; code blocks are evaluated.
 	(org-export-with-buffer-copy
 	(org-export-with-buffer-copy
 	 ;; Run first hook with current back-end as argument.
 	 ;; Run first hook with current back-end as argument.
 	 (run-hook-with-args 'org-export-before-processing-hook backend)
 	 (run-hook-with-args 'org-export-before-processing-hook backend)
-	 ;; Update communication channel and get parse tree.  Buffer
-	 ;; isn't parsed directly.  Instead, a temporary copy is
-	 ;; created, where include keywords, macros are expanded and
-	 ;; code blocks are evaluated.
-	 (unless noexpand
-	   (org-export-expand-include-keyword)
-	   ;; Update macro templates since #+INCLUDE keywords might
-	   ;; have added some new ones.
-	   (org-macro-initialize-templates)
-	   (org-macro-replace-all org-macro-templates)
-	   (org-export-execute-babel-code))
+	 (org-export-expand-include-keyword)
+	 ;; Update macro templates since #+INCLUDE keywords might have
+	 ;; added some new ones.
+	 (org-macro-initialize-templates)
+	 (org-macro-replace-all org-macro-templates)
+	 (org-export-execute-babel-code)
 	 ;; Update radio targets since keyword inclusion might have
 	 ;; Update radio targets since keyword inclusion might have
 	 ;; added some more.
 	 ;; added some more.
 	 (org-update-radio-target-regexp)
 	 (org-update-radio-target-regexp)
@@ -2664,16 +2661,15 @@ Return code as a string."
 	 ;; {{{date}}}, {{{email}}} and {{{title}}}.  It must be done
 	 ;; {{{date}}}, {{{email}}} and {{{title}}}.  It must be done
 	 ;; once regular macros have been expanded, since document
 	 ;; once regular macros have been expanded, since document
 	 ;; keywords may contain one of them.
 	 ;; keywords may contain one of them.
-	 (unless noexpand
-	   (org-macro-replace-all
-	    (list (cons "author"
-			(org-element-interpret-data (plist-get info :author)))
-		  (cons "date"
-			(org-element-interpret-data (plist-get info :date)))
-		  ;; EMAIL is not a parsed keyword: store it as-is.
-		  (cons "email" (or (plist-get info :email) ""))
-		  (cons "title"
-			(org-element-interpret-data (plist-get info :title))))))
+	 (org-macro-replace-all
+	  (list (cons "author"
+		      (org-element-interpret-data (plist-get info :author)))
+		(cons "date"
+		      (org-element-interpret-data (plist-get info :date)))
+		;; EMAIL is not a parsed keyword: store it as-is.
+		(cons "email" (or (plist-get info :email) ""))
+		(cons "title"
+		      (org-element-interpret-data (plist-get info :title)))))
 	 ;; Eventually parse buffer.  Call parse-tree filters to get
 	 ;; Eventually parse buffer.  Call parse-tree filters to get
 	 ;; the final tree.
 	 ;; the final tree.
 	 (setq tree
 	 (setq tree
@@ -2705,7 +2701,7 @@ Return code as a string."
 	  output)))))
 	  output)))))
 
 
 (defun org-export-to-buffer
 (defun org-export-to-buffer
-  (backend buffer &optional subtreep visible-only body-only ext-plist noexpand)
+  (backend buffer &optional subtreep visible-only body-only ext-plist)
   "Call `org-export-as' with output to a specified buffer.
   "Call `org-export-as' with output to a specified buffer.
 
 
 BACKEND is the back-end used for transcoding, as a symbol.
 BACKEND is the back-end used for transcoding, as a symbol.
@@ -2713,13 +2709,12 @@ BACKEND is the back-end used for transcoding, as a symbol.
 BUFFER is the output buffer.  If it already exists, it will be
 BUFFER is the output buffer.  If it already exists, it will be
 erased first, otherwise, it will be created.
 erased first, otherwise, it will be created.
 
 
-Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST
-and NOEXPAND are similar to those used in `org-export-as', which
+Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
+EXT-PLIST are similar to those used in `org-export-as', which
 see.
 see.
 
 
 Return buffer."
 Return buffer."
-  (let ((out (org-export-as
-	      backend subtreep visible-only body-only ext-plist noexpand))
+  (let ((out (org-export-as backend subtreep visible-only body-only ext-plist))
 	(buffer (get-buffer-create buffer)))
 	(buffer (get-buffer-create buffer)))
     (with-current-buffer buffer
     (with-current-buffer buffer
       (erase-buffer)
       (erase-buffer)
@@ -2728,14 +2723,14 @@ Return buffer."
     buffer))
     buffer))
 
 
 (defun org-export-to-file
 (defun org-export-to-file
-  (backend file &optional subtreep visible-only body-only ext-plist noexpand)
+  (backend file &optional subtreep visible-only body-only ext-plist)
   "Call `org-export-as' with output to a specified file.
   "Call `org-export-as' with output to a specified file.
 
 
 BACKEND is the back-end used for transcoding, as a symbol.  FILE
 BACKEND is the back-end used for transcoding, as a symbol.  FILE
 is the name of the output file, as a string.
 is the name of the output file, as a string.
 
 
-Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST
-and NOEXPAND are similar to those used in `org-export-as', which
+Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
+EXT-PLIST are similar to those used in `org-export-as', which
 see.
 see.
 
 
 Return output file's name."
 Return output file's name."
@@ -2743,8 +2738,7 @@ Return output file's name."
   ;; we'd rather avoid needless transcoding of parse tree.
   ;; we'd rather avoid needless transcoding of parse tree.
   (unless (file-writable-p file) (error "Output file not writable"))
   (unless (file-writable-p file) (error "Output file not writable"))
   ;; Insert contents to a temporary buffer and write it to FILE.
   ;; Insert contents to a temporary buffer and write it to FILE.
-  (let ((out (org-export-as
-	      backend subtreep visible-only body-only ext-plist noexpand)))
+  (let ((out (org-export-as backend subtreep visible-only body-only ext-plist)))
     (with-temp-buffer
     (with-temp-buffer
       (insert out)
       (insert out)
       (let ((coding-system-for-write org-export-coding-system))
       (let ((coding-system-for-write org-export-coding-system))