mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Minor cleanup for additional index reversion routines.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36027 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3bb4bbd8b8
commit
b98dcee860
@ -785,6 +785,7 @@ def revert_subindex(document):
|
|||||||
document.warning("Malformed LyX document: Missing \\use_indices.")
|
document.warning("Malformed LyX document: Missing \\use_indices.")
|
||||||
return
|
return
|
||||||
indices = get_value(document.header, "\\use_indices", i)
|
indices = get_value(document.header, "\\use_indices", i)
|
||||||
|
useindices = (indices == "true")
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
|
i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
|
||||||
@ -793,13 +794,13 @@ def revert_subindex(document):
|
|||||||
k = find_end_of_inset(document.body, i)
|
k = find_end_of_inset(document.body, i)
|
||||||
ctype = get_value(document.body, 'LatexCommand', i, k)
|
ctype = get_value(document.body, 'LatexCommand', i, k)
|
||||||
if ctype != "printsubindex":
|
if ctype != "printsubindex":
|
||||||
i = i + 1
|
i = k + 1
|
||||||
continue
|
continue
|
||||||
ptype = get_value(document.body, 'type', i, k).strip('"')
|
ptype = get_value(document.body, 'type', i, k).strip('"')
|
||||||
if indices == "false":
|
if not useindices:
|
||||||
del document.body[i:k + 1]
|
del document.body[i:k + 1]
|
||||||
else:
|
else:
|
||||||
subst = [old_put_cmd_in_ert("\\printsubindex[" + ptype + "]{}")]
|
subst = put_cmd_in_ert("\\printsubindex[" + ptype + "]{}")
|
||||||
document.body[i:k + 1] = subst
|
document.body[i:k + 1] = subst
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
@ -811,6 +812,7 @@ def revert_printindexall(document):
|
|||||||
document.warning("Malformed LyX document: Missing \\use_indices.")
|
document.warning("Malformed LyX document: Missing \\use_indices.")
|
||||||
return
|
return
|
||||||
indices = get_value(document.header, "\\use_indices", i)
|
indices = get_value(document.header, "\\use_indices", i)
|
||||||
|
useindices = (indices == "true")
|
||||||
i = 0
|
i = 0
|
||||||
while True:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
|
i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
|
||||||
@ -819,12 +821,12 @@ def revert_printindexall(document):
|
|||||||
k = find_end_of_inset(document.body, i)
|
k = find_end_of_inset(document.body, i)
|
||||||
ctype = get_value(document.body, 'LatexCommand', i, k)
|
ctype = get_value(document.body, 'LatexCommand', i, k)
|
||||||
if ctype != "printindex*" and ctype != "printsubindex*":
|
if ctype != "printindex*" and ctype != "printsubindex*":
|
||||||
i = i + 1
|
i = k
|
||||||
continue
|
continue
|
||||||
if indices == "false":
|
if not useindices:
|
||||||
del document.body[i:k + 1]
|
del document.body[i:k + 1]
|
||||||
else:
|
else:
|
||||||
subst = [old_put_cmd_in_ert("\\" + ctype + "{}")]
|
subst = put_cmd_in_ert("\\" + ctype + "{}")
|
||||||
document.body[i:k + 1] = subst
|
document.body[i:k + 1] = subst
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user