diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 4232f16f9a..5fb46ba83a 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -34,13 +34,13 @@ from lyx2lyx_tools import add_to_preamble, insert_to_preamble, \ #################################################################### # Private helper functions -def remove_option(document, m, option): +def remove_option(lines, m, option): ''' removes option from line m. returns whether we did anything ''' - l = document.body[m].find(option) + l = lines[m].find(option) if l == -1: return False - val = document.body[m][l:].split('"')[1] - document.body[m] = document.body[m][:l - 1] + document.body[m][l+len(option + '="' + val + '"'):] + val = lines[m][l:].split('"')[1] + lines[m] = lines[m][:l - 1] + lines[m][l+len(option + '="' + val + '"'):] return True @@ -1380,15 +1380,34 @@ def revert_output_sync(document): del document.header[i] -# FIXME This doesn't do anything!! def revert_align_decimal(document): - l = 0 + i = 0 while True: - l = document.body[l].find('alignment=decimal') - if l == -1: - break - remove_option(document, l, 'decimal_point') - document.body[l].replace('decimal', 'center') + i = find_token(document.body, "\\begin_inset Tabular", i) + if i == -1: + return + j = find_end_of_inset(document.body, i) + if j == -1: + document.warning("Unable to find end of Tabular inset at line " + str(i)) + i += 1 + continue + cell = find_token(document.body, "