From e5cd4bb20328110561ee9956f948b97c378cf671 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 9 May 2010 08:10:42 +0200 Subject: Another correction for the mensa module --- modules/mensa.py | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'modules') diff --git a/modules/mensa.py b/modules/mensa.py index daee81d..2dd71dc 100644 --- a/modules/mensa.py +++ b/modules/mensa.py @@ -59,7 +59,7 @@ class Module(ModuleBase): r = re.compile(r'\s*(.+?)', re.DOTALL) match = r.match(mealstr, pos) while match: - meals.append((match.group(2), match.group(1) == 'spezial')) + meals.append(match.group(2)) if len(meals) >= 4: break @@ -102,36 +102,21 @@ class Module(ModuleBase): s = s.replace('"', '"') s = s.replace('
', ' ‒ ') s = re.sub('\s+', ' ', s) + s = re.sub(r']*>(.+?)', r'\1', s) return s - meals = map(lambda (s, special): (unescape(s), special), meals) + meals = map(unescape, meals) prices = map(unescape, prices) reply = 'Mensa-Menü für den %s\n\n' % day.strftime('%d.%m.%y') - if meals[0][0]: - if meals[0][1]: - reply += 'Mensatipp: ' - else: - reply += 'Eintopf: ' - reply += '%s (%s)\n' % (meals[0][0], prices[0]) - if meals[1][0]: - if meals[1][1]: - reply += 'Mensatipp: ' - else: - reply += 'Hauptgericht 1: ' - reply += '%s (%s)\n' % (meals[1][0], prices[1]) - if meals[2][0]: - if meals[2][1]: - reply += 'Mensatipp: ' - else: - reply += 'Hauptgericht 2: ' - reply += '%s (%s)\n' % (meals[2][0], prices[2]) - if meals[3][0]: - if meals[3][1]: - reply += 'Mensatipp: ' - else: - reply += 'Vegetarisches Hauptgericht: ' - reply += '%s (%s)\n' % (meals[3][0], prices[3]) + if meals[0]: + reply += 'Eintopf: %s (%s)\n' % (meals[0].strip(), prices[0].strip()) + if meals[1]: + reply += 'Hauptgericht 1: %s (%s)\n' % (meals[1].strip(), prices[1].strip()) + if meals[2]: + reply += 'Hauptgericht 2: %s (%s)\n' % (meals[2].strip(), prices[2].strip()) + if meals[3]: + reply += 'Vegetarisches Hauptgericht: %s (%s)\n' % (meals[3].strip(), prices[3].strip()) return reply -- cgit v1.2.3