diff --git a/scripts/ds2011-resources.js b/scripts/ds2011-resources.js index e43792f10..749471ab5 100644 --- a/scripts/ds2011-resources.js +++ b/scripts/ds2011-resources.js @@ -93,13 +93,20 @@ processEvent({ id: '0000', var scheduleFile = fs.readFileSync('content/static/datenspuren/2011/fahrplan/schedule.de.xml'); var schedule = ltx.parse(scheduleFile); schedule.getChildren('day').forEach(function(dayEl) { + var dayEvents = []; dayEl.getChildren('room').forEach(function(roomEl) { roomEl.getChildren('event').forEach(function(eventEl) { - processEvent({ id: eventEl.attrs.id, - title: eventEl.getChildText('title'), - slug: eventEl.getChildText('slug') - }); + dayEvents.push({ id: eventEl.attrs.id, + time: eventEl.getChildText('start'), + title: eventEl.getChildText('title'), + slug: eventEl.getChildText('slug') + }); }); }); + dayEvents = dayEvents.sort(function(e1, e2) { + return (e1.time < e2.time) ? -1 : + ((e1.time > e2.time) ? 1 : 0); + }); + dayEvents.forEach(processEvent); });