mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Clean up revert_inset_preview, and disable some of the more complex
code. As noted in the comment, it does not work as intended. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36059 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6f61652605
commit
69cd79b7e7
@ -1415,27 +1415,65 @@ def revert_math_output(document):
|
|||||||
def revert_inset_preview(document):
|
def revert_inset_preview(document):
|
||||||
" Dissolves the preview inset "
|
" Dissolves the preview inset "
|
||||||
i = 0
|
i = 0
|
||||||
j = 0
|
|
||||||
k = 0
|
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Preview", i)
|
i = find_token(document.body, "\\begin_inset Preview", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
j = find_end_of_inset(document.body, i)
|
iend = find_end_of_inset(document.body, i)
|
||||||
if j == -1:
|
if iend == -1:
|
||||||
document.warning("Malformed LyX document: Could not find end of Preview inset.")
|
document.warning("Malformed LyX document: Could not find end of Preview inset.")
|
||||||
return
|
i += 1
|
||||||
#If the layout is Standard we need to remove it, otherwise there
|
continue
|
||||||
#will be paragraph breaks that shouldn't be there.
|
|
||||||
k = find_token(document.body, "\\begin_layout Standard", i)
|
del document.body[iend]
|
||||||
if k == i + 2:
|
del document.body[i]
|
||||||
del document.body[i:i + 3]
|
|
||||||
del document.body[j - 5:j - 2]
|
# This does not work. The problem is that the last layout may not be
|
||||||
i -= 6
|
# standard, in which case the material following the preview, which
|
||||||
else:
|
# might be in this same paragraph, will now be in whatever that was.
|
||||||
del document.body[i]
|
# Moreover, the right action might depend upon what layout we are in,
|
||||||
del document.body[j - 1]
|
# and that is not easy to find out. It is much harder to fix that kind
|
||||||
i -= 2
|
# of problem than to remove a paragraph break.
|
||||||
|
# So I am disabling all of this for now, at least. If someone wants to
|
||||||
|
# fix it, then feel free.
|
||||||
|
|
||||||
|
## If the first layout is Standard we need to remove it, otherwise there
|
||||||
|
## will be paragraph breaks that shouldn't be there.
|
||||||
|
#blay = find_token(document.body, "\\begin_layout", i, iend)
|
||||||
|
#if blay == -1:
|
||||||
|
#document.warning("Can't find layout for preview inset!")
|
||||||
|
## always do the later one first...
|
||||||
|
#del document.body[iend]
|
||||||
|
#del document.body[i]
|
||||||
|
## deletions mean we do not need to reset i
|
||||||
|
#continue
|
||||||
|
#lay = document.body[blay].split(None, 1)[1]
|
||||||
|
#if lay != "Standard":
|
||||||
|
#del document.body[iend]
|
||||||
|
#del document.body[i]
|
||||||
|
## deletions mean we do not need to reset i
|
||||||
|
#continue
|
||||||
|
|
||||||
|
## we want to delete the last \\end_layout in this inset, too.
|
||||||
|
## note that this may not be the \\end_layout that goes with blay!!
|
||||||
|
#bend = find_end_of_layout(document.body, blay)
|
||||||
|
##while True:
|
||||||
|
##tmp = find_token(document.body, "\\end_layout", bend + 1, iend)
|
||||||
|
##if tmp == -1:
|
||||||
|
##break
|
||||||
|
##bend = tmp
|
||||||
|
##if bend == blay:
|
||||||
|
#if bend == -1:
|
||||||
|
#document.warning("Unable to find last layout in preview inset!")
|
||||||
|
#del document.body[iend]
|
||||||
|
#del document.body[i]
|
||||||
|
## deletions mean we do not need to reset i
|
||||||
|
#continue
|
||||||
|
## always do the later one first...
|
||||||
|
#del [iend]
|
||||||
|
#del document.body[bend]
|
||||||
|
#del document.body[i:blay + 1]
|
||||||
|
# we do not need to reset i
|
||||||
|
|
||||||
|
|
||||||
def revert_equalspacing_xymatrix(document):
|
def revert_equalspacing_xymatrix(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user