X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Flyx_1_1_5.py;h=304ff7a48e644b3f49d67a8fbfe41006b0cd2a65;hb=40aedb51466eb74f1b4ef54fad92dc47bab5f1cc;hp=fde89f5595c996960ced9d5467388700b29d6cd0;hpb=695bfd88ed8f02e35c4a31664ed5a2b9f135cf72;p=lyx.git diff --git a/lib/lyx2lyx/lyx_1_1_5.py b/lib/lyx2lyx/lyx_1_1_5.py index fde89f5595..304ff7a48e 100644 --- a/lib/lyx2lyx/lyx_1_1_5.py +++ b/lib/lyx2lyx/lyx_1_1_5.py @@ -14,12 +14,11 @@ # # 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.5""" import re -import string from parser_tools import find_token, find_token_backwards, find_re #################################################################### @@ -27,7 +26,7 @@ from parser_tools import find_token, find_token_backwards, find_re def get_layout(line, default_layout): " Get the line layout, beware of the empty layout." - tokens = string.split(line) + tokens = line.split() if len(tokens) > 1: return tokens[1] return default_layout @@ -91,16 +90,16 @@ def update_tabular(document): lines[i]='multicol5' i = i + 1 - rows = int(string.split(lines[i])[0]) - columns = int(string.split(lines[i])[1]) + rows = int(lines[i].split()[0]) + columns = int(lines[i].split()[1]) i = i + rows + 1 for j in range(columns): - col_info = string.split(lines[i]) + col_info = lines[i].split() if len(col_info) == 3: lines[i] = lines[i] + '"" ""' else: - lines[i] = string.join(col_info[:3]) + ' "%s" ""' % col_info[3] + lines[i] = " ".join(col_info[:3]) + ' "%s" ""' % col_info[3] i = i + 1 while lines[i]: @@ -188,7 +187,7 @@ def latexdel_getargs(document, i): document.warning("Unexpected end of inset.") j = find_token(lines, '\\begin_inset LatexDel }{', i) - ref = string.join(lines[i:j]) + ref = " ".join(lines[i:j]) del lines[i:j + 1] # play safe, clean empty lines @@ -203,7 +202,7 @@ def latexdel_getargs(document, i): else: document.warning("Unexpected end of inset.") j = find_token(lines, '\\begin_inset LatexDel }', i) - label = string.join(lines[i:j]) + label = " ".join(lines[i:j]) del lines[i:j + 1] return ref, label @@ -218,7 +217,7 @@ def update_ref(document): if i == -1: return - if string.split(lines[i])[-1] == "\\ref{": + if lines[i].split()[-1] == "\\ref{": i = i + 1 ref, label = latexdel_getargs(document, i) lines[i - 1] = "%s[%s]{%s}" % (lines[i - 1][:-1], ref, label) @@ -235,16 +234,15 @@ def update_latexdel(document): i = find_re(lines, latexdel_re, i) if i == -1: return - lines[i] = string.replace(lines[i], - '\\begin_inset LatexDel', - '\\begin_inset LatexCommand') + lines[i] = lines[i].replace('\\begin_inset LatexDel', + '\\begin_inset LatexCommand') - j = string.find(lines[i],'\\begin_inset') + j = lines[i].find('\\begin_inset') lines.insert(i+1, lines[i][j:]) - lines[i] = string.strip(lines[i][:j]) + lines[i] = lines[i][:j].strip() i = i + 1 - if string.split(lines[i])[-1] in ("\\url{", "\\htmlurl{"): + if lines[i].split()[-1] in ("\\url{", "\\htmlurl{"): i = i + 1 ref, label = latexdel_getargs(document, i)