From e6aeed0397ec4491781676b343bb75715136c123 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Fri, 12 Mar 2021 13:50:57 +0100 Subject: [PATCH] =?utf8?q?Presenter:=20html=5Ftag=20unterst=C3=BCtzt=20jet?= =?utf8?q?zt=20class=20=3D>=20[...]=20Syntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Presenter/Tag.pm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/SL/Presenter/Tag.pm b/SL/Presenter/Tag.pm index c4b9b7f78..032b179b4 100644 --- a/SL/Presenter/Tag.pm +++ b/SL/Presenter/Tag.pm @@ -46,6 +46,15 @@ sub _J { return $string; } +sub join_values { + my ($name, $value) = @_; + my $spacer = $name eq 'class' ? ' ' : ''; # join classes with spaces, everything else as is + + ref $value && 'ARRAY' eq ref $value + ? join $spacer, map { join_values($name, $_) } @$value + : $value +} + sub stringify_attributes { my (%params) = @_; @@ -54,6 +63,7 @@ sub stringify_attributes { next unless $name; next if $_valueless_attributes{$name} && !$value; $value = '' if !defined($value); + $value = join_values($name, $value) if ref $value && 'ARRAY' eq ref $value; push @result, $_valueless_attributes{$name} ? escape($name) : escape($name) . '="' . escape($value) . '"'; } -- 2.20.1