Give to get value a default argument,

if the value is not found the default value is returned.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14556 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2006-08-07 13:59:01 +00:00
parent b16eb1d169
commit de0c8aef7c

View File

@ -141,8 +141,8 @@ def find_tokens_backwards(lines, tokens, start):
return -1 return -1
def get_value(lines, token, start, end = 0): def get_value(lines, token, start, end = 0, default = ""):
""" get_value(lines, token, start[, end]) -> list of strings """ get_value(lines, token, start[[, end], default]) -> list of strings
Return tokens after token for the first line, in lines, where Return tokens after token for the first line, in lines, where
token is the first element.""" token is the first element."""
@ -153,7 +153,7 @@ def get_value(lines, token, start, end = 0):
if len(lines[i].split()) > 1: if len(lines[i].split()) > 1:
return lines[i].split()[1] return lines[i].split()[1]
else: else:
return "" return default
def del_token(lines, token, start, end): def del_token(lines, token, start, end):