]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_1_4.py
Whitespace, only whitespace. s/ +$//
[lyx.git] / lib / lyx2lyx / lyx_1_4.py
index 125086ee275355f8bd16f2d005fbc4749c211d56..da3480161229fc1e342da1a01251d905e06d95ce 100644 (file)
@@ -518,12 +518,24 @@ def revert_end_document(file):
 #
 #\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")
@@ -585,21 +597,21 @@ def convert_breaks(file):
 
         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
 
 
 ##