0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 23:17:49 +00:00

Merge branch 'maint'

This commit is contained in:
Nicolas Goaziou 2014-07-24 15:01:25 +02:00
commit 010d105b04

View file

@ -2864,6 +2864,17 @@ information."
;;;; Paragraph ;;;; 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) (defun org-odt--format-paragraph (paragraph contents default center quote)
"Format paragraph according to given styles. "Format paragraph according to given styles.
PARAGRAPH is a paragraph type element. CONTENTS is the 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 CENTER and QUOTE are, respectively, style to use when paragraph
belongs to no special environment, a center block, or a quote belongs to no special environment, a center block, or a quote
block." block."
(let* ((parent (org-export-get-parent paragraph)) (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
(parent-type (org-element-type parent)) (case (org-odt--paragraph-style paragraph)
(style (case parent-type (quoted quote)
(quote-block quote) (centered center)
(center-block center) (otherwise default))
(t default)))) ;; If PARAGRAPH is a leading paragraph in an item that has
;; If this paragraph is a leading paragraph in an item and the ;; a checkbox, splice checkbox and paragraph contents
;; item has a checkbox, splice the checkbox and paragraph contents ;; together.
;; together. (concat (let ((parent (org-element-property :parent paragraph)))
(when (and (eq (org-element-type parent) 'item) (and (eq (org-element-type parent) 'item)
(eq paragraph (car (org-element-contents parent)))) (not (org-export-get-previous-element paragraph info))
(setq contents (concat (org-odt--checkbox parent) contents))) (org-odt--checkbox parent)))
(format "\n<text:p text:style-name=\"%s\">%s</text:p>" style contents))) contents)))
(defun org-odt-paragraph (paragraph contents info) (defun org-odt-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to ODT. "Transcode a PARAGRAPH element from Org to ODT.