defined $mid or return 0;
$mid = PublicInbox::Hval->new_msgid($mid);
my $href = $mid->as_href . '.html';
- my $content = PublicInbox::View->as_feed_entry($mime, $fullurl . $href);
+ my $content = PublicInbox::View->feed_entry($mime, $fullurl . $href);
defined($content) or return 0;
my $subject = mime_header($mime, 'Subject') or return 0;
my $enc_mime = find_encoding('MIME-Header');
# public functions:
-sub as_html {
+sub msg_html {
my ($class, $mime, $full_pfx) = @_;
headers_to_html_header($mime, $full_pfx) .
'</pre></body></html>';
}
-sub as_feed_entry {
+sub feed_entry {
my ($class, $mime, $full_pfx) = @_;
- "<pre>" . multipart_text_as_html($mime, $full_pfx) . "</pre>";
+ '<pre>' . multipart_text_as_html($mime, $full_pfx) . '</pre>';
}
my $pfx = "../f/$mid_href.html";
require Email::MIME;
[ 200, [ 'Content-Type' => 'text/html; charset=UTF-8' ],
- [ PublicInbox::View->as_html(Email::MIME->new($x), $pfx) ] ];
+ [ PublicInbox::View->msg_html(Email::MIME->new($x), $pfx) ] ];
}
# /$LISTNAME/f/$MESSAGE_ID.html -> HTML content (fullquotes)
require PublicInbox::View;
require Email::MIME;
[ 200, [ 'Content-Type' => 'text/html' ],
- [ PublicInbox::View->as_html(Email::MIME->new($x))] ];
+ [ PublicInbox::View->msg_html(Email::MIME->new($x))] ];
}
sub self_url {
body => $body,
);
$s = Email::MIME->new($s->as_string);
- my $html = PublicInbox::View->as_html($s);
+ my $html = PublicInbox::View->msg_html($s);
# ghetto tests
like($html, qr!<a href="\.\./m/hello%40!s, "MID link present");
# short page
my $pfx = "http://example.com/test/f";
- my $short = PublicInbox::View->as_html($s, $pfx);
+ my $short = PublicInbox::View->msg_html($s, $pfx);
like($short, qr!<a href="hello%40!s, "MID link present");
like($short, qr/\n> keep this inline/,
"short quoted text is inline");
parts => $parts,
);
- my $html = PublicInbox::View->as_html($mime);
+ my $html = PublicInbox::View->msg_html($mime);
like($html, qr/hi\n-+ part #2 -+\nbye\n/, "multipart split");
}
parts => $parts,
);
- my $html = PublicInbox::View->as_html($mime);
+ my $html = PublicInbox::View->msg_html($mime);
like($html, qr!see attached patch\n-+ foo\.patch -+\n--- a/file\n!,
"parts split with filename");
}