瀏覽代碼

Introduce a new customizable variable org-export-odt-prettify-xml

* contrib/lisp/org-odt.el (org-export-odt-prettify-xml): New
customizable variable.
(org-odt-save-as-outfile): Honor the setting of the above
variable.

There have not been much reported issues with the odt output.  So turn
off prettifying of xml buffers.  But retain the option to turn it on
if required.
Jambunathan K 14 年之前
父節點
當前提交
321f4d3a42
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      contrib/lisp/org-odt.el

+ 12 - 2
contrib/lisp/org-odt.el

@@ -1335,6 +1335,15 @@ MAY-INLINE-P allows inlining it as an image."
 (defconst org-odt-manifest-file-entry-tag
   "<manifest:file-entry manifest:media-type=\"%s\" manifest:full-path=\"%s\"/>")
 
+(defcustom org-export-odt-prettify-xml nil
+  "Specify whether or not the xml output should be prettified.
+When this option is turned on, `indent-region' is run on all
+component xml buffers before they are saved.  Turn this off for
+regular use.  Turn this on if you need to examine the xml
+visually."
+  :group 'org-export-odt
+  :type 'boolean)
+
 (defun org-odt-save-as-outfile (target opt-plist)
   ;; write meta file
   (org-odt-update-meta-file opt-plist)
@@ -1368,8 +1377,9 @@ MAY-INLINE-P allows inlining it as an image."
     (mapc (lambda (file)
 	    (with-current-buffer
 		(find-file-noselect (expand-file-name file) t)
-	      ;; prettify output
-	      (indent-region (point-min) (point-max))
+	      ;; prettify output if needed
+	      (when org-export-odt-prettify-xml
+		(indent-region (point-min) (point-max)))
 	      (save-buffer)))
 	  org-export-odt-save-list)