- ert_end = find_end_of_inset(document.body, k + 1)
- line = line[16:]
- if line.startswith("\\begin_inset Formula"):
- line = line[20:]
- if line.startswith("\\begin_layout Standard"):
- line = line[22:]
- if line.startswith("\\begin_layout Plain Layout"):
- line = line[26:]
- if line.startswith("\\end_layout"):
- line = line[11:]
- if line.startswith("\\end_inset"):
- line = line[10:]
- if line.startswith("status collapsed"):
- line = line[16:]
- if line.startswith("status open"):
- line = line[11:]
+ # We don't want to replace things inside ERT, so figure out
+ # where the end of the inset is.
+ ert_end = find_end_of_inset(document.body, curline + 1)
+ continue
+ elif line.startswith("\\begin_inset Formula"):
+ line = line[20:]
+ elif line.isspace() or \
+ line.startswith("\\begin_layout Standard") or \
+ line.startswith("\\begin_layout Plain Layout") or \
+ line.startswith("\\end_layout") or \
+ line.startswith("\\end_inset") or \
+ line.startswith("\\lang") or \
+ line.startswith("status collapsed") or \
+ line.startswith("status open"):
+ #skip all that stuff
+ continue
+