On 04/11/2014 01:04 PM, Vincent van Ravesteijn wrote:
def revert_verbatim(document):
" Revert verbatim einvironments completely to TeX-code. "
i = 0
[..]
while 1:
i = find_token(document.body, "\\begin_layout Verbatim", i)
if i == -1:
return
j = find_end_of_layout(document.body, i)
if j == -1:
document.warning("Malformed LyX document: Can't find end of Verbatim
layout")
i += 1
continue
# delete all line breaks insets (there are no other insets)
l = i
while 1:
n = find_token(document.body, "\\begin_inset Newline newline", l)
if n == -1:
n = find_token(document.body, "\\begin_inset Newline
linebreak", l)
if n == -1:
break
m = find_end_of_inset(document.body, n)
del(document.body[m:m+1])
document.body[n:n+1] = ['\end_layout', '', '\\begin_layout Plain
Layout']
l += 1
j += 1
Did we just replace _all_ Newline insets in the whole document ?
Yes. And j is being reset wrong, as well. I'll work on it.
Richard