mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 18:52:46 +00:00
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:
parent
fb46e00fd5
commit
3202c8a9f3
@ -22,13 +22,14 @@ import string
|
|||||||
from parser_tools import find_token
|
from parser_tools import find_token
|
||||||
from unicode_symbols import unicode_reps
|
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):
|
def add_to_preamble(document, text):
|
||||||
""" Add text to the preamble if it is not already there.
|
""" Add text to the preamble if it is not already there.
|
||||||
Only the first line is checked!"""
|
Only the first line is checked!"""
|
||||||
|
|
||||||
if not type(text) is list:
|
if not type(text) is list:
|
||||||
document.warning("You should pass a list to add_to_preamble!")
|
|
||||||
# split on \n just in case
|
# split on \n just in case
|
||||||
# it'll give us the one element list we want
|
# it'll give us the one element list we want
|
||||||
# if there's no \n, too
|
# 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"""
|
""" Insert text to the preamble at a given line"""
|
||||||
|
|
||||||
if not type(text) is list:
|
if not type(text) is list:
|
||||||
document.warning("You should pass a list to insert_to_preamble!")
|
|
||||||
# split on \n just in case
|
# split on \n just in case
|
||||||
# it'll give us the one element list we want
|
# it'll give us the one element list we want
|
||||||
# if there's no \n, too
|
# if there's no \n, too
|
||||||
|
Loading…
Reference in New Issue
Block a user