mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Polish the index conversion routine a bit, fixing bug 5119.
We had been assuming too much about the format. Reference.lyx violated it, maybe because it is so old. But anyway, this is a bit more reliable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26068 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2b17fbfee7
commit
e5a783d853
@ -1039,26 +1039,24 @@ def convert_latexcommand_index(document):
|
|||||||
return
|
return
|
||||||
if document.body[i + 1] != "LatexCommand index": # Might also be index_print
|
if document.body[i + 1] != "LatexCommand index": # Might also be index_print
|
||||||
return
|
return
|
||||||
|
j = find_end_of_inset(document.body, i + 2)
|
||||||
|
if j == -1:
|
||||||
|
document.warning("Unable to find end of index inset at line " + i + "!")
|
||||||
|
i += 2
|
||||||
|
continue
|
||||||
m = r1.match(document.body[i + 2])
|
m = r1.match(document.body[i + 2])
|
||||||
if m == None:
|
if m == None:
|
||||||
document.warning("Unable to match: " + document.body[i+2])
|
document.warning("Unable to match: " + document.body[i+2])
|
||||||
i += 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
fullcontent = m.group(1)
|
fullcontent = m.group(1)
|
||||||
#document.warning(fullcontent)
|
|
||||||
document.body[i:i + 3] = ["\\begin_inset Index",
|
|
||||||
"status collapsed",
|
|
||||||
"\\begin_layout Standard"]
|
|
||||||
i += 3
|
|
||||||
# We are now on the blank line preceding "\end_inset"
|
|
||||||
# We will write the content here, into the inset.
|
|
||||||
|
|
||||||
linelist = latex2lyx(fullcontent)
|
linelist = latex2lyx(fullcontent)
|
||||||
document.body[i+1:i+1] = linelist
|
#document.warning(fullcontent)
|
||||||
i += len(linelist)
|
|
||||||
|
|
||||||
document.body.insert(i + 1, "\\end_layout")
|
linelist = ["\\begin_inset Index", "status collapsed", "\\begin_layout Standard", ""] + \
|
||||||
i += 1
|
linelist + ["\\end_layout"]
|
||||||
|
document.body[i : j] = linelist
|
||||||
|
i += len(linelist) - (j - i)
|
||||||
|
|
||||||
|
|
||||||
def revert_latexcommand_index(document):
|
def revert_latexcommand_index(document):
|
||||||
|
Loading…
Reference in New Issue
Block a user