[O] [PATCH] Re: manual linebreaks in odt

2013-10-23 Thread Christian Moe

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

>From 187ba51d721ef4e06ca7ae647216ada8800a9c32 Mon Sep 17 00:00:00 2001
From: Christian Moe 
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."
-  "\n")
+  "")
 
 
  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" "\n" output t)))
+		"\\(\\)?[ \t]*\n" "" output t)))
 ;; Return value.
 output))
 
-- 
1.8.3.2



Nicolas Goaziou writes:

> Hello,
>
> Andreas Leha  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,



Re: [O] [PATCH] Re: manual linebreaks in odt

2013-10-23 Thread Nicolas Goaziou
Hello,

Christian Moe  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



Re: [O] [PATCH] Re: manual linebreaks in odt

2013-10-23 Thread Andreas Leha
Hi Nicolas and Christian,

Nicolas Goaziou  writes:

> Hello,
>
> Christian Moe  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