1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-01-07 13:46:59 +00:00

ox-odt: Fix newlines replaced by spaces in Han script

* lisp/ox-odt.el (org-odt-plain-text): Use `fill-region' to unfill the
paragraphs with newlines accounting for scripts without spaces between
words.

Reported-by: James Harkins <jamshark70@zoho.com>
Link: https://orgmode.org/list/sbhnlv$4t1$1@ciao.gmane.io
This commit is contained in:
Ihor Radchenko 2022-10-08 21:08:47 +08:00 committed by Ihor Radchenko
parent cce846e5f7
commit 3502ce2dbb
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -2909,9 +2909,20 @@ contextual information."
(setq output
(replace-regexp-in-string (car pair) (cdr pair) output t nil))))
;; Handle break preservation if required.
(when (plist-get info :preserve-breaks)
(setq output (replace-regexp-in-string
"\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t)))
(if (plist-get info :preserve-breaks)
(setq output (replace-regexp-in-string
"\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t))
;; OpenDocument schema recognizes newlines as spaces, which may
;; not be desired in scripts that do not separate words with
;; spaces (for example, Han script). `fill-region' is able to
;; handle such situations.
(setq output
(with-temp-buffer
(insert output)
;; Unfill.
(let ((fill-column (point-max)))
(fill-region (point-min) (point-max)))
(buffer-string))))
;; Return value.
output))