X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FUserContent.pm;h=789da2f12b6698f33f0ec0d8d0d145c0ff8a6d39;hb=3f0cbf20d0d811482fa48dd601c9d0ce90082e63;hp=2a258165b230a03384b63f95b05bcd2fc68e9f78;hpb=1dba4001f662fb2511db2cbc9db17e1d5fefe3e1;p=public-inbox.git diff --git a/lib/PublicInbox/UserContent.pm b/lib/PublicInbox/UserContent.pm index 2a258165..789da2f1 100644 --- a/lib/PublicInbox/UserContent.pm +++ b/lib/PublicInbox/UserContent.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2019 all contributors +# Copyright (C) 2019-2020 all contributors # License: AGPL-3.0+ # Self-updating module containing a sample CSS for client-side @@ -11,6 +11,7 @@ use warnings; sub CSS () { <<'_' /* + * CC0-1.0 * Dark color scheme using 216 web-safe colors, inspired * somewhat by the default color scheme in mutt. * It reduces eyestrain for me, and energy usage for all: @@ -22,7 +23,7 @@ sub CSS () { * Underlined links add visual noise which make them hard-to-read. * Use colors to make them stand out, instead. */ - a { color:#69f !important; text-decoration:none !important } + a:link { color:#69f !important; text-decoration:none !important } a:visited { color:#96f !important } /* quoted text in emails gets a different color */ @@ -88,9 +89,8 @@ sub sample ($$) { # usage: perl -I lib __FILE__ contrib/css/216dark.css # (See Makefile.PL) if (scalar(@ARGV) == 1 && -r __FILE__) { - use autodie; - open my $ro, '<', $ARGV[0]; - my $css = do { local $/; <$ro> }; + open my $ro, '<', $ARGV[0] or die $!; + my $css = do { local $/; <$ro> } or die $!; # indent one level: $css =~ s/^([ \t]*\S)/\t$1/smg; @@ -99,11 +99,12 @@ if (scalar(@ARGV) == 1 && -r __FILE__) { $css =~ s/;/ !important;/sg; $css =~ s/(\w) \}/$1 !important }/msg; - open my $rw, '+<', __FILE__; - my $out = do { local $/; <$rw> }; + open my $rw, '+<', __FILE__ or die $!; + my $out = do { local $/; <$rw> } or die $!; $out =~ s/^sub CSS.*^_\n\}/sub CSS () {\n\t<<'_'\n${css}_\n}/sm; seek $rw, 0, 0; - print $rw $out; + print $rw $out or die $!; + close $rw or die $!; } 1;