X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Flyx_1_2.py;h=a47fcaf1a018f5ad7646afa0d6872de5edf35b64;hb=9da74fe2078e24e1e7891784ecbfe33ff77e7f85;hp=d2c6912f8cd2d5d0a53ed467d646a806b989e411;hpb=b00206e88239dfe8ffa0fc661efb58636f418f4e;p=lyx.git diff --git a/lib/lyx2lyx/lyx_1_2.py b/lib/lyx2lyx/lyx_1_2.py index d2c6912f8c..a47fcaf1a0 100644 --- a/lib/lyx2lyx/lyx_1_2.py +++ b/lib/lyx2lyx/lyx_1_2.py @@ -15,11 +15,10 @@ # # 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.2""" -import string import re from parser_tools import find_token, find_token_backwards, \ @@ -33,7 +32,7 @@ from parser_tools import find_token, find_token_backwards, \ def get_layout(line, default_layout): " Get layout, if empty return the default layout." - tokens = string.split(line) + tokens = line.split() if len(tokens) > 1: return tokens[1] return default_layout @@ -154,7 +153,7 @@ def remove_oldfloat(document): # There are no nested floats, so finding the end of the float is simple j = find_token(lines, "\\end_float", i+1) - floattype = string.split(lines[i])[1] + floattype = lines[i].split()[1] if not floats.has_key(floattype): document.warning("Error! Unknown float type " + floattype) floattype = "fig" @@ -477,7 +476,7 @@ def get_length(lines, name, start, end): i = find_token(lines, name, start, end) if i == -1: return "" - x = string.split(lines[i]) + x = lines[i].split() return x[2]+oldunits[int(x[1])] @@ -497,9 +496,9 @@ def remove_figinset(document): break j = find_end_of_inset(lines, i) - if ( len(string.split(lines[i])) > 2 ): - lyxwidth = string.split(lines[i])[3]+"pt" - lyxheight = string.split(lines[i])[4]+"pt" + if ( len(lines[i].split()) > 2 ): + lyxwidth = lines[i].split()[3]+"pt" + lyxheight = lines[i].split()[4]+"pt" else: lyxwidth = "" lyxheight = "" @@ -572,9 +571,9 @@ def update_tabular(document): for k in get_tabular_lines(lines, i): if check_token(lines[k], "') + last = lines[i].find('>') lines[i] = lines[i][:last] + ' ' + attribute + lines[i][last:] @@ -726,7 +725,7 @@ def update_longtables(document): # remove longtable elements from features features = lt_features_re.search(body[i]) if features: - body[i] = string.replace(body[i], features.group(1), "") + body[i] = body[i].replace(features.group(1), "") continue row_info = row() * rows @@ -798,7 +797,7 @@ def change_infoinset(document): i = find_token(lines, "\\begin_inset Info", i) if i == -1: break - txt = string.lstrip(lines[i][18:]) + txt = lines[i][18:].lstrip() new = ["\\begin_inset Note", "collapsed true", ""] j = find_token(lines, "\\end_inset", i) if j == -1: @@ -810,7 +809,7 @@ def change_infoinset(document): for line in note_lines: new = new + ['\layout %s' % document.default_layout, ""] - tmp = string.split(line, '\\') + tmp = line.split('\\') new = new + [tmp[0]] for x in tmp[1:]: new = new + ["\\backslash ", x]