about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Feed.pm8
-rw-r--r--lib/PublicInbox/Hval.pm3
-rw-r--r--lib/PublicInbox/SearchView.pm2
-rw-r--r--lib/PublicInbox/View.pm18
4 files changed, 17 insertions, 14 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 150bea03..7ebc0505 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -128,18 +128,18 @@ sub emit_html_index {
         my $top = "<b>$title</b> (<a\nhref=\"$atom_url\">Atom feed</a>)";
 
         if ($srch) {
-                $top = qq{<form\naction=""><tt>$top} .
+                $top = qq{<form\naction=""><pre>$top} .
                           qq{ <input\nname=q\ntype=text />} .
                           qq{<input\ntype=submit\nvalue=search />} .
-                          qq{</tt></form>} .
-                          PublicInbox::Hval::PRE;
+                          q{</pre></form><pre>}
         } else {
-                $top = PublicInbox::Hval::PRE . $top . "\n";
+                $top = '<pre>' . $top . "\n";
         }
 
         $fh->write("<html><head><title>$title</title>" .
                    "<link\nrel=alternate\ntitle=\"Atom feed\"\n".
                    "href=\"$atom_url\"\ntype=\"application/atom+xml\"/>" .
+                   PublicInbox::Hval::STYLE .
                    "</head><body>$top");
 
         # if the 'r' query parameter is given, it is a legacy permalink
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index e0b85c68..5a869358 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -13,7 +13,8 @@ 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 => "<pre\nstyle=\"white-space:pre-wrap\">";
+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');
 
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index fec4f39f..5b15e0d7 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -32,7 +32,7 @@ sub sres_top_html {
                 $total = $mset->get_matches_estimated;
         };
         my $err = $@;
-        my $res = html_start($q, $ctx) . PublicInbox::Hval::PRE;
+        my $res = html_start($q, $ctx) . '<pre>'
         if ($err) {
                 $code = 400;
                 $res .= err_txt($err) . "</pre><hr /><pre>" . foot($ctx);
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 523d27fe..7603c514 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -38,7 +38,7 @@ sub msg_html {
         }
         headers_to_html_header($mime, $full_pfx, $ctx) .
                 multipart_text_as_html($mime, $full_pfx) .
-                '</pre><hr />' . PublicInbox::Hval::PRE .
+                '</pre><hr /><pre>' .
                 html_footer($mime, 1, $full_pfx, $ctx) .
                 $footer .
                 '</pre></body></html>';
@@ -47,6 +47,7 @@ sub msg_html {
 sub feed_entry {
         my ($class, $mime, $full_pfx) = @_;
 
+        # no <head> here for <style>...
         PublicInbox::Hval::PRE .
                 multipart_text_as_html($mime, $full_pfx) . '</pre>';
 }
@@ -107,7 +108,7 @@ sub index_entry {
         if ($level) {
                 $rv .= '<td><pre>' . (INDENT x $level) . '</pre></td>';
         }
-        $rv .= "<td\nid=s$midx>" . PublicInbox::Hval::PRE;
+        $rv .= "<td\nid=s$midx><pre>";
         $rv .= "<b\nid=$id>$subj</b>\n";
         $rv .= "- $from @ $ts UTC - ";
         $rv .= "<a\nhref=\"#s$next\">next</a>";
@@ -206,8 +207,8 @@ sub emit_thread_html {
         $next .= "\ndownload thread: ";
         $next .= "<a\n$MBOX_TITLE\nhref=\"../t.mbox.gz\">mbox.gz</a>";
         $next .= " / follow: <a\nhref=\"../t.atom\">Atom feed</a>";
-        $cb->write("<hr />" . PublicInbox::Hval::PRE . $next . "\n\n".
-                $foot .  "</pre></body></html>");
+        $cb->write('<hr /><pre>' . $next . "\n\n".
+                        $foot .  '</pre></body></html>');
         $cb->close;
 }
 
@@ -451,8 +452,8 @@ sub headers_to_html_header {
         }
         $rv .= "\n";
 
-        ("<html><head><title>".  join(' - ', @title) .
-         "</title>$atom</head><body>" . PublicInbox::Hval::PRE . $rv);
+        ("<html><head><title>".  join(' - ', @title) . "</title>$atom".
+         PublicInbox::Hval::STYLE . "</head><body><pre>" . $rv);
 }
 
 sub thread_inline {
@@ -616,6 +617,7 @@ sub thread_html_head {
         $$cb->write("<html><head><title>$s</title>".
                 qq{<link\nrel=alternate\ntitle="Atom feed"\n} .
                 qq!href="../t.atom"\ntype="application/atom+xml"/>! .
+                PublicInbox::Hval::STYLE .
                 "</head><body>");
 }
 
@@ -639,8 +641,8 @@ sub ghost_parent {
 sub ghost_table {
         my ($upfx, $mid, $level) = @_;
         "<table\nsummary=ghost><tr><td>" .
-                (INDENT x $level) . "</td><td>" .
-                PublicInbox::Hval::PRE . ghost_parent($upfx, $mid) .
+                (INDENT x $level) . '</td><td><pre>' .
+                ghost_parent($upfx, $mid) .
                 '</pre></td></table>';
 }