def revert_dashes(document):
"convert \\twohyphens and \\threehyphens to -- and ---"
+ # eventually remove preamble code from 2.3->2.2 conversion:
+ for i, line in enumerate(document.preamble):
+ if i > 1 and line == r'\renewcommand{\textemdash}{---}':
+ if (document.preamble[i-1] == r'\renewcommand{\textendash}{--}'
+ and document.preamble[i-2] == '% Added by lyx2lyx'):
+ del document.preamble[i-2:i+1]
i = 0
while i < len(document.body):
words = document.body[i].split()
if i == -1:
return
binset = find_token(document.body, "\\begin_inset Box", i - 11)
- if binset == -1:
- return # then "thickness" is is just a word in the text
+ if binset == -1 or binset != i - 11:
+ i = i + 1
+ continue # then "thickness" is is just a word in the text
einset = find_end_of_inset(document.body, binset)
if einset == -1:
document.warning("Malformed LyX document: Can't find end of box inset!")
+ i = i + 1
continue
# read out the values
beg = document.body[i].find('"');