summaryrefslogtreecommitdiff
path: root/lisp/gnus/gnus-html.el
diff options
context:
space:
mode:
authorGnus developers <ding@gnus.org>2010-10-04 00:17:16 +0000
committerKatsumi Yamaoka <yamaoka@jpl.org>2010-10-04 00:17:16 +0000
commita41c2e6d330243fa7b5d1537d5efb211f1c0d30c (patch)
tree5ffaa59adfee8e4fb1b83894e044b7aec9dff128 /lisp/gnus/gnus-html.el
parent728a982db42d06c3c9db5f920336709387a54cda (diff)
downloademacs-a41c2e6d330243fa7b5d1537d5efb211f1c0d30c.tar.gz
Merge changes made in Gnus trunk.
shr.el: Rename the tag functions a bit, and add some new ones. gnus-sum.el (gnus-summary-select-article-buffer): If the article buffer isn't shown, then select the current article first instead of bugging out. gnus-sum.el (gnus-summary-select-article-buffer): Show both the article and summary buffers again. shr.el (shr-tag-blockquote): Convert name. shr.el (shr-rescale-image): Use the right image-size variant. shr.el (shr-tag-p): Don't insert newlines at the start of the buffer. shr.el: Implement indentation in blockquotes. gnus-sum.el (gnus-summary-select-article-buffer): Really select the article buffer again. shr.el (shr-ensure-paragraph): Don't insert newlines on empty tags at the beginning of the buffer. gnus-ems.el, gnus-util.el, mm-decode.el, mm-view.el: Add resize for large images in mm. gnus-html.el (gnus-html-put-image): Use gnus-rescale-image. shr.el (shr-tag-p): Don't insert newlines on empty tags at the beginning of the buffer. gnus-ems.el, gnus-html.el, gnus-util.el, mm-decode.el, mm-view.el: Support image resizing. shr.el: Add headings. shr.el (shr-ensure-paragraph): Actually work. shr.el (shr-tag-li): Make <ul> prettier. shr.el (shr-insert): Get white space at the beginning/end of elements right. shr.el (shr-tag-li): Tweak <li> rendering. shr.el (shr-tag-p): Collapse subsequent <p>s. shr.el (shr-ensure-paragraph): Don't insert double line feeds after blank lines. shr.el (shr-tag-h6): Add. shr.el (shr-insert): \t is also space.
Diffstat (limited to 'lisp/gnus/gnus-html.el')
-rw-r--r--lisp/gnus/gnus-html.el44
1 files changed, 12 insertions, 32 deletions
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index c007f71f64c..0f8ba83a60c 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -105,12 +105,7 @@ CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
(match-string 0 encoded-text)))
t t encoded-text)
s (1+ s)))
- encoded-text))))
- ;; XEmacs does not have window-inside-pixel-edges
- (defalias 'gnus-window-inside-pixel-edges
- (if (fboundp 'window-inside-pixel-edges)
- 'window-inside-pixel-edges
- 'window-pixel-edges)))
+ encoded-text)))))
(defun gnus-html-encode-url (url)
"Encode URL."
@@ -436,7 +431,17 @@ Return a string with image data."
(= (car size) 30)
(= (cdr size) 30))))
;; Good image, add it!
- (let ((image (gnus-html-rescale-image image data size)))
+ (let ((image (gnus-html-rescale-image
+ image
+ ;; (width . height)
+ (cons
+ ;; Aimed width
+ (truncate
+ (* gnus-max-image-proportion
+ (- (nth 2 edges) (nth 0 edges))))
+ ;; Aimed height
+ (truncate (* gnus-max-image-proportion
+ (- (nth 3 edges) (nth 1 edges))))))))
(delete-region start end)
(gnus-put-image image alt-text 'external)
(gnus-put-text-property start (point) 'help-echo alt-text)
@@ -459,31 +464,6 @@ Return a string with image data."
(gnus-add-image 'internal image))
nil))))))))
-(defun gnus-html-rescale-image (image data size)
- (if (or (not (fboundp 'imagemagick-types))
- (not (get-buffer-window (current-buffer))))
- image
- (let* ((width (car size))
- (height (cdr size))
- (edges (gnus-window-inside-pixel-edges
- (get-buffer-window (current-buffer))))
- (window-width (truncate (* gnus-max-image-proportion
- (- (nth 2 edges) (nth 0 edges)))))
- (window-height (truncate (* gnus-max-image-proportion
- (- (nth 3 edges) (nth 1 edges)))))
- scaled-image)
- (when (> height window-height)
- (setq image (or (create-image data 'imagemagick t
- :height window-height)
- image))
- (setq size (image-size image t)))
- (when (> (car size) window-width)
- (setq image (or
- (create-image data 'imagemagick t
- :width window-width)
- image)))
- image)))
-
(defun gnus-html-image-url-blocked-p (url blocked-images)
"Find out if URL is blocked by BLOCKED-IMAGES."
(let ((ret (and blocked-images