diff options
| author | Lars Magne Ingebrigtsen | 2010-09-10 00:07:33 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-09-10 00:07:33 +0000 |
| commit | 698ecd82508a27e23eec06a3113bbfeafb8d8b4c (patch) | |
| tree | 95e9201928f5976b20cff8193b21f00c59276a5b | |
| parent | 8fca3921b4de81848db0d8781c02d26f458bdaa6 (diff) | |
| download | emacs-698ecd82508a27e23eec06a3113bbfeafb8d8b4c.tar.gz emacs-698ecd82508a27e23eec06a3113bbfeafb8d8b4c.zip | |
gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and don't restrict end-tag searches to the end of the line.
| -rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-html.el | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index d810df8c7e9..28bbcc341ea 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-09-09 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * gnus-html.el (gnus-html-wash-tags): Refactor out the image bit, and | ||
| 4 | don't restrict end-tag searches to the end of the line. | ||
| 5 | |||
| 1 | 2010-09-09 Katsumi Yamaoka <yamaoka@jpl.org> | 6 | 2010-09-09 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 7 | ||
| 3 | * gnus-start.el (gnus-get-unread-articles): Set the number of unread | 8 | * gnus-start.el (gnus-get-unread-articles): Set the number of unread |
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el index 03089414e3f..8bfbaaa5279 100644 --- a/lisp/gnus/gnus-html.el +++ b/lisp/gnus/gnus-html.el | |||
| @@ -128,11 +128,9 @@ fit these criteria." | |||
| 128 | (while (re-search-forward "<a name[^\n>]+>" nil t) | 128 | (while (re-search-forward "<a name[^\n>]+>" nil t) |
| 129 | (replace-match "" t t))) | 129 | (replace-match "" t t))) |
| 130 | 130 | ||
| 131 | (defun gnus-html-wash-tags () | 131 | (defun gnus-html-wash-images () |
| 132 | (let (tag parameters string start end images url) | 132 | (let (tag parameters string start end images url) |
| 133 | (gnus-html-pre-wash) | ||
| 134 | (goto-char (point-min)) | 133 | (goto-char (point-min)) |
| 135 | |||
| 136 | ;; Search for all the images first. | 134 | ;; Search for all the images first. |
| 137 | (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) | 135 | (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) |
| 138 | (setq parameters (match-string 1) | 136 | (setq parameters (match-string 1) |
| @@ -210,6 +208,13 @@ fit these criteria." | |||
| 210 | (set-marker (make-marker) start) | 208 | (set-marker (make-marker) start) |
| 211 | (point-marker)) | 209 | (point-marker)) |
| 212 | images)))))))) | 210 | images)))))))) |
| 211 | (when images | ||
| 212 | (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))))) | ||
| 213 | |||
| 214 | (defun gnus-html-wash-tags () | ||
| 215 | (let (tag parameters string start end images url) | ||
| 216 | (gnus-html-pre-wash) | ||
| 217 | (gnus-html-wash-images) | ||
| 213 | 218 | ||
| 214 | (goto-char (point-min)) | 219 | (goto-char (point-min)) |
| 215 | ;; Then do the other tags. | 220 | ;; Then do the other tags. |
| @@ -220,7 +225,7 @@ fit these criteria." | |||
| 220 | (when (plusp (length parameters)) | 225 | (when (plusp (length parameters)) |
| 221 | (set-text-properties 0 (1- (length parameters)) nil parameters)) | 226 | (set-text-properties 0 (1- (length parameters)) nil parameters)) |
| 222 | (delete-region start (point)) | 227 | (delete-region start (point)) |
| 223 | (when (search-forward (concat "</" tag ">") (line-end-position) t) | 228 | (when (search-forward (concat "</" tag ">") nil t) |
| 224 | (delete-region (match-beginning 0) (match-end 0))) | 229 | (delete-region (match-beginning 0) (match-end 0))) |
| 225 | (setq end (point)) | 230 | (setq end (point)) |
| 226 | (cond | 231 | (cond |
| @@ -254,8 +259,6 @@ fit these criteria." | |||
| 254 | ;; off any </pre_int>s that were left over. | 259 | ;; off any </pre_int>s that were left over. |
| 255 | (while (re-search-forward "</pre_int>\\|</internal>" nil t) | 260 | (while (re-search-forward "</pre_int>\\|</internal>" nil t) |
| 256 | (replace-match "" t t)) | 261 | (replace-match "" t t)) |
| 257 | (when images | ||
| 258 | (gnus-html-schedule-image-fetching (current-buffer) (nreverse images))) | ||
| 259 | (mm-url-decode-entities))) | 262 | (mm-url-decode-entities))) |
| 260 | 263 | ||
| 261 | (defun gnus-html-insert-image () | 264 | (defun gnus-html-insert-image () |