lib/PublicInbox/Feed.pm | 4 ++-- lib/PublicInbox/Hval.pm | 5 +++++ lib/PublicInbox/SearchView.pm | 2 +- lib/PublicInbox/View.pm | 16 ++++++++-------- diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 1201dd1165a03d3e0fc3ca3ed81b3dfe3bbf735f..68f1e67bf1bba4939df8b66c413a861bee49d018 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -134,9 +134,9 @@ $top = qq{$top} . qq{ } . qq{} . qq{} . - PublicInbox::View::PRE_WRAP; + PublicInbox::Hval::PRE; } else { - $top = PublicInbox::View::PRE_WRAP . $top . "\n"; + $top = PublicInbox::Hval::PRE . $top . "\n"; } $fh->write("$title" . diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index ab6e044bbf9716f9a1c23ab00cfa70339a781c70..e0b85c685c58d0b8824d0e19d39560f0920605ca 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -10,6 +10,11 @@ use Encode qw(find_encoding); use URI::Escape qw(uri_escape_utf8); use PublicInbox::MID qw/mid_clean/; +# 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 PRE => ""; + my $enc_ascii = find_encoding('us-ascii'); sub new { diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 7f790902ca4c74e83b024196eafa3c47320b866c..ea8a45a4e91f6d4416db9b6792d442d44e150e4a 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -31,7 +31,7 @@ $mset = $ctx->{srch}->query($q->{q}, $opts); $total = $mset->get_matches_estimated; }; my $err = $@; - my $res = html_start($q, $ctx) . PublicInbox::View::PRE_WRAP; + my $res = html_start($q, $ctx) . PublicInbox::Hval::PRE; if ($err) { $code = 400; $res .= err_txt($err) . "
" . foot($ctx);
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 3c4e9547e5f56808dee6caed782f6303c401168a..68741c5e0366c13c9e1a2bf05d775d87437c621b 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -21,7 +21,6 @@
 # TODO: make these constants tunable
 use constant MAX_INLINE_QUOTED => 12; # half an 80x24 terminal
 use constant MAX_TRUNC_LEN => 72;
-use constant PRE_WRAP => "";
 use constant T_ANCHOR => '#u';
 use constant INDENT => '  ';
 
@@ -39,7 +38,7 @@ 		$footer = '';
 	}
 	headers_to_html_header($mime, $full_pfx, $ctx) .
 		multipart_text_as_html($mime, $full_pfx) .
-		'

' . PRE_WRAP . + '
' . PublicInbox::Hval::PRE . html_footer($mime, 1, $full_pfx, $ctx) . $footer . ''; @@ -48,7 +47,8 @@ sub feed_entry { my ($class, $mime, $full_pfx) = @_; - PRE_WRAP . multipart_text_as_html($mime, $full_pfx) . ''; + PublicInbox::Hval::PRE . + multipart_text_as_html($mime, $full_pfx) . ''; } sub in_reply_to { @@ -107,7 +107,7 @@ my $rv = ""; if ($level) { $rv .= '
' . (INDENT x $level) . '
'; } - $rv .= "" . PRE_WRAP; + $rv .= "" . PublicInbox::Hval::PRE; $rv .= "$subj\n"; $rv .= "- $from @ $ts UTC - "; $rv .= "next"; @@ -206,8 +206,8 @@ $next .= " thread, back to index"; $next .= "\ndownload thread: "; $next .= "mbox.gz"; $next .= " / follow: Atom feed"; - $cb->write("
" . PRE_WRAP . $next . "\n\n". $foot . - ""); + $cb->write("
" . PublicInbox::Hval::PRE . $next . "\n\n". + $foot . ""); $cb->close; } @@ -457,7 +457,7 @@ } $rv .= "\n"; ("". join(' - ', @title) . - "$atom" . PRE_WRAP . $rv); + "$atom" . PublicInbox::Hval::PRE . $rv); } sub thread_inline { @@ -634,7 +634,7 @@ sub ghost_table { my ($upfx, $mid, $level) = @_; "" . (INDENT x $level) . "" . - PRE_WRAP . ghost_parent($upfx, $mid) . + PublicInbox::Hval::PRE . ghost_parent($upfx, $mid) . ''; }