new \lyxline difinition, fixes also bug 1988:

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
This commit is contained in:
Uwe Stöhr 2007-01-31 01:15:14 +00:00
parent 66af88d4fc
commit 9f871ade65
2 changed files with 28 additions and 6 deletions

View 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]],

View 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}}";