diff lisp/gnus/gnus-html.el @ 110295:f70d39f7b8fd

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.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Fri, 10 Sep 2010 00:07:33 +0000
parents 8c1028027f1b
children fb6801a4089a
line wrap: on
line diff
--- a/lisp/gnus/gnus-html.el	Thu Sep 09 22:44:15 2010 +0000
+++ b/lisp/gnus/gnus-html.el	Fri Sep 10 00:07:33 2010 +0000
@@ -128,11 +128,9 @@
   (while (re-search-forward "<a name[^\n>]+>" nil t)
     (replace-match "" t t)))
 
-(defun gnus-html-wash-tags ()
+(defun gnus-html-wash-images ()
   (let (tag parameters string start end images url)
-    (gnus-html-pre-wash)
     (goto-char (point-min))
-
     ;; Search for all the images first.
     (while (re-search-forward "<img_alt \\([^>]*\\)>" nil t)
       (setq parameters (match-string 1)
@@ -210,6 +208,13 @@
 			      (set-marker (make-marker) start)
 			      (point-marker))
 			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))
     ;; Then do the other tags.
@@ -220,7 +225,7 @@
       (when (plusp (length parameters))
 	(set-text-properties 0 (1- (length parameters)) nil parameters))
       (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)))
       (setq end (point))
       (cond
@@ -254,8 +259,6 @@
     ;; off any </pre_int>s that were left over.
     (while (re-search-forward "</pre_int>\\|</internal>" nil t)
       (replace-match "" t t))
-    (when images
-      (gnus-html-schedule-image-fetching (current-buffer) (nreverse images)))
     (mm-url-decode-entities)))
 
 (defun gnus-html-insert-image ()