From 68fd7bc22a3ac0fb2cfd99925c6947d12d7d4a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Matox?= Date: Mon, 9 Jun 2003 08:15:45 +0000 Subject: [PATCH] Assure that \layout is the first element of the lyx file. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7135 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 5 +++++ lib/lyx2lyx/lyxconvert_215.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/ChangeLog b/lib/ChangeLog index 9b3067341b..d0f1e1cfc0 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2003-06-09 José Matos + + * lyx2lyx/lyxconvert_215 (first_layout): new function to assure + that \layout is the first element in a lyx file. + 2003-06-07 José Matos * lyx2lyx/lyxconvert_216 (update_tabular): small fix to work with diff --git a/lib/lyx2lyx/lyxconvert_215.py b/lib/lyx2lyx/lyxconvert_215.py index 1bcb0833de..91990c5802 100644 --- a/lib/lyx2lyx/lyxconvert_215.py +++ b/lib/lyx2lyx/lyxconvert_215.py @@ -107,6 +107,12 @@ def remove_vcid(lines): if i != -1: del lines[i] +def first_layout(lines): + while (lines[0] == ""): + del lines[0] + if lines[0][:7] != "\\layout": + lines[:0] = ["\\layout Standard"] + def remove_space_in_units(lines): margins = ["\\topmargin","\\rightmargin", "\\leftmargin","\\bottommargin"] @@ -132,6 +138,7 @@ def remove_space_in_units(lines): i = i + 1 def convert(header,body): + first_layout(body) remove_vcid(header) remove_cursor(body) update_toc(body)