Use the normal HTML rendering code instead of the special HTML washing code.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 20 Oct 2010 17:12:57 +0000 (19:12 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Wed, 20 Oct 2010 17:12:57 +0000 (19:12 +0200)
lisp/ChangeLog
lisp/gnus-art.el
lisp/mm-view.el
lisp/nnrss.el

index de28bc7..731a1fa 100644 (file)
@@ -1,7 +1,12 @@
 2010-10-20  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * gnus-art.el (article-wash-html): Simplify and remove the charset
+       stuff.  Use the normal html rendering code instead of the special html
+       washing code.
+
        * mm-view.el (mm-text-html-renderer-alist): Add the `shr' and
        `gnus-w3m' symbols.
+       (mm-text-html-washer-alist): Removed.
 
        * mm-decode.el (mm-inline-text-html-renderer): Removed.
        (mm-inline-media-tests): Removed use.
index cf39176..530e72f 100644 (file)
@@ -2694,118 +2694,16 @@ If READ-CHARSET, ask for a coding system."
     (when (interactive-p)
       (gnus-treat-article nil))))
 
-
-(defun article-wash-html (&optional read-charset)
-  "Format an HTML article.
-If READ-CHARSET, ask for a coding system.  If it is a number, the
-charset defined in `gnus-summary-show-article-charset-alist' is used."
-  (interactive "P")
-  (save-excursion
-    (let ((inhibit-read-only t)
-         charset)
-      (if read-charset
-         (if (or (and (numberp read-charset)
-                      (setq charset
-                            (cdr
-                             (assq read-charset
-                                   gnus-summary-show-article-charset-alist))))
-                 (setq charset (mm-read-coding-system "Charset: ")))
-             (let ((gnus-summary-show-article-charset-alist
-                    (list (cons 1 charset))))
-               (with-current-buffer gnus-summary-buffer
-                 (gnus-summary-show-article 1)))
-           (error "No charset is given"))
-       (when (gnus-buffer-live-p gnus-original-article-buffer)
-         (with-current-buffer gnus-original-article-buffer
-           (let* ((ct (gnus-fetch-field "content-type"))
-                  (ctl (and ct (mail-header-parse-content-type ct))))
-             (setq charset (and ctl
-                                (mail-content-type-get ctl 'charset)))
-             (when (stringp charset)
-               (setq charset (intern (downcase charset)))))))
-       (unless charset
-         (setq charset gnus-newsgroup-charset)))
-      (article-goto-body)
-      (save-window-excursion
-       (save-restriction
-         (narrow-to-region (point) (point-max))
-         (let* ((func mm-text-html-renderer)
-                (entry (assq func mm-text-html-washer-alist)))
-           (when entry
-             (setq func (cdr entry)))
-           (cond
-            ((functionp func)
-             (funcall func))
-            (t
-             (apply (car func) (cdr func))))))))))
-
-;; External.
-(declare-function w3-region "ext:w3-display" (st nd))
-
-(defun gnus-article-wash-html-with-w3 ()
-  "Wash the current buffer with w3."
-  (mm-setup-w3)
-  (let ((w3-strict-width (window-width))
-       (url-standalone-mode t)
-       (url-gateway-unplugged t)
-       (w3-honor-stylesheets nil))
-    (condition-case ()
-       (w3-region (point-min) (point-max))
-      (error))))
-
-;; External.
-(declare-function w3m-region "ext:w3m" (start end &optional url charset))
-
-(defun gnus-article-wash-html-with-w3m ()
-  "Wash the current buffer with emacs-w3m."
-  (mm-setup-w3m)
-  (let ((w3m-safe-url-regexp mm-w3m-safe-url-regexp)
-       w3m-force-redisplay)
-    (w3m-region (point-min) (point-max)))
-  ;; Put the mark meaning this part was rendered by emacs-w3m.
-  (put-text-property (point-min) (point-max) 'mm-inline-text-html-with-w3m t)
-  (when (and mm-inline-text-html-with-w3m-keymap
-            (boundp 'w3m-minor-mode-map)
-            w3m-minor-mode-map)
-    (if (and (boundp 'w3m-link-map)
-            w3m-link-map)
-       (let* ((start (point-min))
-              (end (point-max))
-              (on (get-text-property start 'w3m-href-anchor))
-              (map (copy-keymap w3m-link-map))
-              next)
-         (set-keymap-parent map w3m-minor-mode-map)
-         (while (< start end)
-           (if on
-               (progn
-                 (setq next (or (text-property-any start end
-                                                   'w3m-href-anchor nil)
-                                end))
-                 (put-text-property start next 'keymap map))
-             (setq next (or (text-property-not-all start end
-                                                   'w3m-href-anchor nil)
-                            end))
-             (put-text-property start next 'keymap w3m-minor-mode-map))
-           (setq start next
-                 on (not on))))
-      (put-text-property (point-min) (point-max) 'keymap w3m-minor-mode-map))))
-
-(defvar charset) ;; Bound by `article-wash-html'.
-
-(defun gnus-article-wash-html-with-w3m-standalone ()
-  "Wash the current buffer with w3m."
-  (if (mm-w3m-standalone-supports-m17n-p)
-      (progn
-       (unless (mm-coding-system-p charset) ;; Bound by `article-wash-html'.
-         ;; The default.
-         (setq charset 'iso-8859-1))
-       (let ((coding-system-for-write charset)
-             (coding-system-for-read charset))
-         (call-process-region
-          (point-min) (point-max)
-          "w3m" t t nil "-dump" "-T" "text/html"
-          "-I" (symbol-name charset) "-O" (symbol-name charset))))
-    (mm-inline-wash-with-stdin nil "w3m" "-dump" "-T" "text/html")))
+(defun article-wash-html ()
+  "Format an HTML article."
+  (interactive)
+  (let ((handles nil)
+       (buffer-read-only nil))
+    (when (gnus-buffer-live-p gnus-original-article-buffer)
+      (setq handles (mm-dissect-buffer t t)))
+    (article-goto-body)
+    (delete-region (point) (point-max))
+    (mm-inline-text-html handles)))
 
 (defvar gnus-article-browse-html-temp-list nil
   "List of temporary files created by `gnus-article-browse-html-parts'.
index 5866b81..abe761b 100644 (file)
 
 (defvar mm-text-html-renderer-alist
   '((shr . mm-shr)
-    (w3  . mm-inline-text-html-render-with-w3)
+    (w3 . mm-inline-text-html-render-with-w3)
     (w3m . mm-inline-text-html-render-with-w3m)
     (w3m-standalone . mm-inline-text-html-render-with-w3m-standalone)
     (gnus-w3m . gnus-article-html)
     (links mm-inline-render-with-file
           mm-links-remove-leading-blank
           "links" "-dump" file)
-    (lynx  mm-inline-render-with-stdin nil
-          "lynx" "-dump" "-force_html" "-stdin" "-nolist")
-    (html2text  mm-inline-render-with-function html2text))
+    (lynx mm-inline-render-with-stdin nil
+         "lynx" "-dump" "-force_html" "-stdin" "-nolist")
+    (html2text mm-inline-render-with-function html2text))
   "The attributes of renderer types for text/html.")
 
-(defvar mm-text-html-washer-alist
-  '((w3  . gnus-article-wash-html-with-w3)
-    (w3m . gnus-article-wash-html-with-w3m)
-    (w3m-standalone . gnus-article-wash-html-with-w3m-standalone)
-    (links mm-inline-wash-with-file
-          mm-links-remove-leading-blank
-          "links" "-dump" file)
-    (lynx  mm-inline-wash-with-stdin nil
-          "lynx" "-dump" "-force_html" "-stdin" "-nolist")
-    (html2text  html2text))
-  "The attributes of washer types for text/html.")
-
 (defcustom mm-fill-flowed t
   "If non-nil a format=flowed article will be displayed flowed."
   :type 'boolean
index ebe8c51..e3ce6db 100644 (file)
@@ -198,7 +198,6 @@ used to render text.  If it is nil, text will simply be folded.")
   t)
 
 (defvar mm-text-html-renderer)
-(defvar mm-text-html-washer-alist)
 
 (deffoo nnrss-request-article (article &optional group server buffer)
   (setq group (nnrss-decode-group-name group))