From 9eb384fe4f9a8832c4adc1bed900bc5243c31e37 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 25 Mar 2013 18:05:06 +0100 Subject: [PATCH] ox-odt.el: Fix annotation insertion. * ox-odt.el (org-odt-special-block): Don't wrap annotations into ... at all. (org-odt--fix-annotations): New defun. (org-odt--export-wrap): Use the new defun to fix annotations insertion in content.xml. Please don't insult me because of the uglyness of this fix. Send me a proper fix instead! --- lisp/ox-odt.el | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el index 9dd894608..366dbdd42 100644 --- a/lisp/ox-odt.el +++ b/lisp/ox-odt.el @@ -3066,15 +3066,14 @@ holding contextual information." (date (or (plist-get attributes :date) ;; FIXME: Is `car' right thing to do below? (car (plist-get info :date))))) - (format "\n%s" - (format "\n%s\n" - (concat - (and author - (format "%s" author)) - (and date - (format "%s" - (org-odt--format-timestamp date nil 'iso-date))) - contents))))) + (format "\n%s\n" + (concat + (and author + (format "%s" author)) + (and date + (format "%s" + (org-odt--format-timestamp date nil 'iso-date))) + contents)))) ;; Textbox. ((string= type "textbox") (let ((width (plist-get attributes :width)) @@ -3087,6 +3086,17 @@ holding contextual information." style extra anchor)))) (t contents)))) +(defun org-odt--fix-annotations () + "Fix annotations in the XML buffer." + (save-excursion + (goto-char (point-min)) + (while (search-forward "" nil t) + (and (re-search-backward "" nil t) + (replace-match "" t t)) + (and (search-forward "" nil t) + (re-search-forward "]*>" nil t) + (replace-match "" t t))))) + ;;;; Src Block @@ -4025,7 +4035,7 @@ contextual information." `(let* ((--out-file ,out-file) (out-file-type (file-name-extension --out-file)) (org-odt-xml-files '("META-INF/manifest.xml" "content.xml" - "meta.xml" "styles.xml")) + "meta.xml" "styles.xml")) ;; Initialize temporary workarea. All files that end up in ;; the exported document get parked/created here. (org-odt-zip-dir (file-name-as-directory @@ -4074,6 +4084,9 @@ contextual information." (when buf (with-current-buffer buf ;; Prettify output if needed. + (if (equal (file-name-nondirectory (buffer-file-name buf)) + "content.xml") + (org-odt--fix-annotations)) (when org-odt-prettify-xml (indent-region (point-min) (point-max))) (save-buffer 0))))) -- 2.11.4.GIT