Fixing Steve Yegge's rants
I am among many who find
Steve Yegge's rants
quite entertaining, but who also find them long enough to print rather
than read online. The problem with this is that there's a bug somewhere,
in the CSS, in Mac OS X, or in Firefox, whose result is that printing
one entry out leads to one page containing only a useless header page,
one page of content, cut off as it falls off the page, and one useless
page of comment entry form. With some help from Eric Meyer and a bit
of binary debugging, I tracked it down to a CSS property that says
overflow: hidden;
which makes me suspect that Firefox is doing exactly what it was told
to do -- hiding the "rest" of the page(s) because the entry overflowed
what would fit on one (printed) page. Since I don't really grok
javascript,
greasemonkey,
or
hoodwink'd yet, I wrote a
shell/ruby script to fix the rants to make them printable. Finding the
things to fix is made vastly easier by the excellent
Firebug plugin
for Firefox, which is roughly a WYSIWYG CSS editor and validator for
remote web pages.
Anyway, meanwhile, here's that script. It's brittle, but works for today:
#!/bin/sh
# Later, make it ruby -i.bak
# That first one is really the only thing needed to fix the printing problem.
# (Which was that it would only print one page of the rant. S.Y. could
# work around this bug by publishing normal-sized blog entries, but
# I'm not holding my breath.) The other gsub lines remove the sidebar
# and widen the main text.
ruby -p -e 'gsub( /overflow: *hidden;/ ) {|m| "/* #{m} */" }'
-e 'gsub( /width: *67%;/, "width: 95%" )'
-e 'gsub( /width: *25%;/, "width: 0%; display: none; " )'
"$@"
Sorry, I can't do much about the content, but I find them entertaining
enough that I'm not tempted to try. :-)
Usage: save the page, and then run this script with the name of that
saved file as an argument.
9:04:35 PM