summaryrefslogtreecommitdiff
path: root/lisp/gnus/shr.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2010-12-06 22:16:10 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-12-06 22:16:10 +0000
commitb31b26b48958fed0162d58c76dc55b2aeca22b66 (patch)
tree4221b7cc8a36f0be7397ac3866f3241b5256ccf6 /lisp/gnus/shr.el
parent67027b49796eec01dccf1e14d7b0497b2d484328 (diff)
downloademacs-b31b26b48958fed0162d58c76dc55b2aeca22b66.tar.gz
emacs-b31b26b48958fed0162d58c76dc55b2aeca22b66.tar.bz2
emacs-b31b26b48958fed0162d58c76dc55b2aeca22b66.zip
Merge changes made in Gnus trunk.
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. (shr-tag-body): Do not recolorize after shr-generic. (shr-tag-font): Let shr-generic colorize via inheritance. shr.el (shr-descend): Only colorise something if we have a node that sets colors. gnus-int.el (gnus-request-thread): Rework to take a header instead of a Message-ID to avoid having nnimap depend on gnus-sum. shr.el (shr-tag-font): Colorize the region. (shr-tag-body): Ditto. (shr-tag-font): Actually let the styles be inherited instead of overwriting them. (shr-tag-font): Get the background color right. (shr-tag-style): Ignore all <style> tags for the moment.
Diffstat (limited to 'lisp/gnus/shr.el')
-rw-r--r--lisp/gnus/shr.el41
1 files changed, 24 insertions, 17 deletions
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index 4c4f47e0225..fafe3d94dea 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -194,19 +194,19 @@ redirects somewhere else."
(style (cdr (assq :style (cdr dom))))
(shr-stylesheet shr-stylesheet)
(start (point)))
- (when (and style
- (string-match "color" style))
- (setq shr-stylesheet (nconc (shr-parse-style style)
- shr-stylesheet)))
+ (when style
+ (if (string-match "color" style)
+ (setq shr-stylesheet (nconc (shr-parse-style style)
+ shr-stylesheet))
+ (setq style nil)))
(if (fboundp function)
(funcall function (cdr dom))
(shr-generic (cdr dom)))
- (let ((color (cdr (assq 'color shr-stylesheet)))
- (background (cdr (assq 'background-color
- shr-stylesheet))))
- (when (and shr-stylesheet
- (or color background))
- (shr-colorize-region start (point) color background)))))
+ ;; If style is set, then this node has set the color.
+ (when style
+ (shr-colorize-region start (point)
+ (cdr (assq 'color shr-stylesheet))
+ (cdr (assq 'background-color shr-stylesheet))))))
(defun shr-generic (cont)
(dolist (sub cont)
@@ -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,11 +633,14 @@ 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)))
+(defun shr-tag-style (cont)
+ )
+
(defun shr-tag-p (cont)
(shr-ensure-paragraph)
(shr-indent)
@@ -837,10 +840,14 @@ ones, in case fg and bg are nil."
(shr-heading cont 'bold 'underline))
(defun shr-tag-font (cont)
- (let ((start (point))
- (color (cdr (assq :color cont))))
+ (let* ((start (point))
+ (color (cdr (assq :color cont)))
+ (shr-stylesheet (nconc (list (cons 'color color))
+ shr-stylesheet)))
(shr-generic cont)
- (shr-colorize-region start (point) color)))
+ (when color
+ (shr-colorize-region start (point) color
+ (cdr (assq 'background-color shr-stylesheet))))))
;;; Table rendering algorithm.
@@ -1040,7 +1047,7 @@ ones, in case fg and bg are nil."
(insert cache)
(let ((shr-width width)
(shr-indentation 0))
- (shr-generic cont))
+ (shr-descend (cons 'td cont)))
(delete-region
(point)
(+ (point)