diff options
authorNicolas Goaziou <>2014-07-24 13:01:25 (GMT)
committer Nicolas Goaziou <>2014-07-24 13:01:25 (GMT)
commit010d105b044e522f704bd4c42a7b69b7e07c7d7a (patch)
parentdb0130468bfea30755faa329e506f021d375cca6 (diff)
parent776972cfe83ef79fd76dee79398351797f8cf9ff (diff)
Merge branch 'maint'HEADmaster
1 files changed, 24 insertions, 13 deletions
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index eb359a4..9d170d8 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2864,6 +2864,17 @@ information."
;;;; Paragraph
+(defun org-odt--paragraph-style (paragraph)
+ "Return style of PARAGRAPH.
+Style is a symbol among `quoted', `centered' and nil."
+ (let ((up paragraph))
+ (while (and (setq up (org-element-property :parent up))
+ (not (memq (org-element-type up)
+ '(center-block quote-block section)))))
+ (case (org-element-type up)
+ (center-block 'centered)
+ (quote-block 'quoted))))
(defun org-odt--format-paragraph (paragraph contents default center quote)
"Format paragraph according to given styles.
PARAGRAPH is a paragraph type element. CONTENTS is the
@@ -2871,19 +2882,19 @@ transcoded contents of that paragraph, as a string. DEFAULT,
CENTER and QUOTE are, respectively, style to use when paragraph
belongs to no special environment, a center block, or a quote
- (let* ((parent (org-export-get-parent paragraph))
- (parent-type (org-element-type parent))
- (style (case parent-type
- (quote-block quote)
- (center-block center)
- (t default))))
- ;; If this paragraph is a leading paragraph in an item and the
- ;; item has a checkbox, splice the checkbox and paragraph contents
- ;; together.
- (when (and (eq (org-element-type parent) 'item)
- (eq paragraph (car (org-element-contents parent))))
- (setq contents (concat (org-odt--checkbox parent) contents)))
- (format "\n<text:p text:style-name=\"%s\">%s</text:p>" style contents)))
+ (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
+ (case (org-odt--paragraph-style paragraph)
+ (quoted quote)
+ (centered center)
+ (otherwise default))
+ ;; If PARAGRAPH is a leading paragraph in an item that has
+ ;; a checkbox, splice checkbox and paragraph contents
+ ;; together.
+ (concat (let ((parent (org-element-property :parent paragraph)))
+ (and (eq (org-element-type parent) 'item)
+ (not (org-export-get-previous-element paragraph info))
+ (org-odt--checkbox parent)))
+ contents)))
(defun org-odt-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to ODT.