If we bite the bullet and rely on inline CSS, we might as well
only specify it once per page instead of inline in every <pre>
tag which may handle UGC. So this actually saves us a small
amount of bandwith on most pages which have multiple <pre>
start tags.
my $top = "<b>$title</b> (<a\nhref=\"$atom_url\">Atom feed</a>)";
if ($srch) {
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{ <input\nname=q\ntype=text />} .
qq{<input\ntype=submit\nvalue=search />} .
- qq{</tt></form>} .
- PublicInbox::Hval::PRE;
- $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\"/>" .
}
$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
"</head><body>$top");
# if the 'r' query parameter is given, it is a legacy permalink
# 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.
# 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');
my $enc_ascii = find_encoding('us-ascii');
$total = $mset->get_matches_estimated;
};
my $err = $@;
$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);
if ($err) {
$code = 400;
$res .= err_txt($err) . "</pre><hr /><pre>" . foot($ctx);
}
headers_to_html_header($mime, $full_pfx, $ctx) .
multipart_text_as_html($mime, $full_pfx) .
}
headers_to_html_header($mime, $full_pfx, $ctx) .
multipart_text_as_html($mime, $full_pfx) .
- '</pre><hr />' . PublicInbox::Hval::PRE .
html_footer($mime, 1, $full_pfx, $ctx) .
$footer .
'</pre></body></html>';
html_footer($mime, 1, $full_pfx, $ctx) .
$footer .
'</pre></body></html>';
sub feed_entry {
my ($class, $mime, $full_pfx) = @_;
sub feed_entry {
my ($class, $mime, $full_pfx) = @_;
+ # no <head> here for <style>...
PublicInbox::Hval::PRE .
multipart_text_as_html($mime, $full_pfx) . '</pre>';
}
PublicInbox::Hval::PRE .
multipart_text_as_html($mime, $full_pfx) . '</pre>';
}
if ($level) {
$rv .= '<td><pre>' . (INDENT x $level) . '</pre></td>';
}
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>";
$rv .= "<b\nid=$id>$subj</b>\n";
$rv .= "- $from @ $ts UTC - ";
$rv .= "<a\nhref=\"#s$next\">next</a>";
$next .= "\ndownload thread: ";
$next .= "<a\n$MBOX_TITLE\nhref=\"../t.mbox.gz\">mbox.gz</a>";
$next .= " / follow: <a\nhref=\"../t.atom\">Atom feed</a>";
$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>');
- ("<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);
$$cb->write("<html><head><title>$s</title>".
qq{<link\nrel=alternate\ntitle="Atom feed"\n} .
qq!href="../t.atom"\ntype="application/atom+xml"/>! .
$$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 .
sub ghost_table {
my ($upfx, $mid, $level) = @_;
"<table\nsummary=ghost><tr><td>" .
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) .