mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
Convert tabular version 2 -> version 3
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5131 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1d1289f503
commit
30b1be2182
@ -22,7 +22,7 @@ bool_table = {"0": "false", "1":"true" }
|
|||||||
align_table = {"0": "top", "2": "left", "4": "right", "8": "center"}
|
align_table = {"0": "top", "2": "left", "4": "right", "8": "center"}
|
||||||
use_table = {"0": "none", "1": "parbox"}
|
use_table = {"0": "none", "1": "parbox"}
|
||||||
|
|
||||||
table_meta_re = re.compile(r'<LyXTabular version="1" rows="(\d*)" columns="(\d*)">')
|
#table_meta_re = re.compile(r'<LyXTabular version="1" rows="(\d*)" columns="(\d*)">')
|
||||||
def update_tabular(lines):
|
def update_tabular(lines):
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while 1:
|
||||||
|
@ -399,6 +399,31 @@ def remove_figinset(lines):
|
|||||||
new = new + ["\end_inset"]
|
new = new + ["\end_inset"]
|
||||||
lines[i:j+1] = new
|
lines[i:j+1] = new
|
||||||
|
|
||||||
|
attr_re = re.compile(r' \w*="(false|0|)"')
|
||||||
|
line_re = re.compile(r'<(features|column|row|cell)')
|
||||||
|
|
||||||
|
def update_tabular(lines):
|
||||||
|
i = 0
|
||||||
|
while 1:
|
||||||
|
i = find_token(lines, '\\begin_inset Tabular', i)
|
||||||
|
if i == -1:
|
||||||
|
break
|
||||||
|
|
||||||
|
# scan table header meta-info
|
||||||
|
lines[i+1] = string.replace(lines[i+1], 'version="2"', 'version="3"')
|
||||||
|
|
||||||
|
j = find_token(lines, '</lyxtabular>', i)
|
||||||
|
if j == -1:
|
||||||
|
break
|
||||||
|
|
||||||
|
for k in xrange(i+2,j):
|
||||||
|
if check_token(lines[k], "<column"):
|
||||||
|
lines[k] = string.replace(lines[k], 'width=""', 'width="0pt"')
|
||||||
|
if line_re.match(lines[k]):
|
||||||
|
lines[k] = re.sub(attr_re, "", lines[k])
|
||||||
|
|
||||||
|
i = i+1
|
||||||
|
|
||||||
def change_preamble(lines):
|
def change_preamble(lines):
|
||||||
i = find_token(lines, "\\use_amsmath", 0)
|
i = find_token(lines, "\\use_amsmath", 0)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -412,6 +437,7 @@ def convert(header, body):
|
|||||||
language = "english"
|
language = "english"
|
||||||
|
|
||||||
change_preamble(header)
|
change_preamble(header)
|
||||||
|
update_tabular(body)
|
||||||
remove_oldminipage(body)
|
remove_oldminipage(body)
|
||||||
remove_oldfloat(body, language)
|
remove_oldfloat(body, language)
|
||||||
remove_figinset(body)
|
remove_figinset(body)
|
||||||
|
Loading…
Reference in New Issue
Block a user