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
# toc_par = []
# i = 0
-# while 1:
+# while True:
# i = find_tokens(self.body, sections, i)
# if i == -1:
# break
" 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
" 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
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
" Update inset Label."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, '\\begin_inset Label', i)
if i == -1:
return
" Update inset LatexDel."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, '\\begin_inset LatexDel', i)
if i == -1:
return
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
" Remove empty insets."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, '\\begin_inset ', i)
if i == -1:
break
" Remove formula latex."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, '\\latex formula_latex ', i)
if i == -1:
break
" Update latex accent insets."
body = document.body
i = 1
- while 1:
+ while True:
i = find_token(body, '\\i ', i)
if i == -1:
return
" 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
body = document.body
i = 0
- while 1:
+ while True:
i = find_token(body, '\\begin_inset Latex', i)
if i == -1:
return
body = document.body
i = 0
- while 1:
+ while True:
i = find_token(body, '\\layout', i)
if i == -1:
return
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
" Replace protected separator. "
lines = document.body
i=0
- while 1:
+ while True:
i = find_token(lines, "\\protected_separator", i)
if i == -1:
break
" 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:
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
" 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:
for margin in margins:
i = 0
- while 1:
+ while True:
i = find_token(lines, margin, i)
if i == -1:
break
lines = document.body
# play safe, clean empty lines
- while 1:
+ while True:
if lines[i]:
break
del lines[i]
del lines[i:j + 1]
# play safe, clean empty lines
- while 1:
+ while True:
if lines[i]:
break
del lines[i]
" Update reference inset. "
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, '\\begin_inset LatexCommand', i)
if i == -1:
return
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
" 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
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
" 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
lines = document.body
i = 0
flag = 0
- while 1:
+ while True:
i = find_re(lines, pextra_type2_rexp, i)
if i == -1:
break
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"):
""]
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"],
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:
# Delete remaining "\latex xxx" tokens
i = 0
- while 1:
+ while True:
i = find_token(lines, "\\latex ", i)
if i == -1:
break
" 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
" Combine ERT paragraphs."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, "\\begin_inset ERT", i)
if i == -1:
break
" Remove figinset."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, "\\begin_inset Figure", i)
if i == -1:
break
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
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
" 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
" 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
" Change info inset."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, "\\begin_inset Info", i)
if i == -1:
break
" Change inset Graphics."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, "\\begin_inset Graphics", i)
if i == -1:
break
" Change tabular."
lines = document.body
i = 0
- while 1:
+ while True:
i = find_token(lines, "<column", i)
if i == -1:
break
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
" \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
"\\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
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
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
" 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
" 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
" Convert \\layout comment"
i = 0
comment = "\\layout Comment"
- while 1:
+ while True:
i = find_token(document.body, comment, i)
if i == -1:
return
'\\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:
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:
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)
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:
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
def layout2begin_layout(document):
" \layout -> \begin_layout "
i = 0
- while 1:
+ while True:
i = find_token(document.body, '\\layout', i)
if i == -1:
return
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
" 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
" 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
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
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)
" 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
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",
" 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
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",
# 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
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",
# 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
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
# 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
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
# 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
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
# Convert the insets
i = 0
- while 1:
+ while True:
i = find_tokens(document.body, tokens, i)
if i == -1:
return
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
def remove_branches(document):
" Remove branches. "
i = 0
- while 1:
+ while True:
i = find_token(document.header, "\\branch", i)
if i == -1:
break
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
# 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
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
# 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
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
""" 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
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_layout Author", i)
if i == -1:
return
def convert_bullets(document):
" Convert bullets. "
i = 0
- while 1:
+ while True:
i = find_token(document.header, "\\bullet", i)
if i == -1:
return
def revert_bullets(document):
" Revert bullets. "
i = 0
- while 1:
+ while True:
i = find_token(document.header, "\\bullet", i)
if i == -1:
return
"\\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
'\\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
# 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
# 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
# convert \\newline to new paragraph
k = i
- while 1:
+ while True:
k = find_token(document.body, "\\newline", k, j)
if k == -1:
break
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
# 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:
# replace double \newlines with paragraph breaks
k = i
- while 1:
+ while True:
k = find_token(document.body, "\\newline", k, j)
if k == -1:
break
# 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
return
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_layout SGML", i)
if i == -1:
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:
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
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
This must be called after convert_commandparams.
"""
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\bibitem", i)
if i == -1:
break
# 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
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
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
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
def revert_clearpage(document):
" clearpage -> ERT "
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\clearpage", i)
if i == -1:
break
def revert_cleardoublepage(document):
" cleardoublepage -> ERT "
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\cleardoublepage", i)
if i == -1:
break
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
" 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
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
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] + '}'
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
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
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
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
LatexCommand cmd
"""
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_inset LatexCommand", i)
if i == -1:
return
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
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
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
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:
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
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:
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:
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
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:
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:
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
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
"Paragraph*": "Paragraph",
"Subparagraph*": "Subparagraph"}
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_layout", i)
if i == -1:
return
"Verteiler": "cc",
"Gruss": "Closing"}
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_layout", i)
if i == -1:
break
pass
i = 0
- while 1:
+ while True:
i = find_token(document.body, '\\begin_inset Info', i)
if i == -1:
return
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
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
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
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
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)
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)
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
" 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
'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
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)
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
}
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_deeper", i)
if i == -1:
break
i = i + 1
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\align", i)
if i == -1:
break
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
"", "\\end_inset", ""]
i = 0
- while 1:
+ while True:
i = find_token(document.body, "\\begin_inset Separator", i)
if i == -1:
return
"""
parbreakinset = "\\begin_inset Separator parbreak"
i = 0
- while 1:
+ while True:
i = find_token(document.body, parbreakinset, i)
if i == -1:
return
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
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