Revision e6aeed03
Von Sven Schöling vor mehr als 3 Jahren hinzugefügt
SL/Presenter/Tag.pm | ||
---|---|---|
46 | 46 |
return $string; |
47 | 47 |
} |
48 | 48 |
|
49 |
sub join_values { |
|
50 |
my ($name, $value) = @_; |
|
51 |
my $spacer = $name eq 'class' ? ' ' : ''; # join classes with spaces, everything else as is |
|
52 |
|
|
53 |
ref $value && 'ARRAY' eq ref $value |
|
54 |
? join $spacer, map { join_values($name, $_) } @$value |
|
55 |
: $value |
|
56 |
} |
|
57 |
|
|
49 | 58 |
sub stringify_attributes { |
50 | 59 |
my (%params) = @_; |
51 | 60 |
|
... | ... | |
54 | 63 |
next unless $name; |
55 | 64 |
next if $_valueless_attributes{$name} && !$value; |
56 | 65 |
$value = '' if !defined($value); |
66 |
$value = join_values($name, $value) if ref $value && 'ARRAY' eq ref $value; |
|
57 | 67 |
push @result, $_valueless_attributes{$name} ? escape($name) : escape($name) . '="' . escape($value) . '"'; |
58 | 68 |
} |
59 | 69 |
|
Auch abrufbar als: Unified diff
Presenter: html_tag unterstützt jetzt class => [...] Syntax