mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Thinko.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36232 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
06e963f73e
commit
a1589fb091
@ -949,7 +949,6 @@ def revert_multirow(document):
|
|||||||
add_to_preamble(document, ["\\usepackage{multirow}"])
|
add_to_preamble(document, ["\\usepackage{multirow}"])
|
||||||
|
|
||||||
begin_table = 0
|
begin_table = 0
|
||||||
mrstarts = []
|
|
||||||
while True:
|
while True:
|
||||||
# find begin/end of table
|
# find begin/end of table
|
||||||
begin_table = find_token(document.body, '<lyxtabular version=', begin_table)
|
begin_table = find_token(document.body, '<lyxtabular version=', begin_table)
|
||||||
@ -977,7 +976,8 @@ def revert_multirow(document):
|
|||||||
document.warning("Unable to determine rows and columns!")
|
document.warning("Unable to determine rows and columns!")
|
||||||
begin_table = end_table
|
begin_table = end_table
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
mrstarts = []
|
||||||
multirows = []
|
multirows = []
|
||||||
# collect info on rows and columns of this table.
|
# collect info on rows and columns of this table.
|
||||||
begin_row = begin_table
|
begin_row = begin_table
|
||||||
@ -1014,55 +1014,56 @@ def revert_multirow(document):
|
|||||||
multirows[row][column][2] = 4 # in multirow
|
multirows[row][column][2] = 4 # in multirow
|
||||||
begin_cell = end_cell
|
begin_cell = end_cell
|
||||||
begin_row = end_row
|
begin_row = end_row
|
||||||
# end for loops
|
# end of table info collection
|
||||||
begin_table = end_table
|
|
||||||
|
|
||||||
# work from the back to avoid messing up numbering
|
# work from the back to avoid messing up numbering
|
||||||
mrstarts.reverse()
|
mrstarts.reverse()
|
||||||
for m in mrstarts:
|
for m in mrstarts:
|
||||||
row = m[0]
|
row = m[0]
|
||||||
col = m[1]
|
col = m[1]
|
||||||
# get column width
|
# get column width
|
||||||
col_width = get_option_value(document.body[begin_table + 2 + col], "width")
|
col_width = get_option_value(document.body[begin_table + 2 + col], "width")
|
||||||
# "0pt" means that no width is specified
|
# "0pt" means that no width is specified
|
||||||
if not col_width or col_width == "0pt":
|
if not col_width or col_width == "0pt":
|
||||||
col_width = "*"
|
col_width = "*"
|
||||||
# determine the number of cells that are part of the multirow
|
# determine the number of cells that are part of the multirow
|
||||||
nummrs = 1
|
nummrs = 1
|
||||||
for r in range(row + 1, numrows):
|
for r in range(row + 1, numrows):
|
||||||
if multirows[r][col][2] != 4:
|
if multirows[r][col][2] != 4:
|
||||||
break
|
break
|
||||||
nummrs += 1
|
nummrs += 1
|
||||||
# take the opportunity to revert this line
|
# take the opportunity to revert this line
|
||||||
lineno = multirows[r][col][0]
|
lineno = multirows[r][col][0]
|
||||||
document.body[lineno] = document.body[lineno].\
|
document.body[lineno] = document.body[lineno].\
|
||||||
replace(' multirow="4" ', ' ').\
|
replace(' multirow="4" ', ' ').\
|
||||||
replace('valignment="middle"', 'valignment="top"').\
|
replace('valignment="middle"', 'valignment="top"').\
|
||||||
replace(' topline="true" ', ' ')
|
replace(' topline="true" ', ' ')
|
||||||
# remove bottom line of previous multirow-part cell
|
# remove bottom line of previous multirow-part cell
|
||||||
lineno = multirows[r-1][col][0]
|
lineno = multirows[r-1][col][0]
|
||||||
document.body[lineno] = document.body[lineno].replace(' bottomline="true" ', ' ')
|
document.body[lineno] = document.body[lineno].replace(' bottomline="true" ', ' ')
|
||||||
# revert beginning cell
|
# revert beginning cell
|
||||||
bcell = multirows[row][col][0]
|
bcell = multirows[row][col][0]
|
||||||
ecell = multirows[row][col][1]
|
ecell = multirows[row][col][1]
|
||||||
document.body[bcell] = document.body[bcell].\
|
document.body[bcell] = document.body[bcell].\
|
||||||
replace(' multirow="3" ', ' ').\
|
replace(' multirow="3" ', ' ').\
|
||||||
replace('valignment="middle"', 'valignment="top"')
|
replace('valignment="middle"', 'valignment="top"')
|
||||||
blay = find_token(document.body, "\\begin_layout", bcell, ecell)
|
blay = find_token(document.body, "\\begin_layout", bcell, ecell)
|
||||||
if blay == -1:
|
if blay == -1:
|
||||||
document.warning("Can't find layout for cell!")
|
document.warning("Can't find layout for cell!")
|
||||||
continue
|
continue
|
||||||
bend = find_end_of_layout(document.body, blay)
|
bend = find_end_of_layout(document.body, blay)
|
||||||
if bend == -1:
|
if bend == -1:
|
||||||
document.warning("Can't find end of layout for cell!")
|
document.warning("Can't find end of layout for cell!")
|
||||||
continue
|
continue
|
||||||
# do the later one first, so as not to mess up the numbering
|
# do the later one first, so as not to mess up the numbering
|
||||||
# we are wrapping the whole cell in this ert
|
# we are wrapping the whole cell in this ert
|
||||||
# so before the end of the layout...
|
# so before the end of the layout...
|
||||||
document.body[bend:bend] = put_cmd_in_ert("}")
|
document.body[bend:bend] = put_cmd_in_ert("}")
|
||||||
# ...and after the beginning
|
# ...and after the beginning
|
||||||
document.body[blay + 1:blay + 1] = \
|
document.body[blay + 1:blay + 1] = \
|
||||||
put_cmd_in_ert("\\multirow{" + str(nummrs) + "}{" + col_width + "}{")
|
put_cmd_in_ert("\\multirow{" + str(nummrs) + "}{" + col_width + "}{")
|
||||||
|
|
||||||
|
begin_table = end_table
|
||||||
|
|
||||||
|
|
||||||
def convert_math_output(document):
|
def convert_math_output(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user