break
j = i+1
while 1:
- j = find_tokens(lines, ["\\latex default", "\\begin_inset", "\\layout", "\\end_inset", "\\end_float", "\\the_end"],
+ # \end_inset is for ert inside a tabular cell. The other tokens
+ # are obvious.
+ j = find_tokens(lines, ["\\latex default", "\\layout", "\\begin_inset", "\\end_inset", "\\end_float", "\\the_end"],
j)
if check_token(lines[j], "\\begin_inset"):
- j = find_end_of_inset(lines, j)
+ j = find_end_of_inset(lines, j)+1
else:
break
break
j = find_end_of_inset(lines, i)
- lyxwidth = string.split(lines[i])[3]+"pt"
- lyxheight = string.split(lines[i])[4]+"pt"
+ if ( len(string.split(lines[i])) > 2 ):
+ lyxwidth = string.split(lines[i])[3]+"pt"
+ lyxheight = string.split(lines[i])[4]+"pt"
+ else:
+ lyxwidth = ""
+ lyxheight = ""
filename = get_value(lines, "file", i+1, j)
i = find_token(lines, "\\begin_inset LatexCommand \\listof", i)
if i == -1:
break
- type = lines[i][33:-3]
+ type = re.search(r"listof(\w*)", lines[i]).group(1)[:-1]
lines[i] = "\\begin_inset FloatList "+type
i = i+1