Make encoding conversion more robust (workaround for bug 3404)

* lib/lyx2lyx/lyx_1_5.py
	(convert_multiencoding): Don't get confused by too many \end_layout
	tokens.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17673 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2007-04-01 09:33:39 +00:00
parent bd12273085
commit 7974192d28

View File

@ -262,7 +262,11 @@ necessary parsing in modern formats than in ancient ones.
encoding_stack.append(encoding_stack[-1])
elif find_token(document.body, "\\end_layout", i, i + 1) == i:
document.warning("Removing nested encoding %s." % encoding_stack[-1], 3)
del encoding_stack[-1]
if len(encoding_stack) == 1:
# Don't remove the document encoding from the stack
document.warning("Malformed LyX document: Unexpected `\\end_layout'.")
else:
del encoding_stack[-1]
if encoding_stack[-1] != document.encoding:
if forward:
# This line has been incorrectly interpreted as if it was