From cf4e879a36bf7f33628270eb18bf18ad6a634559 Mon Sep 17 00:00:00 2001 From: Sean O'Rourke Date: Sun, 30 Sep 2012 17:31:41 -0700 Subject: [PATCH] Build HTML module list based on what's actually installed. --- ChangeLog | 5 +++++ lib/Sepia.pm | 57 ++++++++++++--------------------------------------------- 2 files changed, 17 insertions(+), 45 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9f079d..f24c891 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-09-30 Sean O'Rourke + + * lib/Sepia.pm (html_module_list): Find all .pm and .pod files, + rather than relying on packlists. + 2012-01-30 Sean O'Rourke * sepia.el (sepia-complete-symbol): Finally fix method completion diff --git a/lib/Sepia.pm b/lib/Sepia.pm index 76ac49d..5deacdc 100644 --- a/lib/Sepia.pm +++ b/lib/Sepia.pm @@ -39,7 +39,7 @@ BEGIN { if ($] >= 5.012) { eval 'no warnings "deprecated"'; # undo some of the 5.12 suck. } - if ($] > 5.012003Z) { + if ($] > 5.012003) { warn <", $file || \$out or return; print OUT ""; my $pfx = ''; - my %ns; - for (package_list) { - push @{$ns{$1}}, $_ if /^([^:]+)/; - } - # Handle core modules. my %fs; - undef $fs{$_} for map { - s/.*man.\///; s|/|::|g; s/\.\d(?:pm)?$//; $_ - } grep { - /\.\d(?:pm)?$/ && !/man1/ && !/usr\/bin/ # && !/^(?:\/|perl)/ - } $inst->files('Perl'); - my @fs = sort keys %fs; - print OUT qq{

Core Modules

    }; - for (@fs) { - print OUT qq{
  • $_}; + require File::Find; + my $incre = join '|', map quotemeta, sort { length $b <=> length $a } @INC; + $incre = qr!^(?:$incre)/*(.+)!; + find(sub { + return unless /\.p(?:m|pod)$/ && -r $_; + $File::Find::name =~ /$incre/ and $fs{$1} = 1; + }, @INC); + for (sort keys %fs) { + (my $name = $_) =~ s!/!::!g; + $name =~ s/\.pm$//; + print OUT qq{
  • $name}; } - print OUT '

Installed Modules

    '; - - # handle the rest - for (sort keys %ns) { - next if $_ eq 'Perl'; # skip Perl core. - print OUT qq{
  • $_
      } if @{$ns{$_}} > 1; - for (sort @{$ns{$_}}) { - my %fs; - undef $fs{$_} for map { - s/.*man.\///; s|/|::|g; s/\.\d(?:pm)?$//; $_ - } grep { - /\.\d(?:pm)?$/ && !/man1/ - } $inst->files($_); - my @fs = sort keys %fs; - next unless @fs > 0; - if (@fs == 1) { - print OUT qq{
    • $fs[0]}; - } else { - print OUT qq{
    • $_
        }; - for (@fs) { - print OUT qq{
      • $_}; - } - print OUT '
      '; - } - } - print OUT qq{
    } if @{$ns{$_}} > 1; - } - print OUT "
\n"; close OUT; $file ? 1 : $out; -- 2.11.4.GIT