Skip to content

Commit

Permalink
more compact form of strip_verbatim_indent
Browse files Browse the repository at this point in the history
  • Loading branch information
jberger committed May 9, 2015
1 parent c657525 commit 90408da
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -3,7 +3,6 @@ use Mojo::Base 'Mojolicious::Plugin';

use Mojo::Asset::File;
use Mojo::ByteStream 'b';
use Mojo::Collection 'c';
use Mojo::DOM;
use Mojo::URL;
use Mojo::Util 'slurp';
Expand Down Expand Up @@ -97,12 +96,7 @@ sub _pod_to_html {
my $parser = Pod::Simple::XHTML->new;
$parser->perldoc_url_prefix('https://metacpan.org/pod/');
$parser->$_('') for qw(html_header html_footer);
$parser->strip_verbatim_indent(
sub {
c(@{$_[0]})->map(sub {/^(\s+)/})
->reduce(sub { length $b < length $a ? $b : $a });
}
);
$parser->strip_verbatim_indent(sub { (sort map /^(\s+)/, @{$_[0]})[0] });
$parser->output_string(\(my $output));
return $@ unless eval { $parser->parse_string_document("$pod"); 1 };

Expand Down

0 comments on commit 90408da

Please sign in to comment.