]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Hval.pm
www: allow including links to NNTP sites in HTML footer
[public-inbox.git] / lib / PublicInbox / Hval.pm
index d295f5ce3d29fb8d783e2550e75975fe237fcba7..652aef3daee55ab926e31262e0b722b1efbe568e 100644 (file)
@@ -9,12 +9,13 @@ use warnings;
 use Encode qw(find_encoding);
 use URI::Escape qw(uri_escape_utf8);
 use PublicInbox::MID qw/mid_clean/;
+use base qw/Exporter/;
+our @EXPORT_OK = qw/ascii_html/;
 
 # for user-generated content (UGC) which may have excessively long lines
 # and screw up rendering on some browsers.  This is the only CSS style
 # feature we use.
 use constant STYLE => '<style>pre{white-space:pre-wrap}</style>';
-use constant PRE => "<pre\nstyle=\"white-space:pre-wrap\">"; # legacy
 
 my $enc_ascii = find_encoding('us-ascii');
 
@@ -30,7 +31,7 @@ sub new {
 }
 
 sub new_msgid {
-       my ($class, $msgid, $no_compress) = @_;
+       my ($class, $msgid) = @_;
        $msgid = mid_clean($msgid);
        $class->new($msgid, $msgid);
 }
@@ -69,4 +70,9 @@ sub raw {
        }
 }
 
+sub prurl {
+       my ($env, $u) = @_;
+       index($u, '//') == 0 ? "$env->{'psgi.url_scheme'}:$u" : $u;
+}
+
 1;