> Since the
> old definition did not honour the font size lyx2lyx needs to change the
> font of all existing \lyxlines to normal size. This is not difficult to do,
> and preserves the formatting of existing documents. If users don't like
> that they can still reset the font afterwards.

OK, attached is an updated patch that does this in lyx2lyx. OK?
(I tested it very carefully and it works, but note that this is my first conatct with python so I may not follow the formatting guidelines.)

regards Uwe
Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py	(revision 16941)
+++ lib/lyx2lyx/lyx_1_5.py	(working copy)
@@ -664,7 +664,7 @@
 
 
 def revert_clearpage(document):
-    " clearpage -> ERT"
+    " clearpage -> ERT "
     i = 0
     while 1:
         i = find_token(document.body, "\\clearpage", i)
@@ -685,7 +685,7 @@
 
 
 def revert_cleardoublepage(document):
-    " cleardoublepage -> ERT"
+    " cleardoublepage -> ERT "
     i = 0
     while 1:
         i = find_token(document.body, "\\cleardoublepage", i)
@@ -705,6 +705,23 @@
     i = i + 1
 
 
+def convert_lyxline(document):
+    " more stable lyxline definition -> old lyxline definition"
+    fontsizes = ["tiny", "scriptsize", "footnotesize", "small", "normalsize",
+             "large", "Large", "LARGE", "huge", "Huge"]
+    for n in range(0, len(fontsizes)-1):
+        i = 0
+        k = 0
+        while 1:
+            i = find_token(document.body, "\\size " + fontsizes[n], i)
+            k = find_token(document.body, "\\lyxline",i)
+            if (i != -1 and k == i+2):
+                document.body[i:i+1] = []
+            else:
+                break
+        i = i + 1
+
+
 def revert_encodings(document):
     " Set new encodings to auto. "
     encodings = ["8859-6", "8859-8", "cp437", "cp437de", "cp850", "cp852",
@@ -735,7 +752,7 @@
            [253, []],
            [254, [convert_esint]],
            [255, []],
-           [256, []]]
+           [256, [convert_lyxline]]]
 
 revert =  [[255, [revert_encodings]],
            [254, [revert_clearpage, revert_cleardoublepage]],
Index: src/lyx_sty.C
===================================================================
--- src/lyx_sty.C	(revision 16941)
+++ src/lyx_sty.C	(working copy)
@@ -26,9 +26,9 @@
 	"[EMAIL PROTECTED]";
 
 string const lyxline_def =
-	"\\newcommand{\\lyxline}[1]{\n"
-	"  {#1 \\vspace{1ex} \\hrule width \\columnwidth \\vspace{1ex}}\n"
-	"}";
+	"\\newcommand{\\lyxline}[1][1pt]{%\n"
+	"  \\par\\noindent%\n"
+	"  \\rule[.5ex]{\\linewidth}{#1}\\par}";
 
 string const noun_def = "\\newcommand{\\noun}[1]{\\textsc{#1}}";
 

Reply via email to