mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 20:45:47 +00:00
Add some comments
This commit is contained in:
parent
874f559bc7
commit
5a7c6aaeee
@ -4445,7 +4445,7 @@ def revert_index_macros(document):
|
|||||||
if pl == -1:
|
if pl == -1:
|
||||||
document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i)
|
document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i)
|
||||||
continue
|
continue
|
||||||
# find, store and remove params
|
# find, store and remove inset params
|
||||||
pr = find_token(document.body, 'range', i, pl)
|
pr = find_token(document.body, 'range', i, pl)
|
||||||
prval = get_quoted_value(document.body, "range", pr)
|
prval = get_quoted_value(document.body, "range", pr)
|
||||||
pagerange = ""
|
pagerange = ""
|
||||||
@ -4456,16 +4456,20 @@ def revert_index_macros(document):
|
|||||||
pf = find_token(document.body, 'pageformat', i, pl)
|
pf = find_token(document.body, 'pageformat', i, pl)
|
||||||
pageformat = get_quoted_value(document.body, "pageformat", pf)
|
pageformat = get_quoted_value(document.body, "pageformat", pf)
|
||||||
del document.body[pr:pf+1]
|
del document.body[pr:pf+1]
|
||||||
|
# Now re-find (potentially moved) inset end again, and search for subinsets
|
||||||
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: Can't find end of index inset at line %d" % i)
|
document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i)
|
||||||
continue
|
continue
|
||||||
imacros = ["seealso", "see", "subindex", "subindex", "sortkey"]
|
# We search for all possible subindexes in turn, store their
|
||||||
|
# content and delete them
|
||||||
see = []
|
see = []
|
||||||
seealso = []
|
seealso = []
|
||||||
subindex = []
|
subindex = []
|
||||||
subindex2 = []
|
subindex2 = []
|
||||||
sortkey = []
|
sortkey = []
|
||||||
|
# Two subindexes are allowed, thus the duplication
|
||||||
|
imacros = ["seealso", "see", "subindex", "subindex", "sortkey"]
|
||||||
for imacro in imacros:
|
for imacro in imacros:
|
||||||
iim = find_token(document.body, "\\begin_inset IndexMacro %s" % imacro, i, j)
|
iim = find_token(document.body, "\\begin_inset IndexMacro %s" % imacro, i, j)
|
||||||
if iim == -1:
|
if iim == -1:
|
||||||
@ -4483,10 +4487,10 @@ def revert_index_macros(document):
|
|||||||
document.warning("Malformed LyX document: Can't find end of index macro inset plain layout at line %d" % i)
|
document.warning("Malformed LyX document: Can't find end of index macro inset plain layout at line %d" % i)
|
||||||
continue
|
continue
|
||||||
icont = document.body[iimpl:iimple]
|
icont = document.body[iimpl:iimple]
|
||||||
if imacro == "see":
|
if imacro == "seealso":
|
||||||
see = icont[1:]
|
|
||||||
elif imacro == "seealso":
|
|
||||||
seealso = icont[1:]
|
seealso = icont[1:]
|
||||||
|
elif imacro == "see":
|
||||||
|
see = icont[1:]
|
||||||
elif imacro == "subindex":
|
elif imacro == "subindex":
|
||||||
# subindexes might hace their own sortkey!
|
# subindexes might hace their own sortkey!
|
||||||
xiim = find_token(document.body, "\\begin_inset IndexMacro sortkey", iimpl, iimple)
|
xiim = find_token(document.body, "\\begin_inset IndexMacro sortkey", iimpl, iimple)
|
||||||
@ -4512,11 +4516,14 @@ def revert_index_macros(document):
|
|||||||
subindex = icont[1:]
|
subindex = icont[1:]
|
||||||
elif imacro == "sortkey":
|
elif imacro == "sortkey":
|
||||||
sortkey = icont
|
sortkey = icont
|
||||||
|
# Everything stored. Delete subinset.
|
||||||
del document.body[iim:iime+1]
|
del document.body[iim:iime+1]
|
||||||
|
# Again re-find (potentially moved) index inset end
|
||||||
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: Can't find end of index inset at line %d" % i)
|
document.warning("Malformed LyX document: Can't find end of index inset at line %d" % i)
|
||||||
continue
|
continue
|
||||||
|
# Now insert all stuff, starting from the inset end
|
||||||
pl = find_token(document.body, '\\begin_layout Plain Layout', i, j)
|
pl = find_token(document.body, '\\begin_layout Plain Layout', i, j)
|
||||||
if pl == -1:
|
if pl == -1:
|
||||||
document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i)
|
document.warning("Malformed LyX document: Can't find plain layout in index inset at line %d" % i)
|
||||||
|
Loading…
Reference in New Issue
Block a user