Bläddra i källkod

Show food-type in front of Sodexo Linna.

Toni Fadjukoff 12 år sedan
förälder
incheckning
ccbf668ba5
1 ändrade filer med 16 tillägg och 1 borttagningar
  1. 16 1
      sodexo.pl

+ 16 - 1
sodexo.pl Visa fil

@@ -37,6 +37,7 @@ sub sodexo_parse_after_food {
37 37
     $parse_func = \&sodexo_parse_finish;
38 38
   } elsif ($token->[0] eq 'S' && $token->[1] eq 'td') {
39 39
     $parse_func = \&sodexo_parse_to_food;
40
+    sodexo_parse_to_food($token);
40 41
   } elsif ($token->[0] eq 'S' && $token->[1] eq 'th') {
41 42
     sodexo_finish_day();
42 43
     $parse_func = \&sodexo_parse_to_food;
@@ -81,15 +82,29 @@ sub sodexo_parse_food {
81 82
   my $token = shift;
82 83
 
83 84
   if ($token->[0] eq 'T' && $token->[1] =~ /\S/) {
84
-     $cur_title = utf8_to_8859($token->[1]);
85
+     $cur_title .= utf8_to_8859($token->[1]);
85 86
      $parse_func = \&sodexo_parse_to_allergy;
86 87
   }
87 88
 }
88 89
 
90
+sub sodexo_parse_type {
91
+  my $token = shift;
92
+
93
+  if ($token->[0] eq 'T' && $token->[1] =~ /\S/) {
94
+    $cur_title = utf8_to_8859($token->[1]) . ": ";
95
+    $parse_func = \&sodexo_parse_food; 
96
+  }
97
+}
98
+
89 99
 sub sodexo_parse_to_food {
90 100
   my $token = shift;
91 101
   if ($token->[0] eq 'S' && $token->[1] eq "td") {
92 102
     my %attrs = %{$token->[2]};
103
+    if ($attrs{'class'} eq "food-type") {
104
+      $cur_title = '';
105
+      $cur_text = '';
106
+      $parse_func = \&sodexo_parse_type;
107
+    }
93 108
     if ($attrs{'class'} eq "food-desc") {
94 109
       $cur_title = '';
95 110
       $cur_text = '';