From 6628aec30c57a86c794b1403a38f95c5250426bc Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 5 Nov 2010 01:20:50 +0000 Subject: [PATCH] This routine simply does not do what it claims to do in the comment. And 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 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index 8db73c615a..5a88da2385 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -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] -- 2.39.5