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.
This commit is contained in:
Jambunathan K 2011-08-16 23:59:52 +05:30
parent a2e6a7ef90
commit 321f4d3a42
1 changed files with 12 additions and 2 deletions

View File

@ -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)