From 883520c1977445335941e89f1b0b7c2f6804c530 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Thu, 4 Nov 2010 17:42:47 +0000 Subject: [PATCH] Make this routine more pythonic. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36085 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 79f9f1be2f..9871d6a4fe 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1633,16 +1633,10 @@ def remove_Nameref(document): def revert_mathrsfs(document): " Load mathrsfs if \mathrsfs us use in the document " i = 0 - end = len(document.body) - 1 - while True: - j = document.body[i].find("\\mathscr{") - if j != -1: - add_to_preamble(document, ["% this command was inserted by lyx2lyx"]) - add_to_preamble(document, ["\\usepackage{mathrsfs}"]) - break - if i == end: - break - i += 1 + for line in document.body: + if line.find("\\mathscr{") != -1: + add_to_preamble(document, ["% lyx2lyx mathrsfs addition", "\\usepackage{mathrsfs}"]) + return def convert_flexnames(document): -- 2.39.5