Fix up convert_makebox routine.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36080 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-04 17:13:44 +00:00
parent 9d5b41e8fc
commit ac0ee09a23

View File

@ -1463,16 +1463,29 @@ def convert_use_makebox(document):
" Adds use_makebox option for boxes " " Adds use_makebox option for boxes "
i = 0 i = 0
while 1: while 1:
# remove the option use_makebox
i = find_token(document.body, '\\begin_inset Box', i) i = find_token(document.body, '\\begin_inset Box', i)
if i == -1: if i == -1:
return return
k = find_token(document.body, 'use_parbox', i) # all of this is to make sure we actually find the use_parbox
# that is an option for this box, not some text elsewhere.
z = find_end_of_inset(document.body, i)
if z == -1:
document.warning("Can't find end of box inset!!")
i += 1
continue
blay = find_token(document.body, "\\begin_layout", i, z)
if blay == -1:
document.warning("Can't find layout in box inset!!")
i = z
continue
# so now we are looking for use_parbox before the box's layout
k = find_token(document.body, 'use_parbox', i, blay)
if k == -1: if k == -1:
document.warning("Malformed LyX document: Can't find use_parbox statement in box.") document.warning("Malformed LyX document: Can't find use_parbox statement in box.")
return i = z
continue
document.body.insert(k + 1, "use_makebox 0") document.body.insert(k + 1, "use_makebox 0")
i = k + 1 i = z + 1
def revert_IEEEtran(document): def revert_IEEEtran(document):