]> git.lyx.org Git - lyx.git/commitdiff
new \lyxline difinition, fixes also bug 1988:
authorUwe Stöhr <uwestoehr@web.de>
Wed, 31 Jan 2007 01:15:14 +0000 (01:15 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Wed, 31 Jan 2007 01:15:14 +0000 (01:15 +0000)
http://bugzilla.lyx.org/show_bug.cgi?id=1988

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16962 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_1_5.py
src/lyx_sty.C

index 8f4d453423bc7ca5c17a19a21edf90ca9b7cd05a..9a9e480d3e438f9855fcc138f0bb302e4caffe07 100644 (file)
@@ -668,7 +668,7 @@ def revert_esint(document):
 
 
 def revert_clearpage(document):
-    " clearpage -> ERT"
+    " clearpage -> ERT "
     i = 0
     while 1:
         i = find_token(document.body, "\\clearpage", i)
@@ -689,7 +689,7 @@ def revert_clearpage(document):
 
 
 def revert_cleardoublepage(document):
-    " cleardoublepage -> ERT"
+    " cleardoublepage -> ERT "
     i = 0
     while 1:
         i = find_token(document.body, "\\cleardoublepage", i)
@@ -709,6 +709,28 @@ def revert_cleardoublepage(document):
     i = i + 1
 
 
+def convert_lyxline(document):
+    " remove fontsize commands for \lyxline "
+    # The problematic is: The old \lyxline definition doesn't handle the fontsize
+    # to change the line thickness. The new definiton does this so that imported
+    # \lyxlines would have a different line thickness. The eventual fontsize command
+    # before \lyxline is therefore removed to get the same output.
+    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)
+            # the corresponding fontsize command is always 2 lines before the \lyxline
+            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",
@@ -833,7 +855,7 @@ convert = [[246, []],
            [254, [convert_esint]],
            [255, []],
            [256, []],
-           [257, [convert_caption]]]
+           [257, [convert_caption, convert_lyxline]]]
 
 revert =  [[256, [revert_caption]],
            [255, [revert_encodings]],
index b529c5d3601300e04b4cd53759b26d7a063b33b7..9e7d56fdbf4e525438c5c87235af49276325491b 100644 (file)
@@ -26,9 +26,9 @@ string const lyx_def =
        "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}";
 
 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}}";