From 2e6ef4e5d531a6044dc7dc712b96a5c31ea1185c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Matox?= Date: Wed, 4 Aug 2004 15:12:14 +0000 Subject: [PATCH] remove \r from line's end when present -- lyx2lyx git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8867 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/ChangeLog | 5 ++++- lib/lyx2lyx/parser_tools.py | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/lyx2lyx/ChangeLog b/lib/lyx2lyx/ChangeLog index cd313dd09d..8086a57789 100644 --- a/lib/lyx2lyx/ChangeLog +++ b/lib/lyx2lyx/ChangeLog @@ -1,3 +1,7 @@ +2004-08-05 José Matos + + * parser_tools.py (read_file): remove \r from line's end when present. + 2004-07-01 Georg Baum * lyx_1_4.py (convert_paperpackage): new, convert paperpackage setting @@ -15,7 +19,6 @@ 2004-05-11 José Matos - * parser_tools.py (get_backend): get the document backend. * lyx2lyx (main): new member of the document structure, the textclass and backend, that default to article and latex. diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index 0d346205bf..ff93682113 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -210,6 +210,10 @@ def read_file(header, body, opt): opt.error("Invalid LyX file.") line = line[:-1] + # remove '\r' from line's end, if present + if line[-1:] == '\r': + line = line[:-1] + if check_token(line, '\\begin_preamble'): preamble = 1 if check_token(line, '\\end_preamble'): @@ -227,7 +231,11 @@ def read_file(header, body, opt): line = opt.input.readline() if not line: break - body.append(line[:-1]) + # remove '\r' from line's end, if present + if line[-2:-1] == '\r': + body.append(line[:-2]) + else: + body.append(line[:-1]) def write_file(header, body, opt): -- 2.39.2