#
#\end_layout
def convert_breaks(file):
+ par_params = ('added_space_bottom', 'added_space_top', 'align',
+ 'labelwidthstring', 'line_bottom', 'line_top', 'noindent',
+ 'pagebreak_bottom', 'pagebreak_top', 'paragraph_spacing',
+ 'start_of_appendix')
i = 0
while 1:
i = find_token(file.body, "\\begin_layout", i)
if i == -1:
return
i = i + 1
+
+ # Merge all paragraph parameters into a single line
+ # We cannot check for '\\' only because paragraphs may start e.g.
+ # with '\\backslash'
+ while file.body[i + 1][:1] == '\\' and split(file.body[i + 1][1:])[0] in par_params:
+ file.body[i] = file.body[i + 1] + ' ' + file.body[i]
+ del file.body[i+1]
+
line_top = find(file.body[i],"\\line_top")
line_bot = find(file.body[i],"\\line_bottom")
pb_top = find(file.body[i],"\\pagebreak_top")
if pb_bot !=-1 or line_bot != -1 or vspace_bot != -1:
- paragraph_bellow = ['','\\begin_layout Standard','','']
+ paragraph_below = ['','\\begin_layout Standard','','']
if line_bot != -1:
- paragraph_bellow.extend(['\\lyxline ',''])
+ paragraph_below.extend(['\\lyxline ',''])
if vspace_bot != -1:
- paragraph_bellow.extend(['\\begin_inset VSpace ' + vspace_bot_value,'\\end_inset','',''])
+ paragraph_below.extend(['\\begin_inset VSpace ' + vspace_bot_value,'\\end_inset','',''])
if pb_bot != -1:
- paragraph_bellow.extend(['\\newpage ',''])
+ paragraph_below.extend(['\\newpage ',''])
- paragraph_bellow.extend(['\\end_layout',''])
+ paragraph_below.extend(['\\end_layout',''])
#inset new paragraph above the current paragraph
- file.body[k + 1: k + 1] = paragraph_bellow
+ file.body[k + 1: k + 1] = paragraph_below
##