emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* manual linebreaks in odt
@ 2013-10-23 14:10 Andreas Leha
  2013-10-23 16:15 ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Leha @ 2013-10-23 14:10 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

the odt exporter introduces a spurious [space] at the beginning of the
new line after a manual line break enforced by '\\'.

According to the manual [fn:1] '\\' is the intended syntax for
linebreaks.  Thus, this seems to be a bug in the odt exporter.

Here is a MWE:
--8<---------------cut here---------------start------------->8---
* Test line breaks in odt exports

Here is a manual\\
linebreak.
--8<---------------cut here---------------end--------------->8---



Regards,
Andreas

Footnotes:

[fn:1] http://orgmode.org/manual/Paragraphs.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: manual linebreaks in odt
  2013-10-23 14:10 manual linebreaks in odt Andreas Leha
@ 2013-10-23 16:15 ` Nicolas Goaziou
  2013-10-23 17:05   ` [PATCH] " Christian Moe
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2013-10-23 16:15 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-orgmode

Hello,

Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:

> Here is a MWE:
> * Test line breaks in odt exports
>
> Here is a manual\\ linebreak.

This is not a line break. In Org "\\" string has to appear at the end of
line.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Re:  manual linebreaks in odt
  2013-10-23 16:15 ` Nicolas Goaziou
@ 2013-10-23 17:05   ` Christian Moe
  2013-10-23 17:06     ` Nicolas Goaziou
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Moe @ 2013-10-23 17:05 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Andreas Leha, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]


Hi,

Nicolas, Andreas did put the "\\" at the end, but the line must have got
wrapped in your email client.

I confirm the behavior Andreas reported -- spaces are being needlessly
added after forced line breaks in ODT export. 

A couple of redundant newlines in ox-odt.el seem to be at fault, so I
attach one of the simplest patches ever...

Yours,
Christian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ODT-Stop-adding-leading-space-after-line-break.patch --]
[-- Type: text/x-patch, Size: 1412 bytes --]

From 187ba51d721ef4e06ca7ae647216ada8800a9c32 Mon Sep 17 00:00:00 2001
From: Christian Moe <mail@christianmoe.com>
Date: Wed, 23 Oct 2013 18:49:03 +0200
Subject: [PATCH] ODT: Stop adding leading space after line break

* lisp/ox-odt.el (org-odt-line-break): remove newline after line-break
tag
(org-odt-plain-text): ditto.

The exporter was pretty-printing the ODT XML with newlines after
forced line breaks, but LibreOffice would interpret those as
spaces. This led to a leading space after every manual line break.
---
 lisp/ox-odt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index 57a9b6e..775fe1d 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -2059,7 +2059,7 @@ CONTENTS is nil.  INFO is a plist holding contextual information."
 (defun org-odt-line-break (line-break contents info)
   "Transcode a LINE-BREAK object from Org to ODT.
 CONTENTS is nil.  INFO is a plist holding contextual information."
-  "<text:line-break/>\n")
+  "<text:line-break/>")
 
 
 ;;;; Link
@@ -2980,7 +2980,7 @@ contextual information."
     ;; Handle break preservation if required.
     (when (plist-get info :preserve-breaks)
       (setq output (replace-regexp-in-string
-		    "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>\n" output t)))
+		    "\\(\\\\\\\\\\)?[ \t]*\n" "<text:line-break/>" output t)))
     ;; Return value.
     output))
 
-- 
1.8.3.2


[-- Attachment #3: Type: text/plain, Size: 292 bytes --]



Nicolas Goaziou writes:

> Hello,
>
> Andreas Leha <andreas.leha@med.uni-goettingen.de> writes:
>
>> Here is a MWE:
>> * Test line breaks in odt exports
>>
>> Here is a manual\\ linebreak.
>
> This is not a line break. In Org "\\" string has to appear at the end of
> line.
>
>
> Regards,


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Re: manual linebreaks in odt
  2013-10-23 17:05   ` [PATCH] " Christian Moe
@ 2013-10-23 17:06     ` Nicolas Goaziou
  2013-10-23 22:07       ` Andreas Leha
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2013-10-23 17:06 UTC (permalink / raw)
  To: Christian Moe; +Cc: Andreas Leha, emacs-orgmode

Hello,

Christian Moe <mail@christianmoe.com> writes:

> Nicolas, Andreas did put the "\\" at the end, but the line must have got
> wrapped in your email client.

You're right. For some reason, Gnus sometimes eats newline characters
within scissors markup.

> I confirm the behavior Andreas reported -- spaces are being needlessly
> added after forced line breaks in ODT export. 
>
> A couple of redundant newlines in ox-odt.el seem to be at fault, so I
> attach one of the simplest patches ever...

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Re: manual linebreaks in odt
  2013-10-23 17:06     ` Nicolas Goaziou
@ 2013-10-23 22:07       ` Andreas Leha
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Leha @ 2013-10-23 22:07 UTC (permalink / raw)
  To: emacs-orgmode

Hi Nicolas and Christian,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

> Hello,
>
> Christian Moe <mail@christianmoe.com> writes:
>
>> Nicolas, Andreas did put the "\\" at the end, but the line must have got
>> wrapped in your email client.
>
> You're right. For some reason, Gnus sometimes eats newline characters
> within scissors markup.
>
>> I confirm the behavior Andreas reported -- spaces are being needlessly
>> added after forced line breaks in ODT export. 
>>
>> A couple of redundant newlines in ox-odt.el seem to be at fault, so I
>> attach one of the simplest patches ever...
>
> Applied. Thank you.

Thank you both for following this up!  And thanks for the quick patch,
Christian.  I can confirm that my issue is solved!

Regards,
Andreas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-23 22:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-23 14:10 manual linebreaks in odt Andreas Leha
2013-10-23 16:15 ` Nicolas Goaziou
2013-10-23 17:05   ` [PATCH] " Christian Moe
2013-10-23 17:06     ` Nicolas Goaziou
2013-10-23 22:07       ` Andreas Leha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).