On 05/26/2012 01:00 PM, Uwe Stöhr wrote:
The branch, master, has been updated.
- Log -
commit 7b680058756b4d80e741faa4bdafe894bc06360d
Author: Uwe Stöhr
Date: Sat May 26 19:00:03 2012 +0200
lyx2lyx/lyx_2_1.py: fix #8172
Should be fine for branch, too.
rh
diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py
index bbd9b3c..84bf2bc 100644
--- a/lib/lyx2lyx/lyx_2_1.py
+++ b/lib/lyx2lyx/lyx_2_1.py
@@ -347,27 +347,28 @@ def convert_use_packages(document):
"use_xxx yyy => use_package xxx yyy"
packages = ["amsmath", "esint", "mathdots", "mhchem", "undertilde"]
for p in packages:
-i = find_token(document.header, "\\use_%s" % p , 0)
+i = find_token(document.header, "\\use_%s" % p, 0)
if i != -1:
-value = get_value(document.header, "\\use_%s" % p , i)
+value = get_value(document.header, "\\use_%s" % p, i)
document.header[i] = "\\use_package %s %s" % (p, value)
def revert_use_packages(document):
"use_package xxx yyy => use_xxx yyy"
-packages = {"amsmath":"1", "esint":"1", "mathdots":"1", "mhchem":"1",
"undertilde":"1"}
+packages = ["amsmath", "esint", "mathdots", "mhchem", "undertilde"]
# the order is arbitrary for the use_package version, and not all
packages need to be given.
# Ensure a complete list and correct order (important for older LyX
versions and especially lyx2lyx)
-j = -1
-for p in packages.keys():
+j = 0
+for p in packages:
regexp = re.compile(r'(\\use_package\s+%s)' % p)
-i = find_re(document.header, regexp, 0)
+i = find_re(document.header, regexp, j)
if i != -1:
-value = get_value(document.header, "\\use_package" , i).split()[1]
+value = get_value(document.header, "\\use_package %s" % p,
i).split()[1]
+document.warning(str(value))
del document.header[i]
j = i
-for (p, v) in packages.items():
-document.header.insert(j, "\\use_%s %s" % (p, value))
+document.header.insert(j, "\\use_%s %s" % (p, value))
+document.warning(str(value))
j = j + 1
---
Summary of changes:
lib/lyx2lyx/lyx_2_1.py | 19 ++-
1 files changed, 10 insertions(+), 9 deletions(-)
hooks/post-receive