about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-09-06 23:31:40 +0000
committerEric Wong <e@80x24.org>2014-09-06 23:31:40 +0000
commitb9e8a5d04ba96836e66c382884987888f116458f (patch)
tree2d08c71e13557e9b0260dcb61316f655082f4a68 /lib
parent868b890ce7148cfdddcdd69073a96ae673b4adec (diff)
downloadpublic-inbox-b9e8a5d04ba96836e66c382884987888f116458f.tar.gz
There's no point in having a "(more...)" and "link" pointing
to the same element, replace "link" with "more..." if we've
omitted text from the index.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 6195fe65..2e7c8747 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -85,12 +85,12 @@ sub index_entry {
         my $href = $mid->as_href;
         my $mhref = "m/$href.html";
         my $fhref = "f/$href.html";
+        my $more = 'link';
         # scan through all parts, looking for displayable text
         $mime->walk_parts(sub {
                 my ($part) = @_;
                 return if $part->subparts; # walk_parts already recurses
                 my $enc = enc_for($part->content_type) || $enc_msg || $enc_utf8;
-                my $more;
 
                 if ($part_nr > 0) {
                         my $fn = $part->filename;
@@ -105,7 +105,7 @@ sub index_entry {
 
                 # drop the remainder of git patches, they're usually better
                 # to review when the full message is viewed
-                $s =~ s!^---\n.*\z!!ms and $more = 1;
+                $s =~ s!^---\n.*\z!!ms and $more = 'more...';
 
                 # kill any leading or trailing whitespace
                 $s =~ s/\A\s+//s;
@@ -114,13 +114,11 @@ sub index_entry {
                 # add prefix:
                 $s =~ s/^/$pfx/sgm;
 
-                $s .= "\n$pfx<a href=\"$mhref\">(more...)</a>\n" if $more;
-
                 $rv .= $s . "\n";
                 ++$part_nr;
         });
 
-        $rv .= "$pfx<a\nhref=\"$mhref\">link</a> ";
+        $rv .= "$pfx<a\nhref=\"$mhref\">$more</a> ";
         my $txt = "m/$href.txt";
         $rv .= "<a\nhref=\"$txt\">raw</a> ";
         $rv .= html_footer($mime, 0);