Slight improvement and a comment.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34892 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-07-13 21:10:26 +00:00
parent 92f1fe3f1f
commit af93776127

View File

@ -40,12 +40,16 @@ def find_end_of_inset(lines, i):
return find_end_of(lines, i, "\\begin_inset", "\\end_inset")
# Note that text can be either a list of lines or a single line.
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:
text = [text]
# split on \n just in case
# it'll give us the one element list we want
# if there's no \n, too
text = text.split('\n')
if find_token(document.preamble, text[0], 0) != -1:
return