|
@@ -31,17 +31,37 @@ sub parse_amica {
|
31
|
31
|
my $LunchMenus = $data->{'LunchMenus'};
|
32
|
32
|
foreach my $LunchMenu (@$LunchMenus) {
|
33
|
33
|
my $SetMenus = $LunchMenu->{'SetMenus'};
|
34
|
|
- foreach my $SetMenu (@$SetMenus) {
|
35
|
|
- my $Meals = $SetMenu->{'Meals'};
|
36
|
|
- foreach my $Meal (@$Meals) {
|
37
|
|
- $cur_food .= "\n" if $cur_food ne "";
|
38
|
|
- $cur_food .= $Meal->{'Name'};
|
39
|
|
- my $Diets = $Meal->{'Diets'};
|
40
|
|
- $cur_food .= ' (' . join(', ', @$Diets) . ')';
|
|
34
|
+ my $Html = $LunchMenu->{'Html'};
|
|
35
|
+ if (length($Html) > 0) {
|
|
36
|
+ print "Doing html\n";
|
|
37
|
+ my @Menus = split('<p>', $Html);
|
|
38
|
+ print "SetMenus" . @Menus . "\n";
|
|
39
|
+ foreach my $SetMenu (@Menus) {
|
|
40
|
+ my @Meals = split('<br />', $SetMenu);
|
|
41
|
+ foreach my $Meal (@Meals) {
|
|
42
|
+ my @parts = split('\\(', $Meal);
|
|
43
|
+ $cur_food .= "\n" if $cur_food ne "";
|
|
44
|
+ $cur_food .= @parts[0];
|
|
45
|
+ my @Diets = split(",\s*", substr(@parts[1], 0, index(@parts[1], ')')));
|
|
46
|
+ $cur_food .= ' (' . join(', ', @Diets) . ')' if @Diets;
|
|
47
|
+ }
|
|
48
|
+ push @cur_day_foods, utf8_to_8859($cur_food) if ($cur_food ne "");
|
|
49
|
+ $cur_food = "";
|
|
50
|
+ }
|
|
51
|
+ } else {
|
|
52
|
+ foreach my $SetMenu (@$SetMenus) {
|
|
53
|
+ my $Meals = $SetMenu->{'Meals'};
|
|
54
|
+ foreach my $Meal (@$Meals) {
|
|
55
|
+ $cur_food .= "\n" if $cur_food ne "";
|
|
56
|
+ $cur_food .= $Meal->{'Name'};
|
|
57
|
+ my $Diets = $Meal->{'Diets'};
|
|
58
|
+ $cur_food .= ' (' . join(', ', @$Diets) . ')';
|
|
59
|
+ }
|
|
60
|
+ push @cur_day_foods, utf8_to_8859($cur_food) if ($cur_food ne "");
|
|
61
|
+ $cur_food = "";
|
41
|
62
|
}
|
42
|
|
- push @cur_day_foods, utf8_to_8859($cur_food) if ($cur_food ne "");
|
43
|
|
- $cur_food = "";
|
44
|
63
|
}
|
|
64
|
+
|
45
|
65
|
push @week_foods, [@cur_day_foods];
|
46
|
66
|
@cur_day_foods = ();
|
47
|
67
|
}
|