shr-colorize-region: colorize bg, shr-tag-body: fix stylesheet
authorJulien Danjou <julien@danjou.info>
Mon, 6 Dec 2010 16:46:18 +0000 (17:46 +0100)
committerJulien Danjou <julien@danjou.info>
Mon, 6 Dec 2010 16:46:18 +0000 (17:46 +0100)
Signed-off-by: Julien Danjou <julien@danjou.info>
lisp/ChangeLog
lisp/shr.el

index e743aea..2b643d4 100644 (file)
@@ -2,6 +2,8 @@
 
        * shr.el (shr-render-td): Render td content with shr-descend, so style
        will be applied to <td> too.
+       (shr-colorize-region): Colorize region even if we only have a background.
+       (shr-tag-body): Fix color and background color inheritance.
 
 2010-12-06  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index f7ae969..8803f39 100644 (file)
@@ -586,7 +586,7 @@ ones, in case fg and bg are nil."
                (shr-color-visible bg fg)))))))
 
 (defun shr-colorize-region (start end fg &optional bg)
-  (when fg
+  (when (or fg bg)
     (let ((new-colors (shr-color-check fg bg)))
       (when new-colors
        (shr-put-color start end :foreground (cadr new-colors))
@@ -633,8 +633,8 @@ ones, in case fg and bg are nil."
   (let* ((start (point))
         (fgcolor (cdr (assq :fgcolor cont)))
         (bgcolor (cdr (assq :bgcolor cont)))
-        (shr-stylesheet (list (cons :color fgcolor)
-                              (cons :background-color bgcolor))))
+        (shr-stylesheet (list (cons 'color fgcolor)
+                              (cons 'background-color bgcolor))))
     (shr-generic cont)
     (shr-colorize-region start (point) fgcolor bgcolor)))