insert_to_preamble likes lists of lines.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36132 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-05 17:39:21 +00:00
parent f3ae1e2641
commit 86cff08734

View File

@ -320,12 +320,11 @@ def revert_backgroundcolor(document):
red = hex2ratio(colorcode[1:3]) red = hex2ratio(colorcode[1:3])
green = hex2ratio(colorcode[3:5]) green = hex2ratio(colorcode[3:5])
blue = hex2ratio(colorcode[5:7]) blue = hex2ratio(colorcode[5:7])
insert_to_preamble(0, document, insert_to_preamble(0, document, \
'% Commands inserted by lyx2lyx to set the background color\n' ['% Commands inserted by lyx2lyx to set the background color',
+ '\\@ifundefined{definecolor}{\\usepackage{color}}{}\n' '\\@ifundefined{definecolor}{\\usepackage{color}}{}',
+ '\\definecolor{page_backgroundcolor}{rgb}{' '\\definecolor{page_backgroundcolor}{rgb}{' + red + ',' + green + ',' + blue + '}',
+ red + ',' + green + ',' + blue + '}\n' '\\pagecolor{page_backgroundcolor}'])
+ '\\pagecolor{page_backgroundcolor}\n')
def revert_splitindex(document): def revert_splitindex(document):
@ -488,10 +487,10 @@ def revert_strikeout(document):
changed = revert_font_attrs(document.body, "\\uwave", "\\uwave") or changed changed = revert_font_attrs(document.body, "\\uwave", "\\uwave") or changed
changed = revert_font_attrs(document.body, "\\strikeout", "\\sout") or changed changed = revert_font_attrs(document.body, "\\strikeout", "\\sout") or changed
if changed == True: if changed == True:
insert_to_preamble(0, document, insert_to_preamble(0, document, \
'% Commands inserted by lyx2lyx for proper underlining\n' ['% Commands inserted by lyx2lyx for proper underlining',
+ '\\PassOptionsToPackage{normalem}{ulem}\n' '\\PassOptionsToPackage{normalem}{ulem}',
+ '\\usepackage{ulem}\n') '\\usepackage{ulem}'])
def revert_ulinelatex(document): def revert_ulinelatex(document):
@ -499,14 +498,14 @@ def revert_ulinelatex(document):
i = find_token(document.body, '\\bar under', 0) i = find_token(document.body, '\\bar under', 0)
if i == -1: if i == -1:
return return
insert_to_preamble(0, document, insert_to_preamble(0, document,\
'% Commands inserted by lyx2lyx for proper underlining\n' ['% Commands inserted by lyx2lyx for proper underlining',
+ '\\PassOptionsToPackage{normalem}{ulem}\n' '\\PassOptionsToPackage{normalem}{ulem}',
+ '\\usepackage{ulem}\n' '\\usepackage{ulem}',
+ '\\let\\cite@rig\\cite\n' '\\let\\cite@rig\\cite',
+ '\\newcommand{\\b@xcite}[2][\\%]{\\def\\def@pt{\\%}\\def\\pas@pt{#1}\n' '\\newcommand{\\b@xcite}[2][\\%]{\\def\\def@pt{\\%}\\def\\pas@pt{#1}',
+ ' \\mbox{\\ifx\\def@pt\\pas@pt\\cite@rig{#2}\\else\\cite@rig[#1]{#2}\\fi}}\n' ' \\mbox{\\ifx\\def@pt\\pas@pt\\cite@rig{#2}\\else\\cite@rig[#1]{#2}\\fi}}',
+ '\\renewcommand{\\underbar}[1]{{\\let\\cite\\b@xcite\\uline{#1}}}\n') '\\renewcommand{\\underbar}[1]{{\\let\\cite\\b@xcite\\uline{#1}}}'])
def revert_custom_processors(document): def revert_custom_processors(document):