I forgot that the single line case is really OK.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36108 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-11-05 14:50:27 +00:00
parent fb46e00fd5
commit 3202c8a9f3

View File

@ -22,13 +22,14 @@ import string
from parser_tools import find_token
from unicode_symbols import unicode_reps
# Note that text can be either a list of lines or a single line.
# This will accept either a list of lines or a single line.
# But it is bad practice to pass something with embedded
# newlines, though we will handle that.
def add_to_preamble(document, text):
""" Add text to the preamble if it is not already there.
Only the first line is checked!"""
if not type(text) is list:
document.warning("You should pass a list to add_to_preamble!")
# split on \n just in case
# it'll give us the one element list we want
# if there's no \n, too
@ -46,7 +47,6 @@ def insert_to_preamble(index, document, text):
""" Insert text to the preamble at a given line"""
if not type(text) is list:
document.warning("You should pass a list to insert_to_preamble!")
# split on \n just in case
# it'll give us the one element list we want
# if there's no \n, too