mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 21:07:54 +00:00
ox-odt: Fix handling of quoted and centered paragraphs
* lisp/ox-odt.el (org-odt--paragraph-style): New function. (org-odt--format-paragraph): Use new function to get proper style to apply. Thanks to Baptiste for reporting it. http://permalink.gmane.org/gmane.emacs.orgmode/88798
This commit is contained in:
parent
c9613c0cad
commit
776972cfe8
|
@ -2832,6 +2832,17 @@ INFO is a plist holding contextual information. See
|
|||
|
||||
;;;; 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
|
||||
|
@ -2839,19 +2850,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
|
||||
block."
|
||||
(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.
|
||||
|
|
Loading…
Reference in a new issue