From 2f22c881ee470bed4366450848b99ad7d1a0f581 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Wed, 26 Dec 2007 20:15:31 +0000 Subject: [PATCH] Routine for adding modules to the list of modules. Preparatory for AMS modularization. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22318 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_1_6.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index edae58d70f..cf6ac5a454 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -36,6 +36,26 @@ def wrap_into_ert(string, src, dst): return string.replace(src, '\n\\begin_inset ERT\nstatus collapsed\n\\begin_layout Standard\n' + dst + '\n\\end_layout\n\\end_inset\n') +def add_module(module): + i = find_token(document.header, "\\begin_modules", 0) + if i == -1: + #No modules yet included + i = find_token(document.header, "\\textclass", 0) + if i == -1: + document.warning("Malformed LyX document: No \\textclass!!") + return + modinfo = ["\\begin_modules", module, "\\end_modules"] + document.header[i + 1: i + 1] = modinfo + return + j = find_token(document.header, "\\end_modules", i) + if j == -1: + document.warning("Malformed LyX document: No \\end_modules.") + return + k = find_token(document.header, module, i) + if k != -1 and k < j: + return + document.header.insert(i + 1, module) + #################################################################### @@ -921,7 +941,7 @@ def revert_slash(document): '\\begin_inset ERT\nstatus collapsed\n\n' \ '\\begin_layout Standard\n\n\n\\backslash\n' \ 'slash{}\n\\end_layout\n\n\\end_inset\n\n') - + def revert_nobreakdash(document): 'Revert \\SpecialChar \\nobreakdash- to ERT' -- 2.39.2