From 5d0a284ea95359457d99d664dfc110b73124bdce Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 4 Nov 2010 15:42:28 +0000 Subject: [PATCH] Clean up remove_option routine. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36064 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 33e2e9aeab..92e9cb7675 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -29,11 +29,14 @@ from parser_tools import find_token, find_end_of, find_tokens, get_value, get_va # Private helper functions def remove_option(document, m, option): + ''' removes option from line m. returns whether we did anything ''' l = document.body[m].find(option) - if l != -1: - val = document.body[m][l:].split('"')[1] - document.body[m] = document.body[m][:l - 1] + document.body[m][l+len(option + '="' + val + '"'):] - return l + if l == -1: + return False + val = document.body[m][l:].split('"')[1] + document.body[m] = document.body[m][:l - 1] + document.body[m][l+len(option + '="' + val + '"'):] + return True + def find_end_of_inset(lines, i): " Find end of inset, where lines[i] is included." -- 2.39.5