mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-08 18:19:42 +00:00
Fix convert_spaceinset again.
The problem here is that for i in range(len(document.body)): sets the range BEFORE we do any of our manipulations. But those manipulations can make document.body longer. As a result, we can fail to test some lines. Instead, use: while i < len(document.body): and increment i in the while loop. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25050 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3e95457d4c
commit
843fa219b6
@ -1856,14 +1856,18 @@ def remove_extra_embedded_files(document):
|
||||
|
||||
|
||||
def convert_spaceinset(document):
|
||||
" Convert '\\InsetSpace foo' to '\\begin_inset Space foo\n\\end_inset' "
|
||||
for i in range(len(document.body)):
|
||||
m = re.match(r'(.*)\\InsetSpace (.*)', document.body[i])
|
||||
if m:
|
||||
before = m.group(1)
|
||||
after = m.group(2)
|
||||
subst = [before, "\\begin_inset Space " + after, "\\end_inset"]
|
||||
document.body[i: i+1] = subst
|
||||
" Convert '\\InsetSpace foo' to '\\begin_inset Space foo\n\\end_inset' "
|
||||
i = 0
|
||||
while i < len(document.body):
|
||||
m = re.match(r'(.*)\\InsetSpace (.*)', document.body[i])
|
||||
if m:
|
||||
before = m.group(1)
|
||||
after = m.group(2)
|
||||
subst = [before, "\\begin_inset Space " + after, "\\end_inset"]
|
||||
document.body[i: i+1] = subst
|
||||
i = i + 3
|
||||
else:
|
||||
i = i + 1
|
||||
|
||||
|
||||
def revert_spaceinset(document):
|
||||
|
Loading…
Reference in New Issue
Block a user