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.

This commit is contained in:
Lars Magne Ingebrigtsen 2010-09-10 00:07:33 +00:00 committed by Katsumi Yamaoka
parent 8fca3921b4
commit 698ecd8250
2 changed files with 14 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2010-09-09 Lars Magne Ingebrigtsen <larsi@gnus.org>
* 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.
2010-09-09 Katsumi Yamaoka <yamaoka@jpl.org> 2010-09-09 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-start.el (gnus-get-unread-articles): Set the number of unread * gnus-start.el (gnus-get-unread-articles): Set the number of unread

View file

@ -128,11 +128,9 @@ fit these criteria."
(while (re-search-forward "<a name[^\n>]+>" nil t) (while (re-search-forward "<a name[^\n>]+>" nil t)
(replace-match "" t t))) (replace-match "" t t)))
(defun gnus-html-wash-tags () (defun gnus-html-wash-images ()
(let (tag parameters string start end images url) (let (tag parameters string start end images url)
(gnus-html-pre-wash)
(goto-char (point-min)) (goto-char (point-min))
;; Search for all the images first. ;; Search for all the images first.
(while (re-search-forward "<img_alt \\([^>]*\\)>" nil t) (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t)
(setq parameters (match-string 1) (setq parameters (match-string 1)
@ -210,6 +208,13 @@ fit these criteria."
(set-marker (make-marker) start) (set-marker (make-marker) start)
(point-marker)) (point-marker))
images)))))))) images))))))))
(when images
(gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))))
(defun gnus-html-wash-tags ()
(let (tag parameters string start end images url)
(gnus-html-pre-wash)
(gnus-html-wash-images)
(goto-char (point-min)) (goto-char (point-min))
;; Then do the other tags. ;; Then do the other tags.
@ -220,7 +225,7 @@ fit these criteria."
(when (plusp (length parameters)) (when (plusp (length parameters))
(set-text-properties 0 (1- (length parameters)) nil parameters)) (set-text-properties 0 (1- (length parameters)) nil parameters))
(delete-region start (point)) (delete-region start (point))
(when (search-forward (concat "</" tag ">") (line-end-position) t) (when (search-forward (concat "</" tag ">") nil t)
(delete-region (match-beginning 0) (match-end 0))) (delete-region (match-beginning 0) (match-end 0)))
(setq end (point)) (setq end (point))
(cond (cond
@ -254,8 +259,6 @@ fit these criteria."
;; off any </pre_int>s that were left over. ;; off any </pre_int>s that were left over.
(while (re-search-forward "</pre_int>\\|</internal>" nil t) (while (re-search-forward "</pre_int>\\|</internal>" nil t)
(replace-match "" t t)) (replace-match "" t t))
(when images
(gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))
(mm-url-decode-entities))) (mm-url-decode-entities)))
(defun gnus-html-insert-image () (defun gnus-html-insert-image ()