From f4773414741212cfc2526b38a5f8d32b0f9c7ebe Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 5 Nov 2010 15:01:42 +0000 Subject: [PATCH] Use str2bool. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36111 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 85bb6e6915..61a5809119 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -439,8 +439,7 @@ def revert_subindex(document): if i == -1: document.warning("Malformed LyX document: Missing \\use_indices.") return - indices = get_value(document.header, "\\use_indices", i) - useindices = (indices == "true") + useindices = str2bool(get_value(document.header, "\\use_indices", i)) i = 0 while True: i = find_token(document.body, "\\begin_inset CommandInset index_print", i) @@ -466,8 +465,7 @@ def revert_printindexall(document): if i == -1: document.warning("Malformed LyX document: Missing \\use_indices.") return - indices = get_value(document.header, "\\use_indices", i) - useindices = (indices == "true") + useindices = str2bool(get_value(document.header, "\\use_indices", i)) i = 0 while True: i = find_token(document.body, "\\begin_inset CommandInset index_print", i) @@ -826,8 +824,8 @@ def revert_suppress_date(document): return # remove the preamble line and write to the preamble # when suppress_date was true - date = get_value(document.header, "\\suppress_date", i) - if date == "true": + date = str2bool(get_value(document.header, "\\suppress_date", i)) + if date: add_to_preamble(document, ["% this command was inserted by lyx2lyx"]) add_to_preamble(document, ["\\date{}"]) del document.header[i] @@ -1036,8 +1034,8 @@ def convert_math_output(document): m = rgx.match(document.header[i]) newval = "0" # MathML if m: - val = m.group(1) - if val != "true": + val = str2bool(m.group(1)) + if not val: newval = "2" # Images else: document.warning("Can't match " + document.header[i])