Clean up remove_option routine.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36064 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 15:42:28 +00:00
parent 3fae2dee95
commit 5d0a284ea9

View File

@ -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."