From: Richard Heck Date: Thu, 4 Nov 2010 20:54:58 +0000 (+0000) Subject: Fix revert_align_decimal routine. X-Git-Tag: 2.0.0~2026 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=2d7bbab89f976fbaa4f3e7109a92ddbf721dc4c9;p=features.git Fix revert_align_decimal routine. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36089 a592a061-630c-0410-9148-cb99ea01b6c8 --- 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, "