Make convert_dashes and revert_dashes symmetric

Otherwise we could destroy math stuff.
This commit is contained in:
Georg Baum 2015-02-26 20:34:36 +01:00
parent db954b5dc0
commit ddb82b74f0

View File

@ -528,6 +528,17 @@ def revert_dashes(document):
i = 0 i = 0
while i < len(document.body): while i < len(document.body):
words = document.body[i].split()
if len(words) > 1 and words[0] == "\\begin_inset" and \
words[1] in ["ERT", "Formula", "IPA"]:
# see convert_dashes
j = find_end_of_inset(document.body, i)
if j == -1:
document.warning("Malformed LyX document: Can't find end of " + words[1] + " inset at line " + str(i))
i += 1
else:
i = j
continue
replaced = False replaced = False
if document.body[i].find("\\twohyphens") >= 0: if document.body[i].find("\\twohyphens") >= 0:
document.body[i] = document.body[i].replace("\\twohyphens", "--") document.body[i] = document.body[i].replace("\\twohyphens", "--")