소스 검색

Loopify juvenes.pl

Toni Fadjukoff 12 년 전
부모
커밋
a807361f14
1개의 변경된 파일21개의 추가작업 그리고 12개의 파일을 삭제
  1. 21 12
      juvenes.pl

+ 21 - 12
juvenes.pl 파일 보기

@@ -16,7 +16,8 @@ my @restaurant_info = (
16 16
   [ "(TTY) Newton", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Newton", "", "left" ],
17 17
   [ "(TTY) Zip", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Zip", "", "right" ],
18 18
   [ "(TTY) Edison", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Edison", "", "middle" ],
19
-  [ $zip_salaattibaari_title, "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Zip/Salaattibaari", "", "right" ],
19
+# There is no Salaattibaari anymore?
20
+#  [ $zip_salaattibaari_title, "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Zip/Salaattibaari", "", "right" ],
20 21
   [ "(TTY) Pastabaari", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Caf____Fast_Voltti/Pastabaari", "", "middle" ],
21 22
   [ "(TTY) Fast Voltti", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Caf____Fast_Voltti", "", "middle" ],
22 23
   [ "(TTY) Fusion Kitchen", "http://www.juvenes.fi/Suomeksi/Ravintolat_ja_kahvilat/Opiskelijaravintolat/_TTY__Newton/Fusion_Kitchen", "", "left" ],
@@ -103,11 +104,18 @@ sub parse_more_food {
103 104
     }
104 105
   } elsif ($token->[0] eq 'T') {
105 106
     my $text = $token->[1];
106
-    if ($day_id < 6 && $text eq $day_names[$day_id+1]) {
107
-      # day changed
108
-      finish_food();
109
-      finish_day();
110
-    } elsif ($text eq "&nbsp;") {
107
+
108
+    for (my $day = $day_id+1; $day <= 6; $day++) {
109
+      if ($text eq $day_names[$day]) {
110
+        while ($day >= $day_id) {
111
+          finish_food();
112
+          finish_day();
113
+          $day = $day - 1;
114
+        }
115
+        return;
116
+      }
117
+    }
118
+    if ($text eq "&nbsp;") {
111 119
       # next food
112 120
       finish_food();
113 121
     } else {
@@ -125,13 +133,14 @@ sub parse_more_food {
125 133
 sub parse_monday {
126 134
   my $token = shift;
127 135
   
128
-  if ($token->[0] eq 'T') {
129
-    if ($token->[1] eq $day_names[0]) {
130
-      $parse_func = \&parse_more_food;
131
-    }
132
-    elsif ($token->[1] eq $day_names[1]) {
133
-      finish_day();
136
+  for (my $day = 0; $day <= 6; $day++) {
137
+    if ($token->[0] eq 'T' and $token->[1] eq $day_names[$day]) {
138
+      while ($day > 0) {
139
+        finish_day();
140
+        $day = $day - 1;
141
+      }
134 142
       $parse_func = \&parse_more_food;
143
+      break;
135 144
     }
136 145
   }
137 146
 }