X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Fparser_tools.py;h=e32ac5dc4fca7d879a933e8f9c0d7550aa800716;hb=b33b352171813f99a8fbf8e8b6f6c445025d94f8;hp=31948fe30c90d6f25b540b7bf6585c7e20d439b0;hpb=3da2eb41aa617f68b95d46c6d3c6f011d5dd8c77;p=lyx.git diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index 31948fe30c..e32ac5dc4f 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -315,6 +315,15 @@ def get_option_value(line, option): return m.group(1) +def set_option_value(line, option, value): + rx = '(' + option + '\s*=\s*")[^"]+"' + rx = re.compile(rx) + m = rx.search(line) + if not m: + return line + return re.sub(rx, '\g<1>' + value + '"', line) + + def del_token(lines, token, start, end = 0): """ del_token(lines, token, start, end) -> int