common: captioned alert messages
[sheet.git] / common.inc.plp
index e4cc5f99f5635a4920d007ddb5433878c13c991c..cd218efe2436d4e6dbc36ec67e196992a5196ccd 100644 (file)
@@ -11,9 +11,13 @@ use HTTP::Date;
 use Encode qw( decode_utf8 );
 
 sub Alert {
-       my ($title, $debug) = @_;
-       $title .= ": <em>$debug</em>" if $Dev and defined $debug;
-       say "<p class=error>$title</p>\n";
+       my ($html, $debug) = @_;
+       ref $html eq 'ARRAY' or $html = [$html];
+       my ($title, @lines) = @{$html};
+       $body = "<h2>$title</h2>";
+       $body .= "\n<p>$_</p>" for @lines;
+       $body .= "\n<pre>$debug</pre>" if $Dev and $debug;
+       say "<div class=error>$body</div>\n";
 }
 
 $PLP::ERROR = sub {