mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Minor fixups to xymatrix reversion routine.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36060 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69cd79b7e7
commit
49a2a04963
@ -1479,18 +1479,18 @@ def revert_inset_preview(document):
|
|||||||
def revert_equalspacing_xymatrix(document):
|
def revert_equalspacing_xymatrix(document):
|
||||||
" Revert a Formula with xymatrix@! to an ERT inset "
|
" Revert a Formula with xymatrix@! to an ERT inset "
|
||||||
i = 0
|
i = 0
|
||||||
j = 0
|
|
||||||
has_preamble = False
|
has_preamble = False
|
||||||
has_equal_spacing = False
|
has_equal_spacing = False
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
found = -1
|
|
||||||
i = find_token(document.body, "\\begin_inset Formula", i)
|
i = find_token(document.body, "\\begin_inset Formula", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
j = find_end_of_inset(document.body, i)
|
j = find_end_of_inset(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Could not find end of Formula inset.")
|
document.warning("Malformed LyX document: Could not find end of Formula inset.")
|
||||||
break
|
i += 1
|
||||||
|
continue
|
||||||
|
|
||||||
for curline in range(i,j):
|
for curline in range(i,j):
|
||||||
found = document.body[curline].find("\\xymatrix@!")
|
found = document.body[curline].find("\\xymatrix@!")
|
||||||
@ -1503,7 +1503,7 @@ def revert_equalspacing_xymatrix(document):
|
|||||||
content += document.body[i + 1:j]
|
content += document.body[i + 1:j]
|
||||||
subst = put_cmd_in_ert(content)
|
subst = put_cmd_in_ert(content)
|
||||||
document.body[i:j + 1] = subst
|
document.body[i:j + 1] = subst
|
||||||
i += len(subst)
|
i += len(subst) - (j - i) + 1
|
||||||
else:
|
else:
|
||||||
for curline in range(i,j):
|
for curline in range(i,j):
|
||||||
l = document.body[curline].find("\\xymatrix")
|
l = document.body[curline].find("\\xymatrix")
|
||||||
@ -1511,8 +1511,9 @@ def revert_equalspacing_xymatrix(document):
|
|||||||
has_preamble = True;
|
has_preamble = True;
|
||||||
break;
|
break;
|
||||||
i = j + 1
|
i = j + 1
|
||||||
|
|
||||||
if has_equal_spacing and not has_preamble:
|
if has_equal_spacing and not has_preamble:
|
||||||
add_to_preamble(document, ['\\usepackage[all]{xy}'])
|
add_to_preamble(document, ['% lyx2lyx xymatrix addition', '\\usepackage[all]{xy}'])
|
||||||
|
|
||||||
|
|
||||||
def revert_notefontcolor(document):
|
def revert_notefontcolor(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user