i = 0
while 1:
i = find_token(document.body, "\\begin_inset CommandInset", i)
i = 0
while 1:
i = find_token(document.body, "\\begin_inset CommandInset", i)
nextline = document.body[i+1]
r = re.compile(r'LatexCommand\s+(.*)$')
m = r.match(nextline)
if not m:
document.warning("Malformed LyX document: Missing LatexCommand in " + document.body[i] + ".")
nextline = document.body[i+1]
r = re.compile(r'LatexCommand\s+(.*)$')
m = r.match(nextline)
if not m:
document.warning("Malformed LyX document: Missing LatexCommand in " + document.body[i] + ".")
cmdName = m.group(1)
insertion = ["\\begin_inset LatexCommand " + cmdName]
document.body[i : i+2] = insertion
cmdName = m.group(1)
insertion = ["\\begin_inset LatexCommand " + cmdName]
document.body[i : i+2] = insertion