summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2010-05-09 08:10:42 +0200
committerMatthias Schiffer <matthias@gamezock.de>2010-05-09 08:10:42 +0200
commite5cd4bb20328110561ee9956f948b97c378cf671 (patch)
treeb520868a154b870919ba57cfef7ef79ccacaf9eb /modules
parent7b39527686655fd153d6dec8f9fc7b4e46d7ea7e (diff)
downloadcurunir-e5cd4bb20328110561ee9956f948b97c378cf671.tar
curunir-e5cd4bb20328110561ee9956f948b97c378cf671.zip
Another correction for the mensa module
Diffstat (limited to 'modules')
-rw-r--r--modules/mensa.py37
1 files changed, 11 insertions, 26 deletions
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*<td class="schrift_(gerichte|spezial)">(.+?)</td>', 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('&quot;', '"')
s = s.replace('<br />', ' ‒ ')
s = re.sub('\s+', ' ', s)
+ s = re.sub(r'<span[^>]*>(.+?)</span>', 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