mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-06 00:10:59 +00:00
Convert "i = i +1" to "i += 1" and similar.
This commit is contained in:
parent
0a6e781aea
commit
3d36751849
@ -96,7 +96,7 @@ def revert_Argument_to_TeX_brace(document, line, endline, n, nmax, environment,
|
|||||||
document.body[endInset - 2 : endInset + 1] = put_cmd_in_ert("}")
|
document.body[endInset - 2 : endInset + 1] = put_cmd_in_ert("}")
|
||||||
document.body[lineArg : beginPlain + 1] = put_cmd_in_ert("{")
|
document.body[lineArg : beginPlain + 1] = put_cmd_in_ert("{")
|
||||||
wasOpt = False
|
wasOpt = False
|
||||||
n = n + 1
|
n += 1
|
||||||
return wasOpt
|
return wasOpt
|
||||||
|
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ def convert_TeX_brace_to_Argument(document, line, n, nmax, inset, environment):
|
|||||||
document.body[line + 4 : line + 4] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
|
document.body[line + 4 : line + 4] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
|
||||||
else:
|
else:
|
||||||
document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
|
document.body[endn : endn] = ["\\begin_inset Argument " + str(n), "status open", "", "\\begin_layout Plain Layout"]
|
||||||
n = n + 1
|
n += 1
|
||||||
endn = end
|
endn = end
|
||||||
loop = loop + 1
|
loop = loop + 1
|
||||||
# now check the case that we have "}" + "{" in two ERTs
|
# now check the case that we have "}" + "{" in two ERTs
|
||||||
@ -333,7 +333,7 @@ def revert_math_spaces(document):
|
|||||||
end = find_end_of_inset(document.body, i)
|
end = find_end_of_inset(document.body, i)
|
||||||
subst = put_cmd_in_ert(document.body[i][21:])
|
subst = put_cmd_in_ert(document.body[i][21:])
|
||||||
document.body[i:end + 1] = subst
|
document.body[i:end + 1] = subst
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_japanese_encodings(document):
|
def convert_japanese_encodings(document):
|
||||||
@ -528,7 +528,7 @@ def revert_use_packages(document):
|
|||||||
del document.header[i]
|
del document.header[i]
|
||||||
j = i
|
j = i
|
||||||
document.header.insert(j, "\\use_%s %s" % (p, value))
|
document.header.insert(j, "\\use_%s %s" % (p, value))
|
||||||
j = j + 1
|
j += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_use_package(document, pkg):
|
def convert_use_package(document, pkg):
|
||||||
@ -963,7 +963,7 @@ def revert_listoflistings(document):
|
|||||||
subst = put_cmd_in_ert("\\lstlistoflistings{}")
|
subst = put_cmd_in_ert("\\lstlistoflistings{}")
|
||||||
document.body[i:j+1] = subst
|
document.body[i:j+1] = subst
|
||||||
add_to_preamble(document, ["\\usepackage{listings}"])
|
add_to_preamble(document, ["\\usepackage{listings}"])
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_use_amssymb(document):
|
def convert_use_amssymb(document):
|
||||||
@ -1232,7 +1232,7 @@ def revert_ipachar(document):
|
|||||||
document.body[i: i+1] = subst
|
document.body[i: i+1] = subst
|
||||||
i = i + len(subst)
|
i = i + len(subst)
|
||||||
else:
|
else:
|
||||||
i = i + 1
|
i += 1
|
||||||
if found:
|
if found:
|
||||||
add_to_preamble(document, "\\usepackage{tone}")
|
add_to_preamble(document, "\\usepackage{tone}")
|
||||||
|
|
||||||
@ -1456,14 +1456,14 @@ def convert_latexargs(document):
|
|||||||
# InsetArgument itself will do the real work
|
# InsetArgument itself will do the real work
|
||||||
# (see InsetArgument::updateBuffer())
|
# (see InsetArgument::updateBuffer())
|
||||||
document.body[i] = "\\begin_inset Argument 999"
|
document.body[i] = "\\begin_inset Argument 999"
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Find containing paragraph layout
|
# Find containing paragraph layout
|
||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -1493,7 +1493,7 @@ def convert_latexargs(document):
|
|||||||
if argnr > allowed_opts and argnr < first_req:
|
if argnr > allowed_opts and argnr < first_req:
|
||||||
argnr = first_req
|
argnr = first_req
|
||||||
document.body[p] = "\\begin_inset Argument %d" % argnr
|
document.body[p] = "\\begin_inset Argument %d" % argnr
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_latexargs(document):
|
def revert_latexargs(document):
|
||||||
@ -1510,13 +1510,13 @@ def revert_latexargs(document):
|
|||||||
m = rx.match(document.body[i])
|
m = rx.match(document.body[i])
|
||||||
if not m:
|
if not m:
|
||||||
# No ID: inset already reverted
|
# No ID: inset already reverted
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
# Find containing paragraph layout
|
# Find containing paragraph layout
|
||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -1570,7 +1570,7 @@ def revert_IEEEtran(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Page headings", i)
|
i = find_token(document.body, "\\begin_layout Page headings", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
revert_Argument_to_TeX_brace(document, i, 0, 1, 1, False, False)
|
revert_Argument_to_TeX_brace(document, i, 0, 1, 1, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if i2 != -1:
|
if i2 != -1:
|
||||||
i2 = find_token(document.body, "\\begin_inset Flex Paragraph Start", i2)
|
i2 = find_token(document.body, "\\begin_inset Flex Paragraph Start", i2)
|
||||||
if i2 != -1:
|
if i2 != -1:
|
||||||
@ -1580,17 +1580,17 @@ def revert_IEEEtran(document):
|
|||||||
j = find_token(document.body, "\\begin_layout Biography without photo", j)
|
j = find_token(document.body, "\\begin_layout Biography without photo", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
revert_Argument_to_TeX_brace(document, j, 0, 1, 1, True, False)
|
revert_Argument_to_TeX_brace(document, j, 0, 1, 1, True, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
k = find_token(document.body, "\\begin_layout Biography", k)
|
k = find_token(document.body, "\\begin_layout Biography", k)
|
||||||
kA = find_token(document.body, "\\begin_layout Biography without photo", k)
|
kA = find_token(document.body, "\\begin_layout Biography without photo", k)
|
||||||
if k == kA and k != -1:
|
if k == kA and k != -1:
|
||||||
k = k + 1
|
k += 1
|
||||||
continue
|
continue
|
||||||
if k != -1:
|
if k != -1:
|
||||||
# start with the second argument, therefore 2
|
# start with the second argument, therefore 2
|
||||||
revert_Argument_to_TeX_brace(document, k, 0, 2, 2, True, False)
|
revert_Argument_to_TeX_brace(document, k, 0, 2, 2, True, False)
|
||||||
k = k + 1
|
k += 1
|
||||||
if i == -1 and i2 == -1 and j == -1 and k == -1:
|
if i == -1 and i2 == -1 and j == -1 and k == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1628,23 +1628,23 @@ def convert_IEEEtran(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Page headings", i)
|
i = find_token(document.body, "\\begin_layout Page headings", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout Biography without photo", j)
|
j = find_token(document.body, "\\begin_layout Biography without photo", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
convert_TeX_brace_to_Argument(document, j, 1, 1, False, True)
|
convert_TeX_brace_to_Argument(document, j, 1, 1, False, True)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
# assure that we don't handle Biography Biography without photo
|
# assure that we don't handle Biography Biography without photo
|
||||||
k = find_token(document.body, "\\begin_layout Biography", k)
|
k = find_token(document.body, "\\begin_layout Biography", k)
|
||||||
kA = find_token(document.body, "\\begin_layout Biography without photo", k - 1)
|
kA = find_token(document.body, "\\begin_layout Biography without photo", k - 1)
|
||||||
if k == kA and k != -1:
|
if k == kA and k != -1:
|
||||||
k = k + 1
|
k += 1
|
||||||
continue
|
continue
|
||||||
if k != -1:
|
if k != -1:
|
||||||
# the argument we want to convert is the second one
|
# the argument we want to convert is the second one
|
||||||
convert_TeX_brace_to_Argument(document, k, 2, 2, False, True)
|
convert_TeX_brace_to_Argument(document, k, 2, 2, False, True)
|
||||||
k = k + 1
|
k += 1
|
||||||
if i == -1 and j == -1 and k == -1:
|
if i == -1 and j == -1 and k == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1731,12 +1731,12 @@ def revert_SIGPLAN(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Conference", i)
|
i = find_token(document.body, "\\begin_layout Conference", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
revert_Argument_to_TeX_brace(document, i, 0, 1, 1, False, False)
|
revert_Argument_to_TeX_brace(document, i, 0, 1, 1, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout Author", j)
|
j = find_token(document.body, "\\begin_layout Author", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
revert_Argument_to_TeX_brace(document, j, 0, 1, 2, False, False)
|
revert_Argument_to_TeX_brace(document, j, 0, 1, 2, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if i == -1 and j == -1:
|
if i == -1 and j == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1751,12 +1751,12 @@ def convert_SIGPLAN(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Conference", i)
|
i = find_token(document.body, "\\begin_layout Conference", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout Author", j)
|
j = find_token(document.body, "\\begin_layout Author", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
convert_TeX_brace_to_Argument(document, j, 1, 2, False, False)
|
convert_TeX_brace_to_Argument(document, j, 1, 2, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if i == -1 and j == -1:
|
if i == -1 and j == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1797,22 +1797,22 @@ def revert_EuropeCV(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Item", i)
|
i = find_token(document.body, "\\begin_layout Item", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
revert_Argument_to_TeX_brace(document, i, 0, 2, 2, False, False)
|
revert_Argument_to_TeX_brace(document, i, 0, 2, 2, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout BulletedItem", j)
|
j = find_token(document.body, "\\begin_layout BulletedItem", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
revert_Argument_to_TeX_brace(document, j, 0, 2, 2, False, False)
|
revert_Argument_to_TeX_brace(document, j, 0, 2, 2, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
k = find_token(document.body, "\\begin_layout Language", k)
|
k = find_token(document.body, "\\begin_layout Language", k)
|
||||||
if k != -1:
|
if k != -1:
|
||||||
revert_Argument_to_TeX_brace(document, k, 0, 2, 6, False, False)
|
revert_Argument_to_TeX_brace(document, k, 0, 2, 6, False, False)
|
||||||
k = k + 1
|
k += 1
|
||||||
if m != -1:
|
if m != -1:
|
||||||
m = find_token(document.body, "\\begin_layout LastLanguage", m)
|
m = find_token(document.body, "\\begin_layout LastLanguage", m)
|
||||||
if m != -1:
|
if m != -1:
|
||||||
revert_Argument_to_TeX_brace(document, m, 0, 2, 6, False, False)
|
revert_Argument_to_TeX_brace(document, m, 0, 2, 6, False, False)
|
||||||
m = m + 1
|
m += 1
|
||||||
if i == -1 and j == -1 and k == -1 and m == -1:
|
if i == -1 and j == -1 and k == -1 and m == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1829,22 +1829,22 @@ def convert_EuropeCV(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Item", i)
|
i = find_token(document.body, "\\begin_layout Item", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
convert_TeX_brace_to_Argument(document, i, 2, 2, False, False)
|
convert_TeX_brace_to_Argument(document, i, 2, 2, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout BulletedItem", j)
|
j = find_token(document.body, "\\begin_layout BulletedItem", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
convert_TeX_brace_to_Argument(document, j, 2, 2, False, False)
|
convert_TeX_brace_to_Argument(document, j, 2, 2, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
k = find_token(document.body, "\\begin_layout Language", k)
|
k = find_token(document.body, "\\begin_layout Language", k)
|
||||||
if k != -1:
|
if k != -1:
|
||||||
convert_TeX_brace_to_Argument(document, k, 2, 6, False, False)
|
convert_TeX_brace_to_Argument(document, k, 2, 6, False, False)
|
||||||
k = k + 1
|
k += 1
|
||||||
if m != -1:
|
if m != -1:
|
||||||
m = find_token(document.body, "\\begin_layout LastLanguage", m)
|
m = find_token(document.body, "\\begin_layout LastLanguage", m)
|
||||||
if m != -1:
|
if m != -1:
|
||||||
convert_TeX_brace_to_Argument(document, m, 2, 6, False, False)
|
convert_TeX_brace_to_Argument(document, m, 2, 6, False, False)
|
||||||
m = m + 1
|
m += 1
|
||||||
if i == -1 and j == -1 and k == -1 and m == -1:
|
if i == -1 and j == -1 and k == -1 and m == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1862,18 +1862,18 @@ def revert_ModernCV(document):
|
|||||||
j = find_token(document.body, "\\begin_layout Entry", j)
|
j = find_token(document.body, "\\begin_layout Entry", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
revert_Argument_to_TeX_brace(document, j, 0, 1, 5, False, False)
|
revert_Argument_to_TeX_brace(document, j, 0, 1, 5, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
k = find_token(document.body, "\\begin_layout Item", k)
|
k = find_token(document.body, "\\begin_layout Item", k)
|
||||||
if k != -1:
|
if k != -1:
|
||||||
revert_Argument_to_TeX_brace(document, k, 0, 1, 1, False, False)
|
revert_Argument_to_TeX_brace(document, k, 0, 1, 1, False, False)
|
||||||
k = k + 1
|
k += 1
|
||||||
if m != -1:
|
if m != -1:
|
||||||
m = find_token(document.body, "\\begin_layout ItemWithComment", m)
|
m = find_token(document.body, "\\begin_layout ItemWithComment", m)
|
||||||
if m != -1:
|
if m != -1:
|
||||||
revert_Argument_to_TeX_brace(document, m, 0, 1, 2, False, False)
|
revert_Argument_to_TeX_brace(document, m, 0, 1, 2, False, False)
|
||||||
document.body[m] = document.body[m].replace("\\begin_layout ItemWithComment", "\\begin_layout Language")
|
document.body[m] = document.body[m].replace("\\begin_layout ItemWithComment", "\\begin_layout Language")
|
||||||
m = m + 1
|
m += 1
|
||||||
if o != -1:
|
if o != -1:
|
||||||
o = find_token(document.body, "\\begin_layout DoubleItem", o)
|
o = find_token(document.body, "\\begin_layout DoubleItem", o)
|
||||||
if o != -1:
|
if o != -1:
|
||||||
@ -1967,22 +1967,22 @@ def convert_ModernCV(document):
|
|||||||
if i != -1:
|
if i != -1:
|
||||||
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
convert_TeX_brace_to_Argument(document, i, 1, 1, False, False)
|
||||||
document.body[o] = document.body[o].replace("\\begin_layout DoubleItem", "\\begin_layout DoubleListItem")
|
document.body[o] = document.body[o].replace("\\begin_layout DoubleItem", "\\begin_layout DoubleListItem")
|
||||||
i = i + 1
|
i += 1
|
||||||
if j != -1:
|
if j != -1:
|
||||||
j = find_token(document.body, "\\begin_layout Entry", j)
|
j = find_token(document.body, "\\begin_layout Entry", j)
|
||||||
if j != -1:
|
if j != -1:
|
||||||
convert_TeX_brace_to_Argument(document, j, 1, 5, False, False)
|
convert_TeX_brace_to_Argument(document, j, 1, 5, False, False)
|
||||||
j = j + 1
|
j += 1
|
||||||
if k != -1:
|
if k != -1:
|
||||||
k = find_token(document.body, "\\begin_layout Item", k)
|
k = find_token(document.body, "\\begin_layout Item", k)
|
||||||
if k != -1:
|
if k != -1:
|
||||||
convert_TeX_brace_to_Argument(document, k, 1, 1, False, False)
|
convert_TeX_brace_to_Argument(document, k, 1, 1, False, False)
|
||||||
k = k + 1
|
k += 1
|
||||||
if m != -1:
|
if m != -1:
|
||||||
m = find_token(document.body, "\\begin_layout Language", m)
|
m = find_token(document.body, "\\begin_layout Language", m)
|
||||||
if m != -1:
|
if m != -1:
|
||||||
convert_TeX_brace_to_Argument(document, m, 1, 2, False, False)
|
convert_TeX_brace_to_Argument(document, m, 1, 2, False, False)
|
||||||
m = m + 1
|
m += 1
|
||||||
if i == -1 and j == -1 and k == -1 and m == -1:
|
if i == -1 and j == -1 and k == -1 and m == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1996,7 +1996,7 @@ def revert_Initials(document):
|
|||||||
return
|
return
|
||||||
# first arg (optional) and second arg (first mandatory) are supported in LyX 2.0.x
|
# first arg (optional) and second arg (first mandatory) are supported in LyX 2.0.x
|
||||||
revert_Argument_to_TeX_brace(document, i, 0, 3, 3, False, False)
|
revert_Argument_to_TeX_brace(document, i, 0, 3, 3, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_Initials(document):
|
def convert_Initials(document):
|
||||||
@ -2007,7 +2007,7 @@ def convert_Initials(document):
|
|||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
convert_TeX_brace_to_Argument(document, i, 3, 3, False, False)
|
convert_TeX_brace_to_Argument(document, i, 3, 3, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_literate(document):
|
def revert_literate(document):
|
||||||
@ -2020,7 +2020,7 @@ def revert_literate(document):
|
|||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
document.body[i] = "\\begin_layout Scrap"
|
document.body[i] = "\\begin_layout Scrap"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_literate(document):
|
def convert_literate(document):
|
||||||
@ -2041,7 +2041,7 @@ def convert_literate(document):
|
|||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
document.body[i] = "\\begin_layout Chunk"
|
document.body[i] = "\\begin_layout Chunk"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_itemargs(document):
|
def revert_itemargs(document):
|
||||||
@ -2056,7 +2056,7 @@ def revert_itemargs(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[3]
|
parbeg = parent[3]
|
||||||
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i)
|
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", i)
|
||||||
@ -2065,7 +2065,7 @@ def revert_itemargs(document):
|
|||||||
del document.body[i:j+1]
|
del document.body[i:j+1]
|
||||||
subst = put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
|
subst = put_cmd_in_ert("[") + content + put_cmd_in_ert("]")
|
||||||
document.body[parbeg : parbeg] = subst
|
document.body[parbeg : parbeg] = subst
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_garamondx_newtxmath(document):
|
def revert_garamondx_newtxmath(document):
|
||||||
@ -2119,7 +2119,7 @@ def convert_beamerargs(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -2160,7 +2160,7 @@ def convert_beamerargs(document):
|
|||||||
elif layoutname != "Itemize":
|
elif layoutname != "Itemize":
|
||||||
# Shift this one
|
# Shift this one
|
||||||
document.body[p] = "\\begin_inset Argument 2"
|
document.body[p] = "\\begin_inset Argument 2"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_againframe_args(document):
|
def convert_againframe_args(document):
|
||||||
@ -2376,7 +2376,7 @@ def revert_beamerargs(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -2556,7 +2556,7 @@ def revert_beamerargs2(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -2638,7 +2638,7 @@ def revert_beamerargs3(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -2792,7 +2792,7 @@ def revert_beamerblocks(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -2923,7 +2923,7 @@ def convert_overprint(document):
|
|||||||
j = find_end_of_sequence(document.body, i)
|
j = find_end_of_sequence(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of Overprint sequence!")
|
document.warning("Malformed LyX document. Cannot find end of Overprint sequence!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endseq = j
|
endseq = j
|
||||||
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{overprint}")
|
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{overprint}")
|
||||||
@ -2939,7 +2939,7 @@ def convert_overprint(document):
|
|||||||
argend = find_end_of_layout(document.body, argbeg)
|
argend = find_end_of_layout(document.body, argbeg)
|
||||||
if argend == -1:
|
if argend == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of Overprint argument!")
|
document.warning("Malformed LyX document. Cannot find end of Overprint argument!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", argbeg)
|
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", argbeg)
|
||||||
endPlain = find_end_of_layout(document.body, beginPlain)
|
endPlain = find_end_of_layout(document.body, beginPlain)
|
||||||
@ -2977,7 +2977,7 @@ def revert_overprint(document):
|
|||||||
j = find_end_of_sequence(document.body, i)
|
j = find_end_of_sequence(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of Overprint sequence!")
|
document.warning("Malformed LyX document. Cannot find end of Overprint sequence!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endseq = j
|
endseq = j
|
||||||
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{overprint}")
|
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{overprint}")
|
||||||
@ -3002,7 +3002,7 @@ def revert_overprint(document):
|
|||||||
argend = find_end_of_inset(document.body, argbeg)
|
argend = find_end_of_inset(document.body, argbeg)
|
||||||
if argend == -1:
|
if argend == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of Overprint argument!")
|
document.warning("Malformed LyX document. Cannot find end of Overprint argument!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", argbeg)
|
beginPlain = find_token(document.body, "\\begin_layout Plain Layout", argbeg)
|
||||||
endPlain = find_end_of_layout(document.body, beginPlain)
|
endPlain = find_end_of_layout(document.body, beginPlain)
|
||||||
@ -3066,7 +3066,7 @@ def revert_frametitle(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Can't find end of FrameTitle layout")
|
document.warning("Malformed LyX document: Can't find end of FrameTitle layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endlay = j
|
endlay = j
|
||||||
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
|
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
|
||||||
@ -3118,7 +3118,7 @@ def convert_epigraph(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Can't find end of Epigraph layout")
|
document.warning("Malformed LyX document: Can't find end of Epigraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endlay = j
|
endlay = j
|
||||||
subst = list()
|
subst = list()
|
||||||
@ -3159,7 +3159,7 @@ def revert_epigraph(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Can't find end of Epigraph layout")
|
document.warning("Malformed LyX document: Can't find end of Epigraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endlay = j
|
endlay = j
|
||||||
subst = list()
|
subst = list()
|
||||||
@ -3190,7 +3190,7 @@ def convert_captioninsets(document):
|
|||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
document.body[i] = "\\begin_inset Caption Standard"
|
document.body[i] = "\\begin_inset Caption Standard"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_captioninsets(document):
|
def revert_captioninsets(document):
|
||||||
@ -3202,7 +3202,7 @@ def revert_captioninsets(document):
|
|||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
document.body[i] = "\\begin_inset Caption"
|
document.body[i] = "\\begin_inset Caption"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def convert_captionlayouts(document):
|
def convert_captionlayouts(document):
|
||||||
@ -3233,7 +3233,7 @@ def convert_captionlayouts(document):
|
|||||||
document.body[i:i+1] = ["\\begin_layout %s" % document.default_layout,
|
document.body[i:i+1] = ["\\begin_layout %s" % document.default_layout,
|
||||||
"\\begin_inset Caption %s" % caption_dict[val], "",
|
"\\begin_inset Caption %s" % caption_dict[val], "",
|
||||||
"\\begin_layout %s" % document.default_layout]
|
"\\begin_layout %s" % document.default_layout]
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_captionlayouts(document):
|
def revert_captionlayouts(document):
|
||||||
@ -3260,7 +3260,7 @@ def revert_captionlayouts(document):
|
|||||||
if m:
|
if m:
|
||||||
val = m.group(1)
|
val = m.group(1)
|
||||||
if val not in caption_dict.keys():
|
if val not in caption_dict.keys():
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# We either need to delete the previous \begin_layout line, or we
|
# We either need to delete the previous \begin_layout line, or we
|
||||||
@ -3325,7 +3325,7 @@ def revert_captionlayouts(document):
|
|||||||
document.body[i] = "\\begin_layout %s" % caption_dict[val]
|
document.body[i] = "\\begin_layout %s" % caption_dict[val]
|
||||||
if document.body[i+1] == "":
|
if document.body[i+1] == "":
|
||||||
del document.body[i+1]
|
del document.body[i+1]
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_fragileframe(document):
|
def revert_fragileframe(document):
|
||||||
@ -3344,7 +3344,7 @@ def revert_fragileframe(document):
|
|||||||
j = find_end_of_sequence(document.body, i)
|
j = find_end_of_sequence(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of FragileFrame sequence!")
|
document.warning("Malformed LyX document. Cannot find end of FragileFrame sequence!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endseq = j
|
endseq = j
|
||||||
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{frame}")
|
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\begin{frame}")
|
||||||
@ -3441,13 +3441,13 @@ def revert_newframes(document):
|
|||||||
if m:
|
if m:
|
||||||
val = m.group(1)
|
val = m.group(1)
|
||||||
if val not in frame_dict.keys():
|
if val not in frame_dict.keys():
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
# Find end of sequence
|
# Find end of sequence
|
||||||
j = find_end_of_sequence(document.body, i)
|
j = find_end_of_sequence(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document. Cannot find end of Frame sequence!")
|
document.warning("Malformed LyX document. Cannot find end of Frame sequence!")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endseq = j
|
endseq = j
|
||||||
subst = ["\\begin_layout %s" % frame_dict[val]]
|
subst = ["\\begin_layout %s" % frame_dict[val]]
|
||||||
@ -3877,7 +3877,7 @@ def remove_endframes(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Missing \\end_layout to EndFrame")
|
document.warning("Malformed LyX document: Missing \\end_layout to EndFrame")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
del document.body[i : j + 1]
|
del document.body[i : j + 1]
|
||||||
|
|
||||||
@ -3950,7 +3950,7 @@ def revert_powerdot_pause(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Can't find end of Pause layout")
|
document.warning("Malformed LyX document: Can't find end of Pause layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endlay = j
|
endlay = j
|
||||||
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\pause")
|
subst = ["\\begin_layout Standard"] + put_cmd_in_ert("\\pause")
|
||||||
@ -3991,7 +3991,7 @@ def revert_powerdot_itemargs(document):
|
|||||||
parent = get_containing_layout(document.body, i)
|
parent = get_containing_layout(document.body, i)
|
||||||
if parent == False:
|
if parent == False:
|
||||||
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
document.warning("Malformed LyX document: Can't find parent paragraph layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
parbeg = parent[1]
|
parbeg = parent[1]
|
||||||
parend = parent[2]
|
parend = parent[2]
|
||||||
@ -4042,7 +4042,7 @@ def revert_powerdot_columns(document):
|
|||||||
j = find_end_of_layout(document.body, i)
|
j = find_end_of_layout(document.body, i)
|
||||||
if j == -1:
|
if j == -1:
|
||||||
document.warning("Malformed LyX document: Can't find end of Twocolumn layout")
|
document.warning("Malformed LyX document: Can't find end of Twocolumn layout")
|
||||||
i = i + 1
|
i += 1
|
||||||
continue
|
continue
|
||||||
endlay = j
|
endlay = j
|
||||||
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
|
document.body[j : j] = put_cmd_in_ert("}") + document.body[j : j]
|
||||||
@ -4106,7 +4106,7 @@ def revert_mbox_fbox(document):
|
|||||||
document.body[i:BeginLayout + 1] = put_cmd_in_ert("\\mbox{")
|
document.body[i:BeginLayout + 1] = put_cmd_in_ert("\\mbox{")
|
||||||
if document.body[i] == "\\begin_inset Box Boxed":
|
if document.body[i] == "\\begin_inset Box Boxed":
|
||||||
document.body[i:BeginLayout + 1] = put_cmd_in_ert("\\fbox{")
|
document.body[i:BeginLayout + 1] = put_cmd_in_ert("\\fbox{")
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_starred_caption(document):
|
def revert_starred_caption(document):
|
||||||
@ -4120,7 +4120,7 @@ def revert_starred_caption(document):
|
|||||||
# This is not equivalent, but since the caption inset is a full blown
|
# This is not equivalent, but since the caption inset is a full blown
|
||||||
# text inset a true conversion to ERT is too difficult.
|
# text inset a true conversion to ERT is too difficult.
|
||||||
document.body[i] = "\\begin_inset Caption Standard"
|
document.body[i] = "\\begin_inset Caption Standard"
|
||||||
i = i + 1
|
i += 1
|
||||||
|
|
||||||
|
|
||||||
def revert_forced_local_layout(document):
|
def revert_forced_local_layout(document):
|
||||||
@ -4166,7 +4166,7 @@ def revert_aa1(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Abstract (structured)", i)
|
i = find_token(document.body, "\\begin_layout Abstract (structured)", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
revert_Argument_to_TeX_brace(document, i, 0, 1, 4, False, False)
|
revert_Argument_to_TeX_brace(document, i, 0, 1, 4, False, False)
|
||||||
i = i + 1
|
i += 1
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -4180,7 +4180,7 @@ def revert_aa2(document):
|
|||||||
i = find_token(document.body, "\\begin_layout Abstract (structured)", i)
|
i = find_token(document.body, "\\begin_layout Abstract (structured)", i)
|
||||||
if i != -1:
|
if i != -1:
|
||||||
document.body[i] = "\\begin_layout Abstract"
|
document.body[i] = "\\begin_layout Abstract"
|
||||||
i = i + 1
|
i += 1
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user