]> git.lyx.org Git - features.git/commitdiff
Give to get value a default argument,
authorJosé Matox <jamatos@lyx.org>
Mon, 7 Aug 2006 13:59:01 +0000 (13:59 +0000)
committerJosé Matox <jamatos@lyx.org>
Mon, 7 Aug 2006 13:59:01 +0000 (13:59 +0000)
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

lib/lyx2lyx/parser_tools.py

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