In lib/lyx2lyx/: s/while 1/while True/

This commit is contained in:
Richard Heck 2016-06-25 17:37:13 -04:00
parent 3420910d7b
commit 1db883e183
15 changed files with 152 additions and 152 deletions

View File

@ -401,7 +401,7 @@ class LyX_base:
self.body[i] = self.body[i].decode(self.encoding)
# Read document body
while 1:
while True:
line = self.input.readline().decode(self.encoding)
if not line:
break
@ -767,7 +767,7 @@ class LyX_base:
# toc_par = []
# i = 0
# while 1:
# while True:
# i = find_tokens(self.body, sections, i)
# if i == -1:
# break

View File

@ -26,7 +26,7 @@ def space_before_layout(document):
" Remove empty line before \\layout. "
lines = document.body
i = 2 # skip first layout
while 1:
while True:
i = find_token(lines, '\\layout', i)
if i == -1:
break
@ -41,7 +41,7 @@ def formula_inset_space_eat(document):
" Remove space after inset formula."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset Formula", i)
if i == -1:
break
@ -56,7 +56,7 @@ def update_tabular(document):
lines = document.body
lyxtable_re = re.compile(r".*\\LyXTable$")
i = 0
while 1:
while True:
i = find_re(lines, lyxtable_re, i)
if i == -1:
break
@ -108,7 +108,7 @@ def update_inset_label(document):
" Update inset Label."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, '\\begin_inset Label', i)
if i == -1:
return
@ -120,7 +120,7 @@ def update_latexdel(document):
" Update inset LatexDel."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, '\\begin_inset LatexDel', i)
if i == -1:
return
@ -163,7 +163,7 @@ def remove_cursor(document):
lines = document.body
i = 0
cursor_re = re.compile(r'.*(\\cursor \d*)')
while 1:
while True:
i = find_re(lines, cursor_re, i)
if i == -1:
break
@ -176,7 +176,7 @@ def remove_empty_insets(document):
" Remove empty insets."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, '\\begin_inset ', i)
if i == -1:
break
@ -190,7 +190,7 @@ def remove_formula_latex(document):
" Remove formula latex."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, '\\latex formula_latex ', i)
if i == -1:
break
@ -268,7 +268,7 @@ def update_latexaccents(document):
" Update latex accent insets."
body = document.body
i = 1
while 1:
while True:
i = find_token(body, '\\i ', i)
if i == -1:
return
@ -297,7 +297,7 @@ def obsolete_latex_title(document):
" Replace layout Latex_Title with Title."
body = document.body
i = 0
while 1:
while True:
i = find_token(body, '\\layout', i)
if i == -1:
return
@ -313,7 +313,7 @@ def remove_inset_latex(document):
body = document.body
i = 0
while 1:
while True:
i = find_token(body, '\\begin_inset Latex', i)
if i == -1:
return

View File

@ -26,7 +26,7 @@ def obsolete_latex_title(document):
body = document.body
i = 0
while 1:
while True:
i = find_token(body, '\\layout', i)
if i == -1:
return
@ -43,7 +43,7 @@ def update_tabular(document):
lines = document.body
lyxtable_re = re.compile(r".*\\LyXTable$")
i = 0
while 1:
while True:
i = find_re(lines, lyxtable_re, i)
if i == -1:
break

View File

@ -40,7 +40,7 @@ def replace_protected_separator(document):
" Replace protected separator. "
lines = document.body
i=0
while 1:
while True:
i = find_token(lines, "\\protected_separator", i)
if i == -1:
break
@ -65,7 +65,7 @@ def merge_formula_inset(document):
" Merge formula insets. "
lines = document.body
i=0
while 1:
while True:
i = find_token(lines, "\\begin_inset Formula", i)
if i == -1: break
if lines[i+1] in math_env:
@ -79,7 +79,7 @@ def update_tabular(document):
lines = document.body
lyxtable_re = re.compile(r".*\\LyXTable$")
i=0
while 1:
while True:
i = find_re(lines, lyxtable_re, i)
if i == -1:
break
@ -111,7 +111,7 @@ def update_toc(document):
" Update table of contents. "
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines,
'\\begin_inset LatexCommand \\tableofcontents', i)
if i == -1:
@ -158,7 +158,7 @@ def remove_space_in_units(document):
for margin in margins:
i = 0
while 1:
while True:
i = find_token(lines, margin, i)
if i == -1:
break
@ -174,7 +174,7 @@ def latexdel_getargs(document, i):
lines = document.body
# play safe, clean empty lines
while 1:
while True:
if lines[i]:
break
del lines[i]
@ -191,7 +191,7 @@ def latexdel_getargs(document, i):
del lines[i:j + 1]
# play safe, clean empty lines
while 1:
while True:
if lines[i]:
break
del lines[i]
@ -212,7 +212,7 @@ def update_ref(document):
" Update reference inset. "
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, '\\begin_inset LatexCommand', i)
if i == -1:
return
@ -230,7 +230,7 @@ def update_latexdel(document):
lines = document.body
i = 0
latexdel_re = re.compile(r".*\\begin_inset LatexDel")
while 1:
while True:
i = find_re(lines, latexdel_re, i)
if i == -1:
return

View File

@ -26,7 +26,7 @@ def update_tabular(document):
" Update tabular to version 1 (xml like syntax). "
lines = document.body
i=0
while 1:
while True:
i = find_re(lines, lyxtable_re, i)
if i == -1:
break

View File

@ -39,7 +39,7 @@ def update_tabular(document):
regexp = re.compile(r'^\\begin_inset\s+Tabular')
lines = document.body
i=0
while 1:
while True:
i = find_re(lines, regexp, i)
if i == -1:
break

View File

@ -146,7 +146,7 @@ def remove_oldfloat(document):
" Change \begin_float .. \end_float into \begin_inset Float .. \end_inset"
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_float", i)
if i == -1:
break
@ -215,7 +215,7 @@ def remove_pextra(document):
lines = document.body
i = 0
flag = 0
while 1:
while True:
i = find_re(lines, pextra_type2_rexp, i)
if i == -1:
break
@ -258,7 +258,7 @@ def remove_pextra(document):
j = get_next_paragraph(lines, i, document.format + 1)
count = 0
while 1:
while True:
# collect more paragraphs to the minipage
count = count+1
if j == -1 or not check_token(lines[j], "\\layout"):
@ -301,12 +301,12 @@ def remove_oldert(document):
""]
lines = document.body
i = 0
while 1:
while True:
i = find_tokens(lines, ["\\latex latex", "\\layout LaTeX"], i)
if i == -1:
break
j = i+1
while 1:
while True:
# \end_inset is for ert inside a tabular cell. The other tokens
# are obvious.
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, "", ""]
k = i+1
while 1:
while True:
k2 = find_re(lines, ert_rexp, k, j)
inset = hfill = specialchar = 0
if k2 == -1:
@ -399,7 +399,7 @@ def remove_oldert(document):
# Delete remaining "\latex xxx" tokens
i = 0
while 1:
while True:
i = find_token(lines, "\\latex ", i)
if i == -1:
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."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset ERT", i)
if i == -1:
break
@ -445,7 +445,7 @@ def combine_ert(document):
" Combine ERT paragraphs."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset ERT", i)
if i == -1:
break
@ -490,7 +490,7 @@ def remove_figinset(document):
" Remove figinset."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset Figure", i)
if i == -1:
break
@ -564,7 +564,7 @@ def update_tabular(document):
regexp = re.compile(r'^\\begin_inset\s+Tabular')
lines = document.body
i = 0
while 1:
while True:
i = find_re(lines, regexp, i)
if i == -1:
break
@ -697,7 +697,7 @@ def update_longtables(document):
regexp = re.compile(r'^\\begin_inset\s+Tabular')
body = document.body
i = 0
while 1:
while True:
i = find_re(body, regexp, i)
if i == -1:
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."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset Float ", i)
if i == -1:
break
@ -780,7 +780,7 @@ def change_listof(document):
" Change listof insets."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset LatexCommand \\listof", i)
if i == -1:
break
@ -793,7 +793,7 @@ def change_infoinset(document):
" Change info inset."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset Info", i)
if i == -1:
break

View File

@ -54,7 +54,7 @@ def change_insetgraphics(document):
" Change inset Graphics."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "\\begin_inset Graphics", i)
if i == -1:
break
@ -113,7 +113,7 @@ def change_tabular(document):
" Change tabular."
lines = document.body
i = 0
while 1:
while True:
i = find_token(lines, "<column", i)
if i == -1:
break

View File

@ -105,7 +105,7 @@ def del_token(lines, token, start, end):
def remove_color_default(document):
" Remove \color default"
i = 0
while 1:
while True:
i = find_token(document.body, "\\color default", i)
if i == -1:
return
@ -179,7 +179,7 @@ def revert_spaces(document):
" \InsetSpace ~ -> \SpecialChar ~"
regexp = re.compile(r'(.*)(\\InsetSpace\s+)(\S+)')
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
break
@ -236,7 +236,7 @@ def revert_eqref(document):
"\\begin_inset LatexCommand \\eqref -> ERT"
regexp = re.compile(r'^\\begin_inset\s+LatexCommand\s+\\eqref')
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
break
@ -264,7 +264,7 @@ def revert_bibtex(document):
def remove_insetparent(document):
" Remove \lyxparent"
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand \\lyxparent", i)
if i == -1:
break
@ -276,7 +276,7 @@ def convert_external(document):
external_rexp = re.compile(r'\\begin_inset External ([^,]*),"([^"]*)",')
external_header = "\\begin_inset External"
i = 0
while 1:
while True:
i = find_token(document.body, external_header, i)
if i == -1:
break
@ -311,7 +311,7 @@ def revert_external_1(document):
" Revert inset External."
external_header = "\\begin_inset External"
i = 0
while 1:
while True:
i = find_token(document.body, external_header, i)
if i == -1:
break
@ -336,7 +336,7 @@ def revert_external_2(document):
" Revert inset External. (part II)"
draft_token = '\tdraft'
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset External', i)
if i == -1:
break
@ -354,7 +354,7 @@ def convert_comment(document):
" Convert \\layout comment"
i = 0
comment = "\\layout Comment"
while 1:
while True:
i = find_token(document.body, comment, i)
if i == -1:
return
@ -365,7 +365,7 @@ def convert_comment(document):
'\\layout %s' % document.default_layout]
i = i + 7
while 1:
while True:
old_i = i
i = find_token(document.body, "\\layout", i)
if i == -1:
@ -418,7 +418,7 @@ def convert_comment(document):
def revert_comment(document):
" Revert comments"
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Comment", "\\begin_inset Greyedout"], i)
if i == -1:
@ -437,7 +437,7 @@ def add_end_layout(document):
i = i + 1
struct_stack = ["\\layout"]
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset", "\\end_inset", "\\layout",
"\\begin_deeper", "\\end_deeper", "\\the_end"], i)
@ -504,7 +504,7 @@ def add_end_layout(document):
def rm_end_layout(document):
" Remove \end_layout"
i = 0
while 1:
while True:
i = find_token(document.body, '\\end_layout', i)
if i == -1:
@ -535,7 +535,7 @@ def rm_tracking_changes(document):
def rm_body_changes(document):
" Remove body changes."
i = 0
while 1:
while True:
i = find_token(document.body, "\\change_", i)
if i == -1:
return
@ -546,7 +546,7 @@ def rm_body_changes(document):
def layout2begin_layout(document):
" \layout -> \begin_layout "
i = 0
while 1:
while True:
i = find_token(document.body, '\\layout', i)
if i == -1:
return
@ -558,7 +558,7 @@ def layout2begin_layout(document):
def begin_layout2layout(document):
" \begin_layout -> \layout "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_layout', i)
if i == -1:
return
@ -578,7 +578,7 @@ def convert_table_valignment_middle(document):
" Convert table valignment, center -> middle"
regexp = re.compile(r'^\\begin_inset\s+Tabular')
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
return
@ -602,7 +602,7 @@ def revert_valignment_middle(document):
" Convert table valignment, middle -> center"
regexp = re.compile(r'^\\begin_inset\s+Tabular')
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
return
@ -677,7 +677,7 @@ parskip}
attribute_values = ['default', 'default', 'default', 'default',
'default', 'default', 'default', 'none', document.language]
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout", i)
if i == -1:
return
@ -835,7 +835,7 @@ parskip}
def convert_note(document):
" Convert Notes. "
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Note",
"\\begin_inset Comment",
"\\begin_inset Greyedout"], i)
@ -850,7 +850,7 @@ def revert_note(document):
" Revert Notes. "
note_header = "\\begin_inset Note "
i = 0
while 1:
while True:
i = find_token(document.body, note_header, i)
if i == -1:
break
@ -862,7 +862,7 @@ def revert_note(document):
def convert_box(document):
" Convert Boxes. "
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Boxed",
"\\begin_inset Doublebox",
"\\begin_inset Frameless",
@ -880,7 +880,7 @@ def revert_box(document):
" Revert Boxes."
box_header = "\\begin_inset Box "
i = 0
while 1:
while True:
i = find_token(document.body, box_header, i)
if i == -1:
break
@ -892,7 +892,7 @@ def revert_box(document):
def convert_collapsable(document):
" Convert collapsed insets. "
i = 0
while 1:
while True:
i = find_tokens_exact(document.body, ["\\begin_inset Box",
"\\begin_inset Branch",
"\\begin_inset CharStyle",
@ -909,7 +909,7 @@ def convert_collapsable(document):
# If, however, we find a line starting '\begin_layout'
# (_always_ present) then break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i] == "collapsed false"):
document.body[i] = "status open"
break
@ -927,7 +927,7 @@ def convert_collapsable(document):
def revert_collapsable(document):
" Revert collapsed insets. "
i = 0
while 1:
while True:
i = find_tokens_exact(document.body, ["\\begin_inset Box",
"\\begin_inset Branch",
"\\begin_inset CharStyle",
@ -944,7 +944,7 @@ def revert_collapsable(document):
# If, however, we find a line starting '\begin_layout'
# (_always_ present) then break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i] == "status open"):
document.body[i] = "collapsed false"
break
@ -963,7 +963,7 @@ def revert_collapsable(document):
def convert_ert(document):
" Convert ERT. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset ERT", i)
if i == -1:
break
@ -972,7 +972,7 @@ def convert_ert(document):
# If, however, we find a line starting '\begin_layout'
# (_always_ present) then break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i] == "status Open"):
document.body[i] = "status open"
break
@ -993,7 +993,7 @@ def convert_ert(document):
def revert_ert(document):
" Revert ERT. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset ERT", i)
if i == -1:
break
@ -1002,7 +1002,7 @@ def revert_ert(document):
# If, however, we find a line starting '\begin_layout'
# (_always_ present) then break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i] == "status open"):
document.body[i] = "status Open"
break
@ -1028,7 +1028,7 @@ def convert_minipage(document):
inner_pos = ["c","t","b","s"]
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Minipage", i)
if i == -1:
return
@ -1199,7 +1199,7 @@ def revert_breaks(document):
# Convert the insets
i = 0
while 1:
while True:
i = find_tokens(document.body, tokens, i)
if i == -1:
return
@ -1554,7 +1554,7 @@ def convert_frameless_box(document):
pos = ['t', 'c', 'b']
inner_pos = ['c', 't', 'b', 's']
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Frameless', i)
if i == -1:
return
@ -1733,7 +1733,7 @@ def convert_frameless_box(document):
def remove_branches(document):
" Remove branches. "
i = 0
while 1:
while True:
i = find_token(document.header, "\\branch", i)
if i == -1:
break
@ -1745,7 +1745,7 @@ def remove_branches(document):
del document.header[i:j+1]
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Branch", i)
if i == -1:
return
@ -1760,7 +1760,7 @@ def remove_branches(document):
# If, however, we find a line starting '\layout'
# (_always_ present) then break with a warning message
collapsed_found = 0
while 1:
while True:
if (document.body[i][:9] == "collapsed"):
del document.body[i]
collapsed_found = 1
@ -1821,7 +1821,7 @@ def revert_bibtopic(document):
def convert_float(document):
" Convert sideway floats. "
i = 0
while 1:
while True:
i = find_token_exact(document.body, '\\begin_inset Float', i)
if i == -1:
return
@ -1829,7 +1829,7 @@ def convert_float(document):
# If, however, we find a line starting '\begin_layout'
# (_always_ present) then break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i][:4] == "wide"):
document.body.insert(i + 1, 'sideways false')
break
@ -1843,7 +1843,7 @@ def convert_float(document):
def revert_float(document):
" Revert sideways floats. "
i = 0
while 1:
while True:
i = find_token_exact(document.body, '\\begin_inset Float', i)
if i == -1:
return
@ -1883,7 +1883,7 @@ def convert_graphics(document):
""" Add extension to documentnames of insetgraphics if necessary.
"""
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Graphics", i)
if i == -1:
return
@ -1924,7 +1924,7 @@ def convert_names(document):
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout Author", i)
if i == -1:
return
@ -2092,7 +2092,7 @@ def revert_paperpackage(document):
def convert_bullets(document):
" Convert bullets. "
i = 0
while 1:
while True:
i = find_token(document.header, "\\bullet", i)
if i == -1:
return
@ -2110,7 +2110,7 @@ def convert_bullets(document):
def revert_bullets(document):
" Revert bullets. "
i = 0
while 1:
while True:
i = find_token(document.header, "\\bullet", i)
if i == -1:
return
@ -2235,13 +2235,13 @@ def normalize_paragraph_params(document):
"\\leftindent"
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_layout', i)
if i == -1:
return
i = i + 1
while 1:
while True:
if body[i].strip() and body[i].split()[0] not in allowed_parameters:
break
@ -2282,7 +2282,7 @@ def convert_ert_paragraphs(document):
'\\emph', '\\numeric', '\\bar', '\\noun',
'\\color', '\\lang']
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset ERT', i)
if i == -1:
return
@ -2294,7 +2294,7 @@ def convert_ert_paragraphs(document):
# convert non-standard paragraphs to standard
k = i
while 1:
while True:
k = find_token(document.body, "\\begin_layout", k, j)
if k == -1:
break
@ -2314,7 +2314,7 @@ def convert_ert_paragraphs(document):
# insert an empty paragraph before each paragraph but the first
k = i
first_pagraph = 1
while 1:
while True:
k = find_token(document.body, "\\begin_layout", k, j)
if k == -1:
break
@ -2329,7 +2329,7 @@ def convert_ert_paragraphs(document):
# convert \\newline to new paragraph
k = i
while 1:
while True:
k = find_token(document.body, "\\newline", k, j)
if k == -1:
break
@ -2347,7 +2347,7 @@ def convert_ert_paragraphs(document):
def revert_ert_paragraphs(document):
" Remove double paragraph breaks. "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset ERT', i)
if i == -1:
return
@ -2359,7 +2359,7 @@ def revert_ert_paragraphs(document):
# replace paragraph breaks with \newline
k = i
while 1:
while True:
k = find_token(document.body, "\\end_layout", k, j)
l = find_token(document.body, "\\begin_layout", k, j)
if k == -1 or l == -1:
@ -2370,7 +2370,7 @@ def revert_ert_paragraphs(document):
# replace double \newlines with paragraph breaks
k = i
while 1:
while True:
k = find_token(document.body, "\\newline", k, j)
if k == -1:
break
@ -2402,7 +2402,7 @@ def convert_french(document):
# Change language in the document body
regexp = re.compile(r'^\\lang\s+frenchb')
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
break
@ -2448,7 +2448,7 @@ def convert_sgml_paragraphs(document):
return
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout SGML", i)
if i == -1:

View File

@ -61,7 +61,7 @@ def find_beginning_of_layout(lines, i):
def revert_framed(document):
"Revert framed notes. "
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
if i == -1:
@ -216,7 +216,7 @@ def revert_booktabs(document):
re_bspace = re.compile(r'\s+bottomspace="[^"]+"')
re_ispace = re.compile(r'\s+interlinespace="[^"]+"')
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Tabular", i)
if i == -1:
return
@ -470,14 +470,14 @@ implemented.'''
def revert_cs_label(document):
" Remove status flag of charstyle label. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CharStyle", i)
if i == -1:
return
# Seach for a line starting 'show_label'
# If it is not there, break with a warning message
i = i + 1
while 1:
while True:
if (document.body[i][:10] == "show_label"):
del document.body[i]
break
@ -504,7 +504,7 @@ key "argument"
This must be called after convert_commandparams.
"""
i = 0
while 1:
while True:
i = find_token(document.body, "\\bibitem", i)
if i == -1:
break
@ -592,7 +592,7 @@ def convert_commandparams(document):
# convert_bibitem()), but could be read in, so we convert it here, too.
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand", i)
if i == -1:
break
@ -680,7 +680,7 @@ def convert_commandparams(document):
def revert_commandparams(document):
regex = re.compile(r'(\S+)\s+(.+)')
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand", i)
if i == -1:
break
@ -738,7 +738,7 @@ def revert_nomenclature(document):
regex = re.compile(r'(\S+)\s+(.+)')
i = 0
use_nomencl = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand nomenclature", i)
if i == -1:
break
@ -789,7 +789,7 @@ def revert_printnomenclature(document):
regex = re.compile(r'(\S+)\s+(.+)')
i = 0
use_nomencl = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand printnomenclature", i)
if i == -1:
break
@ -855,7 +855,7 @@ def revert_esint(document):
def revert_clearpage(document):
" clearpage -> ERT "
i = 0
while 1:
while True:
i = find_token(document.body, "\\clearpage", i)
if i == -1:
break
@ -876,7 +876,7 @@ def revert_clearpage(document):
def revert_cleardoublepage(document):
" cleardoublepage -> ERT "
i = 0
while 1:
while True:
i = find_token(document.body, "\\cleardoublepage", i)
if i == -1:
break
@ -934,7 +934,7 @@ def revert_encodings(document):
def convert_caption(document):
" Convert caption layouts to caption insets. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout Caption", i)
if i == -1:
return
@ -954,7 +954,7 @@ def revert_caption(document):
" Convert caption insets to caption layouts. "
" This assumes that the text class has a caption style. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Caption", i)
if i == -1:
return
@ -1119,7 +1119,7 @@ def convert_accent(document):
re_contents = re.compile(r'^([^\s{]+)(.*)$')
re_accentedcontents = re.compile(r'^\s*{?([^{}]*)}?\s*$')
i = 0
while 1:
while True:
i = find_re(document.body, re_wholeinset, i)
if i == -1:
return
@ -1452,13 +1452,13 @@ def revert_utf8plain(document):
def revert_beamer_alert(document):
" Revert beamer's \\alert inset back to ERT. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CharStyle Alert", i)
if i == -1:
return
document.body[i] = "\\begin_inset ERT"
i = i + 1
while 1:
while True:
if (document.body[i][:13] == "\\begin_layout"):
# Insert the \alert command
document.body[i + 1] = "\\alert{" + document.body[i + 1] + '}'
@ -1471,13 +1471,13 @@ def revert_beamer_alert(document):
def revert_beamer_structure(document):
" Revert beamer's \\structure inset back to ERT. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CharStyle Structure", i)
if i == -1:
return
document.body[i] = "\\begin_inset ERT"
i = i + 1
while 1:
while True:
if (document.body[i][:13] == "\\begin_layout"):
document.body[i + 1] = "\\structure{" + document.body[i + 1] + '}'
break
@ -1550,7 +1550,7 @@ def revert_cv_textclass(document):
def convert_graphics_rotation(document):
" add scaleBeforeRotation graphics parameter. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Graphics", i)
if i == -1:
return
@ -1572,7 +1572,7 @@ def convert_graphics_rotation(document):
def revert_graphics_rotation(document):
" remove scaleBeforeRotation graphics parameter. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Graphics", i)
if i == -1:
return

View File

@ -972,7 +972,7 @@ def revert_pdf_options(document):
def remove_inzip_options(document):
"Remove inzipName and embed options from the Graphics inset"
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Graphics", i)
if i == -1:
return
@ -1000,7 +1000,7 @@ def convert_inset_command(document):
LatexCommand cmd
"""
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset LatexCommand", i)
if i == -1:
return
@ -1039,7 +1039,7 @@ def revert_inset_command(document):
will not be able to recognize. Not sure what to do about that.
"""
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CommandInset", i)
if i == -1:
return
@ -1262,7 +1262,7 @@ def revert_japanese_encoding(document):
def revert_inset_info(document):
'Replace info inset with its content'
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Info', i)
if i == -1:
return
@ -1743,7 +1743,7 @@ def convert_serbocroatian(document):
def convert_framed_notes(document):
"Convert framed notes to boxes. "
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Note Framed", "\\begin_inset Note Shaded"], i)
if i == -1:
return
@ -1820,7 +1820,7 @@ def revert_colsep(document):
def revert_framed_notes(document):
"Revert framed boxes to notes. "
i = 0
while 1:
while True:
i = find_tokens(document.body, ["\\begin_inset Box Framed", "\\begin_inset Box Shaded"], i)
if i == -1:
@ -1938,7 +1938,7 @@ def revert_nocite_key(body, start, end):
def revert_nocite(document):
"Revert LatexCommand nocite to ERT"
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CommandInset citation", i)
if i == -1:
return
@ -2056,7 +2056,7 @@ def revert_serbianlatin(document):
def revert_rotfloat(document):
" Revert sideways custom floats. "
i = 0
while 1:
while True:
# whitespace intended (exclude \\begin_inset FloatList)
i = find_token(document.body, "\\begin_inset Float ", i)
if i == -1:
@ -2119,7 +2119,7 @@ def revert_rotfloat(document):
def revert_widesideways(document):
" Revert wide sideways floats. "
i = 0
while 1:
while True:
# whitespace intended (exclude \\begin_inset FloatList)
i = find_token(document.body, '\\begin_inset Float ', i)
if i == -1:
@ -2171,7 +2171,7 @@ def revert_widesideways(document):
def revert_inset_embedding(document, type):
' Remove embed tag from certain type of insets'
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset %s" % type, i)
if i == -1:
return
@ -2196,7 +2196,7 @@ def revert_external_embedding(document):
def convert_subfig(document):
" Convert subfigures to subfloats. "
i = 0
while 1:
while True:
addedLines = 0
i = find_token(document.body, '\\begin_inset Graphics', i)
if i == -1:
@ -2236,7 +2236,7 @@ def convert_subfig(document):
def revert_subfig(document):
" Revert subfloats. "
i = 0
while 1:
while True:
# whitespace intended (exclude \\begin_inset FloatList)
i = find_tokens(document.body, ['\\begin_inset Float ', '\\begin_inset Wrap'], i)
if i == -1:
@ -2740,7 +2740,7 @@ def convert_japanese_plain(document):
def revert_pdfpages(document):
' Revert pdfpages external inset to ERT '
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset External", i)
if i == -1:
return
@ -2842,7 +2842,7 @@ def revert_master(document):
def revert_graphics_group(document):
' Revert group information from graphics insets '
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Graphics", i)
if i == -1:
return
@ -2872,7 +2872,7 @@ def update_apa_styles(document):
"Paragraph*": "Paragraph",
"Subparagraph*": "Subparagraph"}
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout", i)
if i == -1:
return

View File

@ -916,7 +916,7 @@ def merge_gbrief(document):
"Verteiler": "cc",
"Gruss": "Closing"}
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_layout", i)
if i == -1:
break
@ -1332,7 +1332,7 @@ def revert_lyx_version(document):
pass
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Info', i)
if i == -1:
return
@ -1481,7 +1481,7 @@ def revert_align_decimal(document):
def convert_optarg(document):
" Convert \\begin_inset OptArg to \\begin_inset Argument "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset OptArg', i)
if i == -1:
return
@ -1492,7 +1492,7 @@ def convert_optarg(document):
def revert_argument(document):
" Convert \\begin_inset Argument to \\begin_inset OptArg "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Argument', i)
if i == -1:
return
@ -1503,7 +1503,7 @@ def revert_argument(document):
def revert_makebox(document):
" Convert \\makebox to TeX code "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Box', i)
if i == -1:
break
@ -1550,7 +1550,7 @@ def revert_makebox(document):
def convert_use_makebox(document):
" Adds use_makebox option for boxes "
i = 0
while 1:
while True:
i = find_token(document.body, '\\begin_inset Box', i)
if i == -1:
return
@ -1668,7 +1668,7 @@ def revert_nameref(document):
for cmd in cmds:
i = 0
oldcmd = "LatexCommand " + cmd
while 1:
while True:
# It seems better to look for this, as most of the reference
# insets won't be ones we care about.
i = find_token(document.body, oldcmd, i)
@ -1705,7 +1705,7 @@ def revert_nameref(document):
def remove_Nameref(document):
" Convert Nameref commands to nameref commands "
i = 0
while 1:
while True:
# It seems better to look for this, as most of the reference
# insets won't be ones we care about.
i = find_token(document.body, "LatexCommand Nameref" , i)
@ -1947,7 +1947,7 @@ def convert_rule(document):
def revert_rule(document):
" Revert line insets to Tex code "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset CommandInset line" , i)
if i == -1:
return
@ -2349,7 +2349,7 @@ def revert_script(document):
" Convert subscript/superscript inset to TeX code "
i = 0
foundsubscript = False
while 1:
while True:
i = find_token(document.body, '\\begin_inset script', i)
if i == -1:
break

View File

@ -838,7 +838,7 @@ def revert_verbatim(document, starred = False):
'begin{%s}' % (latex_name),
'\\end_layout', '', '\\begin_layout Plain Layout', '']
while 1:
while True:
i = find_token(document.body, "\\begin_layout %s" % (layout_name), i)
if i == -1:
return
@ -850,7 +850,7 @@ def revert_verbatim(document, starred = False):
continue
# delete all line breaks insets (there are no other insets)
l = i
while 1:
while True:
n = find_token(document.body, "\\begin_inset Newline newline", l, j)
if n == -1:
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):
" Revert native TIPA insets to mathed or ERT. "
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset IPA", i)
if i == -1:
return

View File

@ -153,7 +153,7 @@ def convert_separator(document):
}
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_deeper", i)
if i == -1:
break
@ -175,7 +175,7 @@ def convert_separator(document):
i = i + 1
i = 0
while 1:
while True:
i = find_token(document.body, "\\align", i)
if i == -1:
break
@ -208,7 +208,7 @@ def convert_separator(document):
regexp = re.compile(r'^\\begin_layout (?:(-*)|(\s*))(Separator|EndOfSlide)(?:(-*)|(\s*))$', re.IGNORECASE)
i = 0
while 1:
while True:
i = find_re(document.body, regexp, i)
if i == -1:
return
@ -249,7 +249,7 @@ def revert_separator(document):
"", "\\end_inset", ""]
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Separator", i)
if i == -1:
return
@ -341,7 +341,7 @@ def convert_parbreak(document):
"""
parbreakinset = "\\begin_inset Separator parbreak"
i = 0
while 1:
while True:
i = find_token(document.body, parbreakinset, i)
if i == -1:
return
@ -366,7 +366,7 @@ def revert_parbreak(document):
Revert latexpar separators to parbreak separators.
"""
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset Separator latexpar", i)
if i == -1:
return

View File

@ -78,7 +78,7 @@ def revert_microtype(document):
def convert_dateinset(document):
' Convert date external inset to ERT '
i = 0
while 1:
while True:
i = find_token(document.body, "\\begin_inset External", i)
if i == -1:
return