--- nnrss.el.orig 2005-12-21 12:43:03.000000000 -0500 +++ nnrss.el 2006-01-02 12:30:51.000000000 -0500 @@ -208,40 +208,47 @@ rfc2047-encode-encoded-words body) (when (or text link enclosure comments) (insert "\n") - (insert "<#multipart type=alternative>\n" - "<#part type=\"text/plain\">\n") - (setq body (point)) - (when text - (insert text) - (goto-char body) - ;; See `nnrss-check-group', which inserts "

". - (if (search-forward "

" nil t) - (if (eobp) - (replace-match "\n") - (replace-match "\n\n") - (let ((fill-column default-fill-column) - (window (get-buffer-window nntp-server-buffer))) - (when window - (setq fill-column - (max 1 (/ (* (window-width window) 7) 8)))) - (fill-region (point) (point-max)) - (goto-char (point-max)) - ;; XEmacs version of `fill-region' inserts newline. - (unless (bolp) - (insert "\n")))) - (goto-char (point-max)) - (insert "\n")) - (when (or link enclosure) - (insert "\n"))) - (when link - (insert link "\n")) - (when enclosure - (insert (car enclosure) " " - (nth 2 enclosure) " " - (nth 3 enclosure) "\n")) - (when comments - (insert comments "\n")) - (setq body (buffer-substring body (point))) + (insert "<#multipart type=alternative>\n") + ;; If text contains HTML, don't generate a text/plain part + ;; FIXME: The regexp is not very smart. A regexp probably isn't + ;; the right thing to use anyhow. It means any article which has + ;; had "

" inserted by nnrss-check-group will have no + ;; text/plain part. + (if (not (string-match "<[a-zA-Z]+[^>]*>" text)) + (progn + (insert "<#part type=\"text/plain\">\n") + (setq body (point)) + (when text + (insert text) + (goto-char body) + ;; See `nnrss-check-group', which inserts "

". + (if (search-forward "

" nil t) + (if (eobp) + (replace-match "\n") + (replace-match "\n\n") + (let ((fill-column default-fill-column) + (window (get-buffer-window nntp-server-buffer))) + (when window + (setq fill-column + (max 1 (/ (* (window-width window) 7) 8)))) + (fill-region (point) (point-max)) + (goto-char (point-max)) + ;; XEmacs version of `fill-region' inserts newline. + (unless (bolp) + (insert "\n")))) + (goto-char (point-max)) + (insert "\n")) + (when (or link enclosure) + (insert "\n"))) + (when link + (insert link "\n")) + (when enclosure + (insert (car enclosure) " " + (nth 2 enclosure) " " + (nth 3 enclosure) "\n")) + (when comments + (insert comments "\n")) + (setq body (buffer-substring body (point))))) (insert "<#/part>\n" "<#part type=\"text/html\">\n" "\n")