]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_1_1_6_3.py
Don't use widest label for numerical citations.
[lyx.git] / lib / lyx2lyx / lyx_1_1_6_3.py
index f7656d796adaf2cbbd1def62b2b6049729d8b1af..4c8154797f414babd5c8ea2e7d00089b4c88fcfe 100644 (file)
@@ -1,6 +1,6 @@
 # This file is part of lyx2lyx
-# -*- coding: iso-8859-1 -*-
-# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
+# -*- coding: utf-8 -*-
+# Copyright (C) 2002-2004 José Matos <jamatos@lyx.org>
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
 #
 # 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'<LyXTabular version="?1"? rows="?(\d*)"? columns="?(\d*)"?>')
 
-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, '</LyXTabular>', 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'<features rotate="?(\d)"? islongtable="?(\d)"? endhea
 row_re = re.compile(r'<row topline="?(\d)"? bottomline="?(\d)"? newpage="?(\d)"?>')
 
 def table_update(lines):
-    lines[1] = string.replace(lines[1], '<Features', '<features')
+    " Update table's internal content to format 2."
+    lines[1] = lines[1].replace('<Features', '<features')
     res = features_re.match( lines[1] )
     if res:
         val = res.groups()
@@ -76,14 +80,14 @@ def table_update(lines):
     i = 2
     col_info = []
     while i < len(lines):
-        lines[i] = string.replace(lines[i], '<Cell', '<cell')
-        lines[i] = string.replace(lines[i], '</Cell', '</cell')
-        lines[i] = string.replace(lines[i], '<Row', '<row')
-        lines[i] = string.replace(lines[i], '</Row', '</row')
-        lines[i] = string.replace(lines[i], '<Column', '<column')
-        lines[i] = string.replace(lines[i], '</Column', '</column')
-        lines[i] = string.replace(lines[i], '</LyXTabular', '</lyxtabular')
-        k = string.find (lines[i], '<column ')
+        lines[i] = lines[i].replace('<Cell', '<cell')
+        lines[i] = lines[i].replace('</Cell', '</cell')
+        lines[i] = lines[i].replace('<Row', '<row')
+        lines[i] = lines[i].replace('</Row', '</row')
+        lines[i] = lines[i].replace('<Column', '<column')
+        lines[i] = lines[i].replace('</Column', '</column')
+        lines[i] = lines[i].replace('</LyXTabular', '</lyxtabular')
+        k = lines[i].find ('<column ')
         if k != -1:
             col_info.append(lines[i])
             del lines[i]
@@ -116,6 +120,7 @@ def table_update(lines):
     return lines[:2] + col_info + lines[2:]
 
 
+supported_versions = ["1.1.6fix3","1.1.6fix4","1.1"]
 convert = [[218, [update_tabular]]]
 revert  = []