mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
In lib/lyx2lyx/: s/while 1/while True/
This commit is contained in:
parent
3420910d7b
commit
1db883e183
@ -401,7 +401,7 @@ class LyX_base:
|
|||||||
self.body[i] = self.body[i].decode(self.encoding)
|
self.body[i] = self.body[i].decode(self.encoding)
|
||||||
|
|
||||||
# Read document body
|
# Read document body
|
||||||
while 1:
|
while True:
|
||||||
line = self.input.readline().decode(self.encoding)
|
line = self.input.readline().decode(self.encoding)
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
@ -767,7 +767,7 @@ class LyX_base:
|
|||||||
|
|
||||||
# toc_par = []
|
# toc_par = []
|
||||||
# i = 0
|
# i = 0
|
||||||
# while 1:
|
# while True:
|
||||||
# i = find_tokens(self.body, sections, i)
|
# i = find_tokens(self.body, sections, i)
|
||||||
# if i == -1:
|
# if i == -1:
|
||||||
# break
|
# break
|
||||||
|
@ -26,7 +26,7 @@ def space_before_layout(document):
|
|||||||
" Remove empty line before \\layout. "
|
" Remove empty line before \\layout. "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 2 # skip first layout
|
i = 2 # skip first layout
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\layout', i)
|
i = find_token(lines, '\\layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -41,7 +41,7 @@ def formula_inset_space_eat(document):
|
|||||||
" Remove space after inset formula."
|
" Remove space after inset formula."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Formula", i)
|
i = find_token(lines, "\\begin_inset Formula", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -56,7 +56,7 @@ def update_tabular(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
lyxtable_re = re.compile(r".*\\LyXTable$")
|
lyxtable_re = re.compile(r".*\\LyXTable$")
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, lyxtable_re, i)
|
i = find_re(lines, lyxtable_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -108,7 +108,7 @@ def update_inset_label(document):
|
|||||||
" Update inset Label."
|
" Update inset Label."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\begin_inset Label', i)
|
i = find_token(lines, '\\begin_inset Label', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -120,7 +120,7 @@ def update_latexdel(document):
|
|||||||
" Update inset LatexDel."
|
" Update inset LatexDel."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\begin_inset LatexDel', i)
|
i = find_token(lines, '\\begin_inset LatexDel', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -163,7 +163,7 @@ def remove_cursor(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
cursor_re = re.compile(r'.*(\\cursor \d*)')
|
cursor_re = re.compile(r'.*(\\cursor \d*)')
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, cursor_re, i)
|
i = find_re(lines, cursor_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -176,7 +176,7 @@ def remove_empty_insets(document):
|
|||||||
" Remove empty insets."
|
" Remove empty insets."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\begin_inset ', i)
|
i = find_token(lines, '\\begin_inset ', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -190,7 +190,7 @@ def remove_formula_latex(document):
|
|||||||
" Remove formula latex."
|
" Remove formula latex."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\latex formula_latex ', i)
|
i = find_token(lines, '\\latex formula_latex ', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -268,7 +268,7 @@ def update_latexaccents(document):
|
|||||||
" Update latex accent insets."
|
" Update latex accent insets."
|
||||||
body = document.body
|
body = document.body
|
||||||
i = 1
|
i = 1
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(body, '\\i ', i)
|
i = find_token(body, '\\i ', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -297,7 +297,7 @@ def obsolete_latex_title(document):
|
|||||||
" Replace layout Latex_Title with Title."
|
" Replace layout Latex_Title with Title."
|
||||||
body = document.body
|
body = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(body, '\\layout', i)
|
i = find_token(body, '\\layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -313,7 +313,7 @@ def remove_inset_latex(document):
|
|||||||
body = document.body
|
body = document.body
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(body, '\\begin_inset Latex', i)
|
i = find_token(body, '\\begin_inset Latex', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -26,7 +26,7 @@ def obsolete_latex_title(document):
|
|||||||
|
|
||||||
body = document.body
|
body = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(body, '\\layout', i)
|
i = find_token(body, '\\layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -43,7 +43,7 @@ def update_tabular(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
lyxtable_re = re.compile(r".*\\LyXTable$")
|
lyxtable_re = re.compile(r".*\\LyXTable$")
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, lyxtable_re, i)
|
i = find_re(lines, lyxtable_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -40,7 +40,7 @@ def replace_protected_separator(document):
|
|||||||
" Replace protected separator. "
|
" Replace protected separator. "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\protected_separator", i)
|
i = find_token(lines, "\\protected_separator", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -65,7 +65,7 @@ def merge_formula_inset(document):
|
|||||||
" Merge formula insets. "
|
" Merge formula insets. "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Formula", i)
|
i = find_token(lines, "\\begin_inset Formula", i)
|
||||||
if i == -1: break
|
if i == -1: break
|
||||||
if lines[i+1] in math_env:
|
if lines[i+1] in math_env:
|
||||||
@ -79,7 +79,7 @@ def update_tabular(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
lyxtable_re = re.compile(r".*\\LyXTable$")
|
lyxtable_re = re.compile(r".*\\LyXTable$")
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, lyxtable_re, i)
|
i = find_re(lines, lyxtable_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -111,7 +111,7 @@ def update_toc(document):
|
|||||||
" Update table of contents. "
|
" Update table of contents. "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines,
|
i = find_token(lines,
|
||||||
'\\begin_inset LatexCommand \\tableofcontents', i)
|
'\\begin_inset LatexCommand \\tableofcontents', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -158,7 +158,7 @@ def remove_space_in_units(document):
|
|||||||
|
|
||||||
for margin in margins:
|
for margin in margins:
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, margin, i)
|
i = find_token(lines, margin, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -174,7 +174,7 @@ def latexdel_getargs(document, i):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
|
|
||||||
# play safe, clean empty lines
|
# play safe, clean empty lines
|
||||||
while 1:
|
while True:
|
||||||
if lines[i]:
|
if lines[i]:
|
||||||
break
|
break
|
||||||
del lines[i]
|
del lines[i]
|
||||||
@ -191,7 +191,7 @@ def latexdel_getargs(document, i):
|
|||||||
del lines[i:j + 1]
|
del lines[i:j + 1]
|
||||||
|
|
||||||
# play safe, clean empty lines
|
# play safe, clean empty lines
|
||||||
while 1:
|
while True:
|
||||||
if lines[i]:
|
if lines[i]:
|
||||||
break
|
break
|
||||||
del lines[i]
|
del lines[i]
|
||||||
@ -212,7 +212,7 @@ def update_ref(document):
|
|||||||
" Update reference inset. "
|
" Update reference inset. "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, '\\begin_inset LatexCommand', i)
|
i = find_token(lines, '\\begin_inset LatexCommand', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -230,7 +230,7 @@ def update_latexdel(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
latexdel_re = re.compile(r".*\\begin_inset LatexDel")
|
latexdel_re = re.compile(r".*\\begin_inset LatexDel")
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, latexdel_re, i)
|
i = find_re(lines, latexdel_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -26,7 +26,7 @@ def update_tabular(document):
|
|||||||
" Update tabular to version 1 (xml like syntax). "
|
" Update tabular to version 1 (xml like syntax). "
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, lyxtable_re, i)
|
i = find_re(lines, lyxtable_re, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -39,7 +39,7 @@ def update_tabular(document):
|
|||||||
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i=0
|
i=0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, regexp, i)
|
i = find_re(lines, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -146,7 +146,7 @@ def remove_oldfloat(document):
|
|||||||
" Change \begin_float .. \end_float into \begin_inset Float .. \end_inset"
|
" Change \begin_float .. \end_float into \begin_inset Float .. \end_inset"
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_float", i)
|
i = find_token(lines, "\\begin_float", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -215,7 +215,7 @@ def remove_pextra(document):
|
|||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
flag = 0
|
flag = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, pextra_type2_rexp, i)
|
i = find_re(lines, pextra_type2_rexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -258,7 +258,7 @@ def remove_pextra(document):
|
|||||||
j = get_next_paragraph(lines, i, document.format + 1)
|
j = get_next_paragraph(lines, i, document.format + 1)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
while 1:
|
while True:
|
||||||
# collect more paragraphs to the minipage
|
# collect more paragraphs to the minipage
|
||||||
count = count+1
|
count = count+1
|
||||||
if j == -1 or not check_token(lines[j], "\\layout"):
|
if j == -1 or not check_token(lines[j], "\\layout"):
|
||||||
@ -301,12 +301,12 @@ def remove_oldert(document):
|
|||||||
""]
|
""]
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(lines, ["\\latex latex", "\\layout LaTeX"], i)
|
i = find_tokens(lines, ["\\latex latex", "\\layout LaTeX"], i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
j = i+1
|
j = i+1
|
||||||
while 1:
|
while True:
|
||||||
# \end_inset is for ert inside a tabular cell. The other tokens
|
# \end_inset is for ert inside a tabular cell. The other tokens
|
||||||
# are obvious.
|
# are obvious.
|
||||||
j = find_tokens(lines, ["\\latex default", "\\layout", "\\begin_inset", "\\end_inset", "\\end_float", "\\the_end"],
|
j = find_tokens(lines, ["\\latex default", "\\layout", "\\begin_inset", "\\end_inset", "\\end_float", "\\the_end"],
|
||||||
@ -327,7 +327,7 @@ def remove_oldert(document):
|
|||||||
new = ['\layout %s' % document.default_layout, "", ""]
|
new = ['\layout %s' % document.default_layout, "", ""]
|
||||||
|
|
||||||
k = i+1
|
k = i+1
|
||||||
while 1:
|
while True:
|
||||||
k2 = find_re(lines, ert_rexp, k, j)
|
k2 = find_re(lines, ert_rexp, k, j)
|
||||||
inset = hfill = specialchar = 0
|
inset = hfill = specialchar = 0
|
||||||
if k2 == -1:
|
if k2 == -1:
|
||||||
@ -399,7 +399,7 @@ def remove_oldert(document):
|
|||||||
|
|
||||||
# Delete remaining "\latex xxx" tokens
|
# Delete remaining "\latex xxx" tokens
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\latex ", i)
|
i = find_token(lines, "\\latex ", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -410,7 +410,7 @@ def remove_oldertinset(document):
|
|||||||
" ERT insert are hidden feature of lyx 1.1.6. This might be removed in the future."
|
" ERT insert are hidden feature of lyx 1.1.6. This might be removed in the future."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset ERT", i)
|
i = find_token(lines, "\\begin_inset ERT", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -445,7 +445,7 @@ def combine_ert(document):
|
|||||||
" Combine ERT paragraphs."
|
" Combine ERT paragraphs."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset ERT", i)
|
i = find_token(lines, "\\begin_inset ERT", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -490,7 +490,7 @@ def remove_figinset(document):
|
|||||||
" Remove figinset."
|
" Remove figinset."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Figure", i)
|
i = find_token(lines, "\\begin_inset Figure", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -564,7 +564,7 @@ def update_tabular(document):
|
|||||||
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(lines, regexp, i)
|
i = find_re(lines, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -697,7 +697,7 @@ def update_longtables(document):
|
|||||||
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
||||||
body = document.body
|
body = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(body, regexp, i)
|
i = find_re(body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -766,7 +766,7 @@ def fix_oldfloatinset(document):
|
|||||||
" Figure insert are hidden feature of lyx 1.1.6. This might be removed in the future."
|
" Figure insert are hidden feature of lyx 1.1.6. This might be removed in the future."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Float ", i)
|
i = find_token(lines, "\\begin_inset Float ", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -780,7 +780,7 @@ def change_listof(document):
|
|||||||
" Change listof insets."
|
" Change listof insets."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset LatexCommand \\listof", i)
|
i = find_token(lines, "\\begin_inset LatexCommand \\listof", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -793,7 +793,7 @@ def change_infoinset(document):
|
|||||||
" Change info inset."
|
" Change info inset."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Info", i)
|
i = find_token(lines, "\\begin_inset Info", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -54,7 +54,7 @@ def change_insetgraphics(document):
|
|||||||
" Change inset Graphics."
|
" Change inset Graphics."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "\\begin_inset Graphics", i)
|
i = find_token(lines, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -113,7 +113,7 @@ def change_tabular(document):
|
|||||||
" Change tabular."
|
" Change tabular."
|
||||||
lines = document.body
|
lines = document.body
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(lines, "<column", i)
|
i = find_token(lines, "<column", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -105,7 +105,7 @@ def del_token(lines, token, start, end):
|
|||||||
def remove_color_default(document):
|
def remove_color_default(document):
|
||||||
" Remove \color default"
|
" Remove \color default"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\color default", i)
|
i = find_token(document.body, "\\color default", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -179,7 +179,7 @@ def revert_spaces(document):
|
|||||||
" \InsetSpace ~ -> \SpecialChar ~"
|
" \InsetSpace ~ -> \SpecialChar ~"
|
||||||
regexp = re.compile(r'(.*)(\\InsetSpace\s+)(\S+)')
|
regexp = re.compile(r'(.*)(\\InsetSpace\s+)(\S+)')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -236,7 +236,7 @@ def revert_eqref(document):
|
|||||||
"\\begin_inset LatexCommand \\eqref -> ERT"
|
"\\begin_inset LatexCommand \\eqref -> ERT"
|
||||||
regexp = re.compile(r'^\\begin_inset\s+LatexCommand\s+\\eqref')
|
regexp = re.compile(r'^\\begin_inset\s+LatexCommand\s+\\eqref')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -264,7 +264,7 @@ def revert_bibtex(document):
|
|||||||
def remove_insetparent(document):
|
def remove_insetparent(document):
|
||||||
" Remove \lyxparent"
|
" Remove \lyxparent"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand \\lyxparent", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand \\lyxparent", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -276,7 +276,7 @@ def convert_external(document):
|
|||||||
external_rexp = re.compile(r'\\begin_inset External ([^,]*),"([^"]*)",')
|
external_rexp = re.compile(r'\\begin_inset External ([^,]*),"([^"]*)",')
|
||||||
external_header = "\\begin_inset External"
|
external_header = "\\begin_inset External"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, external_header, i)
|
i = find_token(document.body, external_header, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -311,7 +311,7 @@ def revert_external_1(document):
|
|||||||
" Revert inset External."
|
" Revert inset External."
|
||||||
external_header = "\\begin_inset External"
|
external_header = "\\begin_inset External"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, external_header, i)
|
i = find_token(document.body, external_header, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -336,7 +336,7 @@ def revert_external_2(document):
|
|||||||
" Revert inset External. (part II)"
|
" Revert inset External. (part II)"
|
||||||
draft_token = '\tdraft'
|
draft_token = '\tdraft'
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset External', i)
|
i = find_token(document.body, '\\begin_inset External', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -354,7 +354,7 @@ def convert_comment(document):
|
|||||||
" Convert \\layout comment"
|
" Convert \\layout comment"
|
||||||
i = 0
|
i = 0
|
||||||
comment = "\\layout Comment"
|
comment = "\\layout Comment"
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, comment, i)
|
i = find_token(document.body, comment, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -365,7 +365,7 @@ def convert_comment(document):
|
|||||||
'\\layout %s' % document.default_layout]
|
'\\layout %s' % document.default_layout]
|
||||||
i = i + 7
|
i = i + 7
|
||||||
|
|
||||||
while 1:
|
while True:
|
||||||
old_i = i
|
old_i = i
|
||||||
i = find_token(document.body, "\\layout", i)
|
i = find_token(document.body, "\\layout", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -418,7 +418,7 @@ def convert_comment(document):
|
|||||||
def revert_comment(document):
|
def revert_comment(document):
|
||||||
" Revert comments"
|
" Revert comments"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Comment", "\\begin_inset Greyedout"], i)
|
i = find_tokens(document.body, ["\\begin_inset Comment", "\\begin_inset Greyedout"], i)
|
||||||
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -437,7 +437,7 @@ def add_end_layout(document):
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
struct_stack = ["\\layout"]
|
struct_stack = ["\\layout"]
|
||||||
|
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset", "\\end_inset", "\\layout",
|
i = find_tokens(document.body, ["\\begin_inset", "\\end_inset", "\\layout",
|
||||||
"\\begin_deeper", "\\end_deeper", "\\the_end"], i)
|
"\\begin_deeper", "\\end_deeper", "\\the_end"], i)
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ def add_end_layout(document):
|
|||||||
def rm_end_layout(document):
|
def rm_end_layout(document):
|
||||||
" Remove \end_layout"
|
" Remove \end_layout"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\end_layout', i)
|
i = find_token(document.body, '\\end_layout', i)
|
||||||
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -535,7 +535,7 @@ def rm_tracking_changes(document):
|
|||||||
def rm_body_changes(document):
|
def rm_body_changes(document):
|
||||||
" Remove body changes."
|
" Remove body changes."
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\change_", i)
|
i = find_token(document.body, "\\change_", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -546,7 +546,7 @@ def rm_body_changes(document):
|
|||||||
def layout2begin_layout(document):
|
def layout2begin_layout(document):
|
||||||
" \layout -> \begin_layout "
|
" \layout -> \begin_layout "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\layout', i)
|
i = find_token(document.body, '\\layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -558,7 +558,7 @@ def layout2begin_layout(document):
|
|||||||
def begin_layout2layout(document):
|
def begin_layout2layout(document):
|
||||||
" \begin_layout -> \layout "
|
" \begin_layout -> \layout "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_layout', i)
|
i = find_token(document.body, '\\begin_layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -578,7 +578,7 @@ def convert_table_valignment_middle(document):
|
|||||||
" Convert table valignment, center -> middle"
|
" Convert table valignment, center -> middle"
|
||||||
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -602,7 +602,7 @@ def revert_valignment_middle(document):
|
|||||||
" Convert table valignment, middle -> center"
|
" Convert table valignment, middle -> center"
|
||||||
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
regexp = re.compile(r'^\\begin_inset\s+Tabular')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -677,7 +677,7 @@ parskip}
|
|||||||
attribute_values = ['default', 'default', 'default', 'default',
|
attribute_values = ['default', 'default', 'default', 'default',
|
||||||
'default', 'default', 'default', 'none', document.language]
|
'default', 'default', 'default', 'none', document.language]
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout", i)
|
i = find_token(document.body, "\\begin_layout", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -835,7 +835,7 @@ parskip}
|
|||||||
def convert_note(document):
|
def convert_note(document):
|
||||||
" Convert Notes. "
|
" Convert Notes. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Note",
|
i = find_tokens(document.body, ["\\begin_inset Note",
|
||||||
"\\begin_inset Comment",
|
"\\begin_inset Comment",
|
||||||
"\\begin_inset Greyedout"], i)
|
"\\begin_inset Greyedout"], i)
|
||||||
@ -850,7 +850,7 @@ def revert_note(document):
|
|||||||
" Revert Notes. "
|
" Revert Notes. "
|
||||||
note_header = "\\begin_inset Note "
|
note_header = "\\begin_inset Note "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, note_header, i)
|
i = find_token(document.body, note_header, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -862,7 +862,7 @@ def revert_note(document):
|
|||||||
def convert_box(document):
|
def convert_box(document):
|
||||||
" Convert Boxes. "
|
" Convert Boxes. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Boxed",
|
i = find_tokens(document.body, ["\\begin_inset Boxed",
|
||||||
"\\begin_inset Doublebox",
|
"\\begin_inset Doublebox",
|
||||||
"\\begin_inset Frameless",
|
"\\begin_inset Frameless",
|
||||||
@ -880,7 +880,7 @@ def revert_box(document):
|
|||||||
" Revert Boxes."
|
" Revert Boxes."
|
||||||
box_header = "\\begin_inset Box "
|
box_header = "\\begin_inset Box "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, box_header, i)
|
i = find_token(document.body, box_header, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -892,7 +892,7 @@ def revert_box(document):
|
|||||||
def convert_collapsable(document):
|
def convert_collapsable(document):
|
||||||
" Convert collapsed insets. "
|
" Convert collapsed insets. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens_exact(document.body, ["\\begin_inset Box",
|
i = find_tokens_exact(document.body, ["\\begin_inset Box",
|
||||||
"\\begin_inset Branch",
|
"\\begin_inset Branch",
|
||||||
"\\begin_inset CharStyle",
|
"\\begin_inset CharStyle",
|
||||||
@ -909,7 +909,7 @@ def convert_collapsable(document):
|
|||||||
# If, however, we find a line starting '\begin_layout'
|
# If, however, we find a line starting '\begin_layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i] == "collapsed false"):
|
if (document.body[i] == "collapsed false"):
|
||||||
document.body[i] = "status open"
|
document.body[i] = "status open"
|
||||||
break
|
break
|
||||||
@ -927,7 +927,7 @@ def convert_collapsable(document):
|
|||||||
def revert_collapsable(document):
|
def revert_collapsable(document):
|
||||||
" Revert collapsed insets. "
|
" Revert collapsed insets. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens_exact(document.body, ["\\begin_inset Box",
|
i = find_tokens_exact(document.body, ["\\begin_inset Box",
|
||||||
"\\begin_inset Branch",
|
"\\begin_inset Branch",
|
||||||
"\\begin_inset CharStyle",
|
"\\begin_inset CharStyle",
|
||||||
@ -944,7 +944,7 @@ def revert_collapsable(document):
|
|||||||
# If, however, we find a line starting '\begin_layout'
|
# If, however, we find a line starting '\begin_layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i] == "status open"):
|
if (document.body[i] == "status open"):
|
||||||
document.body[i] = "collapsed false"
|
document.body[i] = "collapsed false"
|
||||||
break
|
break
|
||||||
@ -963,7 +963,7 @@ def revert_collapsable(document):
|
|||||||
def convert_ert(document):
|
def convert_ert(document):
|
||||||
" Convert ERT. "
|
" Convert ERT. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset ERT", i)
|
i = find_token(document.body, "\\begin_inset ERT", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -972,7 +972,7 @@ def convert_ert(document):
|
|||||||
# If, however, we find a line starting '\begin_layout'
|
# If, however, we find a line starting '\begin_layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i] == "status Open"):
|
if (document.body[i] == "status Open"):
|
||||||
document.body[i] = "status open"
|
document.body[i] = "status open"
|
||||||
break
|
break
|
||||||
@ -993,7 +993,7 @@ def convert_ert(document):
|
|||||||
def revert_ert(document):
|
def revert_ert(document):
|
||||||
" Revert ERT. "
|
" Revert ERT. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset ERT", i)
|
i = find_token(document.body, "\\begin_inset ERT", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -1002,7 +1002,7 @@ def revert_ert(document):
|
|||||||
# If, however, we find a line starting '\begin_layout'
|
# If, however, we find a line starting '\begin_layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i] == "status open"):
|
if (document.body[i] == "status open"):
|
||||||
document.body[i] = "status Open"
|
document.body[i] = "status Open"
|
||||||
break
|
break
|
||||||
@ -1028,7 +1028,7 @@ def convert_minipage(document):
|
|||||||
inner_pos = ["c","t","b","s"]
|
inner_pos = ["c","t","b","s"]
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Minipage", i)
|
i = find_token(document.body, "\\begin_inset Minipage", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1199,7 +1199,7 @@ def revert_breaks(document):
|
|||||||
|
|
||||||
# Convert the insets
|
# Convert the insets
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, tokens, i)
|
i = find_tokens(document.body, tokens, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1554,7 +1554,7 @@ def convert_frameless_box(document):
|
|||||||
pos = ['t', 'c', 'b']
|
pos = ['t', 'c', 'b']
|
||||||
inner_pos = ['c', 't', 'b', 's']
|
inner_pos = ['c', 't', 'b', 's']
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Frameless', i)
|
i = find_token(document.body, '\\begin_inset Frameless', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1733,7 +1733,7 @@ def convert_frameless_box(document):
|
|||||||
def remove_branches(document):
|
def remove_branches(document):
|
||||||
" Remove branches. "
|
" Remove branches. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.header, "\\branch", i)
|
i = find_token(document.header, "\\branch", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -1745,7 +1745,7 @@ def remove_branches(document):
|
|||||||
del document.header[i:j+1]
|
del document.header[i:j+1]
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Branch", i)
|
i = find_token(document.body, "\\begin_inset Branch", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1760,7 +1760,7 @@ def remove_branches(document):
|
|||||||
# If, however, we find a line starting '\layout'
|
# If, however, we find a line starting '\layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
collapsed_found = 0
|
collapsed_found = 0
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i][:9] == "collapsed"):
|
if (document.body[i][:9] == "collapsed"):
|
||||||
del document.body[i]
|
del document.body[i]
|
||||||
collapsed_found = 1
|
collapsed_found = 1
|
||||||
@ -1821,7 +1821,7 @@ def revert_bibtopic(document):
|
|||||||
def convert_float(document):
|
def convert_float(document):
|
||||||
" Convert sideway floats. "
|
" Convert sideway floats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token_exact(document.body, '\\begin_inset Float', i)
|
i = find_token_exact(document.body, '\\begin_inset Float', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1829,7 +1829,7 @@ def convert_float(document):
|
|||||||
# If, however, we find a line starting '\begin_layout'
|
# If, however, we find a line starting '\begin_layout'
|
||||||
# (_always_ present) then break with a warning message
|
# (_always_ present) then break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i][:4] == "wide"):
|
if (document.body[i][:4] == "wide"):
|
||||||
document.body.insert(i + 1, 'sideways false')
|
document.body.insert(i + 1, 'sideways false')
|
||||||
break
|
break
|
||||||
@ -1843,7 +1843,7 @@ def convert_float(document):
|
|||||||
def revert_float(document):
|
def revert_float(document):
|
||||||
" Revert sideways floats. "
|
" Revert sideways floats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token_exact(document.body, '\\begin_inset Float', i)
|
i = find_token_exact(document.body, '\\begin_inset Float', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1883,7 +1883,7 @@ def convert_graphics(document):
|
|||||||
""" Add extension to documentnames of insetgraphics if necessary.
|
""" Add extension to documentnames of insetgraphics if necessary.
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Graphics", i)
|
i = find_token(document.body, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1924,7 +1924,7 @@ def convert_names(document):
|
|||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout Author", i)
|
i = find_token(document.body, "\\begin_layout Author", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2092,7 +2092,7 @@ def revert_paperpackage(document):
|
|||||||
def convert_bullets(document):
|
def convert_bullets(document):
|
||||||
" Convert bullets. "
|
" Convert bullets. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.header, "\\bullet", i)
|
i = find_token(document.header, "\\bullet", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2110,7 +2110,7 @@ def convert_bullets(document):
|
|||||||
def revert_bullets(document):
|
def revert_bullets(document):
|
||||||
" Revert bullets. "
|
" Revert bullets. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.header, "\\bullet", i)
|
i = find_token(document.header, "\\bullet", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2235,13 +2235,13 @@ def normalize_paragraph_params(document):
|
|||||||
"\\leftindent"
|
"\\leftindent"
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_layout', i)
|
i = find_token(document.body, '\\begin_layout', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if body[i].strip() and body[i].split()[0] not in allowed_parameters:
|
if body[i].strip() and body[i].split()[0] not in allowed_parameters:
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -2282,7 +2282,7 @@ def convert_ert_paragraphs(document):
|
|||||||
'\\emph', '\\numeric', '\\bar', '\\noun',
|
'\\emph', '\\numeric', '\\bar', '\\noun',
|
||||||
'\\color', '\\lang']
|
'\\color', '\\lang']
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset ERT', i)
|
i = find_token(document.body, '\\begin_inset ERT', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2294,7 +2294,7 @@ def convert_ert_paragraphs(document):
|
|||||||
|
|
||||||
# convert non-standard paragraphs to standard
|
# convert non-standard paragraphs to standard
|
||||||
k = i
|
k = i
|
||||||
while 1:
|
while True:
|
||||||
k = find_token(document.body, "\\begin_layout", k, j)
|
k = find_token(document.body, "\\begin_layout", k, j)
|
||||||
if k == -1:
|
if k == -1:
|
||||||
break
|
break
|
||||||
@ -2314,7 +2314,7 @@ def convert_ert_paragraphs(document):
|
|||||||
# insert an empty paragraph before each paragraph but the first
|
# insert an empty paragraph before each paragraph but the first
|
||||||
k = i
|
k = i
|
||||||
first_pagraph = 1
|
first_pagraph = 1
|
||||||
while 1:
|
while True:
|
||||||
k = find_token(document.body, "\\begin_layout", k, j)
|
k = find_token(document.body, "\\begin_layout", k, j)
|
||||||
if k == -1:
|
if k == -1:
|
||||||
break
|
break
|
||||||
@ -2329,7 +2329,7 @@ def convert_ert_paragraphs(document):
|
|||||||
|
|
||||||
# convert \\newline to new paragraph
|
# convert \\newline to new paragraph
|
||||||
k = i
|
k = i
|
||||||
while 1:
|
while True:
|
||||||
k = find_token(document.body, "\\newline", k, j)
|
k = find_token(document.body, "\\newline", k, j)
|
||||||
if k == -1:
|
if k == -1:
|
||||||
break
|
break
|
||||||
@ -2347,7 +2347,7 @@ def convert_ert_paragraphs(document):
|
|||||||
def revert_ert_paragraphs(document):
|
def revert_ert_paragraphs(document):
|
||||||
" Remove double paragraph breaks. "
|
" Remove double paragraph breaks. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset ERT', i)
|
i = find_token(document.body, '\\begin_inset ERT', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2359,7 +2359,7 @@ def revert_ert_paragraphs(document):
|
|||||||
|
|
||||||
# replace paragraph breaks with \newline
|
# replace paragraph breaks with \newline
|
||||||
k = i
|
k = i
|
||||||
while 1:
|
while True:
|
||||||
k = find_token(document.body, "\\end_layout", k, j)
|
k = find_token(document.body, "\\end_layout", k, j)
|
||||||
l = find_token(document.body, "\\begin_layout", k, j)
|
l = find_token(document.body, "\\begin_layout", k, j)
|
||||||
if k == -1 or l == -1:
|
if k == -1 or l == -1:
|
||||||
@ -2370,7 +2370,7 @@ def revert_ert_paragraphs(document):
|
|||||||
|
|
||||||
# replace double \newlines with paragraph breaks
|
# replace double \newlines with paragraph breaks
|
||||||
k = i
|
k = i
|
||||||
while 1:
|
while True:
|
||||||
k = find_token(document.body, "\\newline", k, j)
|
k = find_token(document.body, "\\newline", k, j)
|
||||||
if k == -1:
|
if k == -1:
|
||||||
break
|
break
|
||||||
@ -2402,7 +2402,7 @@ def convert_french(document):
|
|||||||
# Change language in the document body
|
# Change language in the document body
|
||||||
regexp = re.compile(r'^\\lang\s+frenchb')
|
regexp = re.compile(r'^\\lang\s+frenchb')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -2448,7 +2448,7 @@ def convert_sgml_paragraphs(document):
|
|||||||
return
|
return
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout SGML", i)
|
i = find_token(document.body, "\\begin_layout SGML", i)
|
||||||
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
|
@ -61,7 +61,7 @@ def find_beginning_of_layout(lines, i):
|
|||||||
def revert_framed(document):
|
def revert_framed(document):
|
||||||
"Revert framed notes. "
|
"Revert framed notes. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
|
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
|
||||||
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -216,7 +216,7 @@ def revert_booktabs(document):
|
|||||||
re_bspace = re.compile(r'\s+bottomspace="[^"]+"')
|
re_bspace = re.compile(r'\s+bottomspace="[^"]+"')
|
||||||
re_ispace = re.compile(r'\s+interlinespace="[^"]+"')
|
re_ispace = re.compile(r'\s+interlinespace="[^"]+"')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Tabular", i)
|
i = find_token(document.body, "\\begin_inset Tabular", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -470,14 +470,14 @@ implemented.'''
|
|||||||
def revert_cs_label(document):
|
def revert_cs_label(document):
|
||||||
" Remove status flag of charstyle label. "
|
" Remove status flag of charstyle label. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CharStyle", i)
|
i = find_token(document.body, "\\begin_inset CharStyle", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
# Seach for a line starting 'show_label'
|
# Seach for a line starting 'show_label'
|
||||||
# If it is not there, break with a warning message
|
# If it is not there, break with a warning message
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i][:10] == "show_label"):
|
if (document.body[i][:10] == "show_label"):
|
||||||
del document.body[i]
|
del document.body[i]
|
||||||
break
|
break
|
||||||
@ -504,7 +504,7 @@ key "argument"
|
|||||||
This must be called after convert_commandparams.
|
This must be called after convert_commandparams.
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\bibitem", i)
|
i = find_token(document.body, "\\bibitem", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -592,7 +592,7 @@ def convert_commandparams(document):
|
|||||||
# convert_bibitem()), but could be read in, so we convert it here, too.
|
# convert_bibitem()), but could be read in, so we convert it here, too.
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -680,7 +680,7 @@ def convert_commandparams(document):
|
|||||||
def revert_commandparams(document):
|
def revert_commandparams(document):
|
||||||
regex = re.compile(r'(\S+)\s+(.+)')
|
regex = re.compile(r'(\S+)\s+(.+)')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -738,7 +738,7 @@ def revert_nomenclature(document):
|
|||||||
regex = re.compile(r'(\S+)\s+(.+)')
|
regex = re.compile(r'(\S+)\s+(.+)')
|
||||||
i = 0
|
i = 0
|
||||||
use_nomencl = 0
|
use_nomencl = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand nomenclature", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand nomenclature", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -789,7 +789,7 @@ def revert_printnomenclature(document):
|
|||||||
regex = re.compile(r'(\S+)\s+(.+)')
|
regex = re.compile(r'(\S+)\s+(.+)')
|
||||||
i = 0
|
i = 0
|
||||||
use_nomencl = 0
|
use_nomencl = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand printnomenclature", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand printnomenclature", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -855,7 +855,7 @@ def revert_esint(document):
|
|||||||
def revert_clearpage(document):
|
def revert_clearpage(document):
|
||||||
" clearpage -> ERT "
|
" clearpage -> ERT "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\clearpage", i)
|
i = find_token(document.body, "\\clearpage", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -876,7 +876,7 @@ def revert_clearpage(document):
|
|||||||
def revert_cleardoublepage(document):
|
def revert_cleardoublepage(document):
|
||||||
" cleardoublepage -> ERT "
|
" cleardoublepage -> ERT "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\cleardoublepage", i)
|
i = find_token(document.body, "\\cleardoublepage", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -934,7 +934,7 @@ def revert_encodings(document):
|
|||||||
def convert_caption(document):
|
def convert_caption(document):
|
||||||
" Convert caption layouts to caption insets. "
|
" Convert caption layouts to caption insets. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout Caption", i)
|
i = find_token(document.body, "\\begin_layout Caption", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -954,7 +954,7 @@ def revert_caption(document):
|
|||||||
" Convert caption insets to caption layouts. "
|
" Convert caption insets to caption layouts. "
|
||||||
" This assumes that the text class has a caption style. "
|
" This assumes that the text class has a caption style. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Caption", i)
|
i = find_token(document.body, "\\begin_inset Caption", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1119,7 +1119,7 @@ def convert_accent(document):
|
|||||||
re_contents = re.compile(r'^([^\s{]+)(.*)$')
|
re_contents = re.compile(r'^([^\s{]+)(.*)$')
|
||||||
re_accentedcontents = re.compile(r'^\s*{?([^{}]*)}?\s*$')
|
re_accentedcontents = re.compile(r'^\s*{?([^{}]*)}?\s*$')
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, re_wholeinset, i)
|
i = find_re(document.body, re_wholeinset, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1452,13 +1452,13 @@ def revert_utf8plain(document):
|
|||||||
def revert_beamer_alert(document):
|
def revert_beamer_alert(document):
|
||||||
" Revert beamer's \\alert inset back to ERT. "
|
" Revert beamer's \\alert inset back to ERT. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CharStyle Alert", i)
|
i = find_token(document.body, "\\begin_inset CharStyle Alert", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
document.body[i] = "\\begin_inset ERT"
|
document.body[i] = "\\begin_inset ERT"
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i][:13] == "\\begin_layout"):
|
if (document.body[i][:13] == "\\begin_layout"):
|
||||||
# Insert the \alert command
|
# Insert the \alert command
|
||||||
document.body[i + 1] = "\\alert{" + document.body[i + 1] + '}'
|
document.body[i + 1] = "\\alert{" + document.body[i + 1] + '}'
|
||||||
@ -1471,13 +1471,13 @@ def revert_beamer_alert(document):
|
|||||||
def revert_beamer_structure(document):
|
def revert_beamer_structure(document):
|
||||||
" Revert beamer's \\structure inset back to ERT. "
|
" Revert beamer's \\structure inset back to ERT. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CharStyle Structure", i)
|
i = find_token(document.body, "\\begin_inset CharStyle Structure", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
document.body[i] = "\\begin_inset ERT"
|
document.body[i] = "\\begin_inset ERT"
|
||||||
i = i + 1
|
i = i + 1
|
||||||
while 1:
|
while True:
|
||||||
if (document.body[i][:13] == "\\begin_layout"):
|
if (document.body[i][:13] == "\\begin_layout"):
|
||||||
document.body[i + 1] = "\\structure{" + document.body[i + 1] + '}'
|
document.body[i + 1] = "\\structure{" + document.body[i + 1] + '}'
|
||||||
break
|
break
|
||||||
@ -1550,7 +1550,7 @@ def revert_cv_textclass(document):
|
|||||||
def convert_graphics_rotation(document):
|
def convert_graphics_rotation(document):
|
||||||
" add scaleBeforeRotation graphics parameter. "
|
" add scaleBeforeRotation graphics parameter. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Graphics", i)
|
i = find_token(document.body, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1572,7 +1572,7 @@ def convert_graphics_rotation(document):
|
|||||||
def revert_graphics_rotation(document):
|
def revert_graphics_rotation(document):
|
||||||
" remove scaleBeforeRotation graphics parameter. "
|
" remove scaleBeforeRotation graphics parameter. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Graphics", i)
|
i = find_token(document.body, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -972,7 +972,7 @@ def revert_pdf_options(document):
|
|||||||
def remove_inzip_options(document):
|
def remove_inzip_options(document):
|
||||||
"Remove inzipName and embed options from the Graphics inset"
|
"Remove inzipName and embed options from the Graphics inset"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Graphics", i)
|
i = find_token(document.body, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1000,7 +1000,7 @@ def convert_inset_command(document):
|
|||||||
LatexCommand cmd
|
LatexCommand cmd
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
i = find_token(document.body, "\\begin_inset LatexCommand", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1039,7 +1039,7 @@ def revert_inset_command(document):
|
|||||||
will not be able to recognize. Not sure what to do about that.
|
will not be able to recognize. Not sure what to do about that.
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset", i)
|
i = find_token(document.body, "\\begin_inset CommandInset", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1262,7 +1262,7 @@ def revert_japanese_encoding(document):
|
|||||||
def revert_inset_info(document):
|
def revert_inset_info(document):
|
||||||
'Replace info inset with its content'
|
'Replace info inset with its content'
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Info', i)
|
i = find_token(document.body, '\\begin_inset Info', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1743,7 +1743,7 @@ def convert_serbocroatian(document):
|
|||||||
def convert_framed_notes(document):
|
def convert_framed_notes(document):
|
||||||
"Convert framed notes to boxes. "
|
"Convert framed notes to boxes. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
|
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1820,7 +1820,7 @@ def revert_colsep(document):
|
|||||||
def revert_framed_notes(document):
|
def revert_framed_notes(document):
|
||||||
"Revert framed boxes to notes. "
|
"Revert framed boxes to notes. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_tokens(document.body, ["\\begin_inset Box Framed", "\\begin_inset Box Shaded"], i)
|
i = find_tokens(document.body, ["\\begin_inset Box Framed", "\\begin_inset Box Shaded"], i)
|
||||||
|
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -1938,7 +1938,7 @@ def revert_nocite_key(body, start, end):
|
|||||||
def revert_nocite(document):
|
def revert_nocite(document):
|
||||||
"Revert LatexCommand nocite to ERT"
|
"Revert LatexCommand nocite to ERT"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset citation", i)
|
i = find_token(document.body, "\\begin_inset CommandInset citation", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2056,7 +2056,7 @@ def revert_serbianlatin(document):
|
|||||||
def revert_rotfloat(document):
|
def revert_rotfloat(document):
|
||||||
" Revert sideways custom floats. "
|
" Revert sideways custom floats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
# whitespace intended (exclude \\begin_inset FloatList)
|
# whitespace intended (exclude \\begin_inset FloatList)
|
||||||
i = find_token(document.body, "\\begin_inset Float ", i)
|
i = find_token(document.body, "\\begin_inset Float ", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -2119,7 +2119,7 @@ def revert_rotfloat(document):
|
|||||||
def revert_widesideways(document):
|
def revert_widesideways(document):
|
||||||
" Revert wide sideways floats. "
|
" Revert wide sideways floats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
# whitespace intended (exclude \\begin_inset FloatList)
|
# whitespace intended (exclude \\begin_inset FloatList)
|
||||||
i = find_token(document.body, '\\begin_inset Float ', i)
|
i = find_token(document.body, '\\begin_inset Float ', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -2171,7 +2171,7 @@ def revert_widesideways(document):
|
|||||||
def revert_inset_embedding(document, type):
|
def revert_inset_embedding(document, type):
|
||||||
' Remove embed tag from certain type of insets'
|
' Remove embed tag from certain type of insets'
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset %s" % type, i)
|
i = find_token(document.body, "\\begin_inset %s" % type, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2196,7 +2196,7 @@ def revert_external_embedding(document):
|
|||||||
def convert_subfig(document):
|
def convert_subfig(document):
|
||||||
" Convert subfigures to subfloats. "
|
" Convert subfigures to subfloats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
addedLines = 0
|
addedLines = 0
|
||||||
i = find_token(document.body, '\\begin_inset Graphics', i)
|
i = find_token(document.body, '\\begin_inset Graphics', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -2236,7 +2236,7 @@ def convert_subfig(document):
|
|||||||
def revert_subfig(document):
|
def revert_subfig(document):
|
||||||
" Revert subfloats. "
|
" Revert subfloats. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
# whitespace intended (exclude \\begin_inset FloatList)
|
# whitespace intended (exclude \\begin_inset FloatList)
|
||||||
i = find_tokens(document.body, ['\\begin_inset Float ', '\\begin_inset Wrap'], i)
|
i = find_tokens(document.body, ['\\begin_inset Float ', '\\begin_inset Wrap'], i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
@ -2740,7 +2740,7 @@ def convert_japanese_plain(document):
|
|||||||
def revert_pdfpages(document):
|
def revert_pdfpages(document):
|
||||||
' Revert pdfpages external inset to ERT '
|
' Revert pdfpages external inset to ERT '
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset External", i)
|
i = find_token(document.body, "\\begin_inset External", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2842,7 +2842,7 @@ def revert_master(document):
|
|||||||
def revert_graphics_group(document):
|
def revert_graphics_group(document):
|
||||||
' Revert group information from graphics insets '
|
' Revert group information from graphics insets '
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Graphics", i)
|
i = find_token(document.body, "\\begin_inset Graphics", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2872,7 +2872,7 @@ def update_apa_styles(document):
|
|||||||
"Paragraph*": "Paragraph",
|
"Paragraph*": "Paragraph",
|
||||||
"Subparagraph*": "Subparagraph"}
|
"Subparagraph*": "Subparagraph"}
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout", i)
|
i = find_token(document.body, "\\begin_layout", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -916,7 +916,7 @@ def merge_gbrief(document):
|
|||||||
"Verteiler": "cc",
|
"Verteiler": "cc",
|
||||||
"Gruss": "Closing"}
|
"Gruss": "Closing"}
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout", i)
|
i = find_token(document.body, "\\begin_layout", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -1332,7 +1332,7 @@ def revert_lyx_version(document):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Info', i)
|
i = find_token(document.body, '\\begin_inset Info', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1481,7 +1481,7 @@ def revert_align_decimal(document):
|
|||||||
def convert_optarg(document):
|
def convert_optarg(document):
|
||||||
" Convert \\begin_inset OptArg to \\begin_inset Argument "
|
" Convert \\begin_inset OptArg to \\begin_inset Argument "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset OptArg', i)
|
i = find_token(document.body, '\\begin_inset OptArg', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1492,7 +1492,7 @@ def convert_optarg(document):
|
|||||||
def revert_argument(document):
|
def revert_argument(document):
|
||||||
" Convert \\begin_inset Argument to \\begin_inset OptArg "
|
" Convert \\begin_inset Argument to \\begin_inset OptArg "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Argument', i)
|
i = find_token(document.body, '\\begin_inset Argument', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1503,7 +1503,7 @@ def revert_argument(document):
|
|||||||
def revert_makebox(document):
|
def revert_makebox(document):
|
||||||
" Convert \\makebox to TeX code "
|
" Convert \\makebox to TeX code "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Box', i)
|
i = find_token(document.body, '\\begin_inset Box', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -1550,7 +1550,7 @@ def revert_makebox(document):
|
|||||||
def convert_use_makebox(document):
|
def convert_use_makebox(document):
|
||||||
" Adds use_makebox option for boxes "
|
" Adds use_makebox option for boxes "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset Box', i)
|
i = find_token(document.body, '\\begin_inset Box', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -1668,7 +1668,7 @@ def revert_nameref(document):
|
|||||||
for cmd in cmds:
|
for cmd in cmds:
|
||||||
i = 0
|
i = 0
|
||||||
oldcmd = "LatexCommand " + cmd
|
oldcmd = "LatexCommand " + cmd
|
||||||
while 1:
|
while True:
|
||||||
# It seems better to look for this, as most of the reference
|
# It seems better to look for this, as most of the reference
|
||||||
# insets won't be ones we care about.
|
# insets won't be ones we care about.
|
||||||
i = find_token(document.body, oldcmd, i)
|
i = find_token(document.body, oldcmd, i)
|
||||||
@ -1705,7 +1705,7 @@ def revert_nameref(document):
|
|||||||
def remove_Nameref(document):
|
def remove_Nameref(document):
|
||||||
" Convert Nameref commands to nameref commands "
|
" Convert Nameref commands to nameref commands "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
# It seems better to look for this, as most of the reference
|
# It seems better to look for this, as most of the reference
|
||||||
# insets won't be ones we care about.
|
# insets won't be ones we care about.
|
||||||
i = find_token(document.body, "LatexCommand Nameref" , i)
|
i = find_token(document.body, "LatexCommand Nameref" , i)
|
||||||
@ -1947,7 +1947,7 @@ def convert_rule(document):
|
|||||||
def revert_rule(document):
|
def revert_rule(document):
|
||||||
" Revert line insets to Tex code "
|
" Revert line insets to Tex code "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset CommandInset line" , i)
|
i = find_token(document.body, "\\begin_inset CommandInset line" , i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -2349,7 +2349,7 @@ def revert_script(document):
|
|||||||
" Convert subscript/superscript inset to TeX code "
|
" Convert subscript/superscript inset to TeX code "
|
||||||
i = 0
|
i = 0
|
||||||
foundsubscript = False
|
foundsubscript = False
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, '\\begin_inset script', i)
|
i = find_token(document.body, '\\begin_inset script', i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
|
@ -838,7 +838,7 @@ def revert_verbatim(document, starred = False):
|
|||||||
'begin{%s}' % (latex_name),
|
'begin{%s}' % (latex_name),
|
||||||
'\\end_layout', '', '\\begin_layout Plain Layout', '']
|
'\\end_layout', '', '\\begin_layout Plain Layout', '']
|
||||||
|
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_layout %s" % (layout_name), i)
|
i = find_token(document.body, "\\begin_layout %s" % (layout_name), i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -850,7 +850,7 @@ def revert_verbatim(document, starred = False):
|
|||||||
continue
|
continue
|
||||||
# delete all line breaks insets (there are no other insets)
|
# delete all line breaks insets (there are no other insets)
|
||||||
l = i
|
l = i
|
||||||
while 1:
|
while True:
|
||||||
n = find_token(document.body, "\\begin_inset Newline newline", l, j)
|
n = find_token(document.body, "\\begin_inset Newline newline", l, j)
|
||||||
if n == -1:
|
if n == -1:
|
||||||
n = find_token(document.body, "\\begin_inset Newline linebreak", l, j)
|
n = find_token(document.body, "\\begin_inset Newline linebreak", l, j)
|
||||||
@ -898,7 +898,7 @@ def revert_verbatim(document, starred = False):
|
|||||||
def revert_tipa(document):
|
def revert_tipa(document):
|
||||||
" Revert native TIPA insets to mathed or ERT. "
|
" Revert native TIPA insets to mathed or ERT. "
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset IPA", i)
|
i = find_token(document.body, "\\begin_inset IPA", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -153,7 +153,7 @@ def convert_separator(document):
|
|||||||
}
|
}
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_deeper", i)
|
i = find_token(document.body, "\\begin_deeper", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -175,7 +175,7 @@ def convert_separator(document):
|
|||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\align", i)
|
i = find_token(document.body, "\\align", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
break
|
break
|
||||||
@ -208,7 +208,7 @@ def convert_separator(document):
|
|||||||
regexp = re.compile(r'^\\begin_layout (?:(-*)|(\s*))(Separator|EndOfSlide)(?:(-*)|(\s*))$', re.IGNORECASE)
|
regexp = re.compile(r'^\\begin_layout (?:(-*)|(\s*))(Separator|EndOfSlide)(?:(-*)|(\s*))$', re.IGNORECASE)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_re(document.body, regexp, i)
|
i = find_re(document.body, regexp, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -249,7 +249,7 @@ def revert_separator(document):
|
|||||||
"", "\\end_inset", ""]
|
"", "\\end_inset", ""]
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Separator", i)
|
i = find_token(document.body, "\\begin_inset Separator", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -341,7 +341,7 @@ def convert_parbreak(document):
|
|||||||
"""
|
"""
|
||||||
parbreakinset = "\\begin_inset Separator parbreak"
|
parbreakinset = "\\begin_inset Separator parbreak"
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, parbreakinset, i)
|
i = find_token(document.body, parbreakinset, i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
@ -366,7 +366,7 @@ def revert_parbreak(document):
|
|||||||
Revert latexpar separators to parbreak separators.
|
Revert latexpar separators to parbreak separators.
|
||||||
"""
|
"""
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset Separator latexpar", i)
|
i = find_token(document.body, "\\begin_inset Separator latexpar", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
@ -78,7 +78,7 @@ def revert_microtype(document):
|
|||||||
def convert_dateinset(document):
|
def convert_dateinset(document):
|
||||||
' Convert date external inset to ERT '
|
' Convert date external inset to ERT '
|
||||||
i = 0
|
i = 0
|
||||||
while 1:
|
while True:
|
||||||
i = find_token(document.body, "\\begin_inset External", i)
|
i = find_token(document.body, "\\begin_inset External", i)
|
||||||
if i == -1:
|
if i == -1:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user