about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-05-02 23:16:37 +0000
committerEric Wong <e@80x24.org>2014-05-02 23:16:37 +0000
commita1331e538ed8fff6e9554de553a2869954f54167 (patch)
tree7a255c7119bc6f7a775e441ba33f5387fd92441d
parent63ede74cfe5817642a4211419ae2bd3838260237 (diff)
downloadpublic-inbox-a1331e538ed8fff6e9554de553a2869954f54167.tar.gz
These views are not OO, so the "as_" prefix makes little sense
and "as_html" conflicts with Hval, which is OO.
-rw-r--r--lib/PublicInbox/Feed.pm2
-rw-r--r--lib/PublicInbox/View.pm6
-rw-r--r--lib/PublicInbox/WWW.pm4
-rw-r--r--t/view.t8
4 files changed, 10 insertions, 10 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 09eb2fca..12ac8a95 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -243,7 +243,7 @@ sub add_to_feed {
         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;
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index a43ab620..52e8f0b2 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -16,7 +16,7 @@ my $enc_utf8 = find_encoding('UTF-8');
 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) .
@@ -26,10 +26,10 @@ sub as_html {
                 '</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>';
 }
 
 
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 4dbfe47d..898f42a8 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -166,7 +166,7 @@ sub get_mid_html {
         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)
@@ -177,7 +177,7 @@ sub get_full_html {
         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 {
diff --git a/t/view.t b/t/view.t
index 87f8eeee..10a182b3 100644
--- a/t/view.t
+++ b/t/view.t
@@ -34,7 +34,7 @@ EOF
                 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");
@@ -45,7 +45,7 @@ EOF
 
         # 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&gt; keep this inline/,
                 "short quoted text is inline");
@@ -76,7 +76,7 @@ EOF
                 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");
 }
 
@@ -105,7 +105,7 @@ EOF
                 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");
 }