--- trunk/lib/Frey/Web.pm 2009/01/09 14:52:58 968 +++ trunk/lib/Frey/Web.pm 2009/04/27 18:40:41 1064 @@ -7,6 +7,7 @@ use Carp qw/confess cluck carp/; use File::Slurp; use Text::Tabs; # expand, unexpand +use Digest::MD5 qw/md5/; use lib 'lib'; @@ -193,9 +194,14 @@ } +my $seen; + sub _add_css_js { my ( $self, $what, $content ) = @_; + my $md5 = md5( $content ); + return if $seen->{$what}->{$md5}++; + my $tag = $what eq 'css' ? 'style' : 'script'; my $type = $what eq 'css' ? 'text/css' : 'text/javascript'; my $head; @@ -203,7 +209,7 @@ my ( $package, $path, $line ) = caller(1); $content = "/$content" if $content !~ m{[\n\r]} && -e $content; - if ( $content =~ $re_html ) { + if ( $content =~ $re_html && $what ne 'js' ) { $head = qq| $content @@ -299,7 +305,7 @@ my $right = qq| - + reload $exit @@ -320,6 +326,12 @@ # $title =~ s{(\w)\w+::}{$1:}g; # XXX compress names of classes + $self->add_css(qq| + body { + padding-bottom: 3em; /* don't overlap status line */ + } + |); + my $html = join("\n", qq||, $self->_head_html,