X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Flyx2lyx%2Fparser_tools.py;h=e32ac5dc4fca7d879a933e8f9c0d7550aa800716;hb=b33b352171813f99a8fbf8e8b6f6c445025d94f8;hp=cfc6a75433fe5ccd5ffda0dfdd668ade7ace7e78;hpb=1246a70abd5e5eec6057daa3b35f7c626270cf4d;p=lyx.git diff --git a/lib/lyx2lyx/parser_tools.py b/lib/lyx2lyx/parser_tools.py index cfc6a75433..e32ac5dc4f 100644 --- a/lib/lyx2lyx/parser_tools.py +++ b/lib/lyx2lyx/parser_tools.py @@ -15,7 +15,7 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ''' @@ -307,7 +307,7 @@ def get_quoted_value(lines, token, start, end = 0, default = ""): def get_option_value(line, option): - rx = option + '\s*=\s*"([^"+])"' + rx = option + '\s*=\s*"([^"]+)"' rx = re.compile(rx) m = rx.search(line) if not m: @@ -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