diff --git a/lib/Plack/App/Directory.pm b/lib/Plack/App/Directory.pm index 48443ca0..8c5dccfe 100644 --- a/lib/Plack/App/Directory.pm +++ b/lib/Plack/App/Directory.pm @@ -10,33 +10,54 @@ use URI::Escape; use Plack::Request; # Stolen from rack/directory.rb -my $dir_file = "%s%s%s%s"; -my $dir_page = < - %s - - + + +

%s

+
+ + + + + + + +%s +
NameSizeTypeLast Modified
+
+ + +PAGE +} + +sub css { + return < - -

%s

-
- - - - - - - -%s -
NameSizeTypeLast Modified
-
- -PAGE +CSS +} sub should_handle { my($self, $file) = @_; @@ -99,9 +120,9 @@ sub serve_path { my $path = Plack::Util::encode_html("Index of $env->{PATH_INFO}"); my $files = join "\n", map { my $f = $_; - sprintf $dir_file, map Plack::Util::encode_html($_), @$f; + sprintf $self->file_html, map Plack::Util::encode_html($_), @$f; } @files; - my $page = sprintf $dir_page, $path, $path, $files; + my $page = sprintf $self->dir_html, $path, $self->css, $path, $files; return [ 200, ['Content-Type' => 'text/html; charset=utf-8'], [ $page ] ]; }