emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Andreas Leha <andreas.leha@med.uni-goettingen.de>, emacs-orgmode@gnu.org
Subject: [PATCH] Re:  manual linebreaks in odt
Date: Wed, 23 Oct 2013 19:05:07 +0200	[thread overview]
Message-ID: <m2mwlzuddo.fsf@uio.no> (raw)
In-Reply-To: <87r4bct13c.fsf@gmail.com>

[-- 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,


  reply	other threads:[~2013-10-23 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 14:10 manual linebreaks in odt Andreas Leha
2013-10-23 16:15 ` Nicolas Goaziou
2013-10-23 17:05   ` Christian Moe [this message]
2013-10-23 17:06     ` [PATCH] " Nicolas Goaziou
2013-10-23 22:07       ` Andreas Leha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mwlzuddo.fsf@uio.no \
    --to=mail@christianmoe.com \
    --cc=andreas.leha@med.uni-goettingen.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).