Subject: Re: shr should allow user to toggle HTML-specified colors on and off

From: Ivan Shmakov <[email-masked]>
Date: Thu, 03 Apr 2014 08:37:09 +0000

>>>>> Ivan Shmakov <[email-masked]> writes:

 > Badly-formatted netnews articles aren’t unknown in Usenet, so Gnus
 > already comes with a set of commands [1] to improve the formatting of
 > the messages as they’re shown to the user.

 > I’d argue, however, that ugly HTML documents are much more common on
 > the Web than such articles are on Usenet.  Granted, shr.el does not
 > (as of yet) support a good deal of features casually used to degrade
 > the reader’s experience.

	(Such as, for instance, font-size:, especially when combined
	with a non-‘auto’ width:.)

 > Still, it supports the ‘fgcolor’, ‘text’ and ‘bgcolor’ attributes to
 > <body />, and the ‘color’ attribute to <font />, leaving the user no
 > easy way to get rid of whatever color scheme the Web page author has
 > decided to use.

	And, well, it also supports the color-related CSS properties, at
	least those specified via the ‘style’ HTML attribute.

[…]

 > As a crude (but working) workaround, those suffering of the “too much
 > color” problem may choose to redefine the shr-tag-body and
 > shr-tag-font element handlers to simplistic wrappers around
 > shr-generic in their ~/.emacs, like:

[…]

	I stand corrected: this workaround does not help with the CSS
	(‘style’ attribute) color settings.  Redefining
	shr-colorize-region to a no-op, however, seems to work:

(eval-after-load 'shr
  '(defun shr-colorize-region (start end fg &optional bg)
     nil))

	A proper solution would probably be to allow for a custom
	initial stylesheet, along with a proper cascading implementation
	(including the ‘!important’ flag handling), so that the user
	could both specify the default appearance, /and/ override the
	explicit styles as set by the HTML document being rendered.

 > [1] http://www.gnu.org/software/emacs/manual/html_node/gnus/Article-Washing.html

[…]

-- 
FSF associate member #7257