X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Flyx_1_1_6_3.py;h=4c8154797f414babd5c8ea2e7d00089b4c88fcfe;hb=0f18bc753c9555c505b3508df4439bd8a5db2319;hp=f7656d796adaf2cbbd1def62b2b6049729d8b1af;hpb=ddc31f7aeefb87901e11506f5448d68d5f462c3a;p=lyx.git diff --git a/lib/lyx2lyx/lyx_1_1_6_3.py b/lib/lyx2lyx/lyx_1_1_6_3.py index f7656d796a..4c8154797f 100644 --- a/lib/lyx2lyx/lyx_1_1_6_3.py +++ b/lib/lyx2lyx/lyx_1_1_6_3.py @@ -1,6 +1,6 @@ # This file is part of lyx2lyx -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2002-2004 José Matos +# -*- coding: utf-8 -*- +# Copyright (C) 2002-2004 José Matos # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -14,13 +14,15 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +""" Convert files to the file format generated by lyx 1.1.6, fix3 and fix4""" import re -import string from parser_tools import find_token, find_re def bool_table(item): + " Convert 0, 1 to false, true." if item == "0": return "false" # should emit a warning if item != "1" @@ -32,9 +34,10 @@ align_table = {"0": "top", "2": "left", "4": "right", "8": "center"} use_table = {"0": "none", "1": "parbox"} table_meta_re = re.compile(r'') -def update_tabular(file): +def update_tabular(document): + " Update tabular format to version 2 (xml like syntax)." regexp = re.compile(r'^\\begin_inset\s+Tabular') - lines = file.body + lines = document.body i=0 while 1: i = find_re(lines, regexp, i) @@ -51,7 +54,7 @@ def update_tabular(file): j = find_token(lines, '', i) + 1 if j == 0: - file.warning( "Error: Bad lyx format i=%d j=%d" % (i,j)) + document.warning( "Error: Bad lyx format i=%d j=%d" % (i,j)) break new_table = table_update(lines[i:j]) @@ -65,7 +68,8 @@ features_re = re.compile(r'') def table_update(lines): - lines[1] = string.replace(lines[1], '