]> git.lyx.org Git - lyx.git/commitdiff
This routine simply does not do what it claims to do in the comment. And
authorRichard Heck <rgheck@comcast.net>
Fri, 5 Nov 2010 01:20:50 +0000 (01:20 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 5 Nov 2010 01:20:50 +0000 (01:20 +0000)
I cannot see why one would want to do what it actually does. The way it
is used in the code assumes it behaves as it now does, so far as I can
see. In particular, if we find:
option "some string"
with the call:
get_value(document.body, "option", i)
then this will return '"some'.

Someone please tell me if I am wrong.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36099 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/parser_tools.py

index 8db73c615a62af449561467fb127b841454e15b4..5a88da238586f78570a928a5caeca67d46565ea0 100644 (file)
@@ -143,18 +143,20 @@ def find_tokens_backwards(lines, tokens, start):
 
 
 def get_value(lines, token, start, end = 0, default = ""):
-    """ get_value(lines, token, start[[, end], default]) -> list of strings
+    """ get_value(lines, token, start[[, end], default]) -> string
 
-    Return tokens after token for the first line, in lines, where
-    token is the first element."""
+    Find the next line that looks like:
+      token followed by other stuff
+    Returns "followed by other stuff".
+    """
 
     i = find_token_exact(lines, token, start, end)
     if i == -1:
         return default
-    if len(lines[i].split()) > 1:
-        return lines[i].split()[1]
-    else:
-        return default
+    l = lines[i].split(None, 1)
+    if len(l) > 1:
+        return l[1]
+    return default
 
 
 def get_value_string(lines, token, start, end = 0, trim = False, default = ""):
@@ -170,7 +172,7 @@ def get_value_string(lines, token, start, end = 0, trim = False, default = ""):
     if len(lines[i].split()) > 1:
         for k in range (0, len(lines[i])):
             if lines[i][k] == ' ':
-                if trim ==False:
+                if trim == False:
                     return lines[i][k+1:len(lines[i])]
                 else:
                     return lines[i][k+2:len(lines[i])-1]