From: Lars Magne Ingebrigtsen Date: Tue, 5 Oct 2010 14:46:32 +0000 (+0200) Subject: Put all the images after the table. X-Git-Url: https://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=8bd5a3e1db9e7853787c77a43e6bfc0f6349c303;hp=b0ef718a043049f862200b723848ca1453a16ec5 Put all the images after the table. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff45fa5e2..a0f925194 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-10-05 Lars Magne Ingebrigtsen + * shr.el (shr-find-elements): New function. + (shr-tag-table): Put all the images after the table. + * mm-decode.el (mm-shr): Bind shr-blocked-images to gnus-blocked-images. diff --git a/lisp/shr.el b/lisp/shr.el index f905bf5ac..d6eb19e70 100644 --- a/lisp/shr.el +++ b/lisp/shr.el @@ -56,6 +56,7 @@ fit these criteria." (defvar shr-state nil) (defvar shr-start nil) (defvar shr-indentation 0) +(defvar shr-inhibit-images nil) (defvar shr-width 70) @@ -204,8 +205,10 @@ redirects somewhere else." (when (zerop (length alt)) (setq alt "[img]")) (cond - ((and shr-blocked-images - (string-match shr-blocked-images url)) + ((or shr-inhibit-images + (and shr-blocked-images + (string-match shr-blocked-images url))) + (setq shr-start (point)) (insert alt)) ((url-is-cached (browse-url-url-encode-chars url "[&)$ ]")) (shr-put-image (shr-get-image-data url) (point) alt)) @@ -414,8 +417,20 @@ Return a string with image data." (let* ((columns (shr-column-specs cont)) (suggested-widths (shr-pro-rate-columns columns)) (sketch (shr-make-table cont suggested-widths)) - (sketch-widths (shr-table-widths sketch (length suggested-widths)))) - (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths))) + (sketch-widths (shr-table-widths sketch (length suggested-widths))) + (shr-inhibit-images t)) + (shr-insert-table (shr-make-table cont sketch-widths t) sketch-widths)) + (dolist (elem (shr-find-elements cont 'img)) + (shr-tag-img (cdr elem)))) + +(defun shr-find-elements (cont type) + (let (result) + (dolist (elem cont) + (cond ((eq (car elem) type) + (push elem result)) + ((consp (cdr elem)) + (setq result (nconc (shr-find-elements (cdr elem) type) result))))) + (nreverse result))) (defun shr-insert-table (table widths) (shr-insert-table-ruler widths)