Move en/disable multibyte.
[gnus] / lisp / nnslashdot.el
index 1d1491e..7d7ebf4 100644 (file)
@@ -1,5 +1,5 @@
 ;;; nnslashdot.el --- interfacing with Slashdot
-;; Copyright (C) 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
            (when (numberp article)
              (if (= article 1)
                  (progn
-                   (re-search-forward "Posted by <[^>]+>[^>]*<[^>]+> on ")
+                   (re-search-forward "Posted by *<[^>]+>[^>]*<[^>]+> *on ")
                    (search-forward "<BR>")
                    (setq contents
                          (buffer-substring
        (erase-buffer)
        (insert contents)
        (goto-char (point-min))
-       (while (search-forward "<br><br>" nil t)
+       (while (re-search-forward "\\(<br>\r?\\)+" nil t)
          (replace-match "<p>" t t))
        (goto-char (point-min))
        (insert "Content-Type: text/html\nMIME-Version: 1.0\n")
              (narrow-to-region (point) (search-forward "</story>"))
              (goto-char (point-min))
              (re-search-forward "<title>\\([^<]+\\)</title>")
-             (setq description (nnweb-decode-entities-string (match-string 1)))
+             (setq description
+                   (nnweb-decode-entities-string (match-string 1)))
              (re-search-forward "<url>\\([^<]+\\)</url>")
              (setq sid (match-string 1))
-             (string-match "/\\([0-9/]+\\).shtml" sid)
-             (setq sid (match-string 1 sid))
+             (string-match "/\\([0-9/]+\\)\\(.shtml\\|$\\)" sid)
+             (setq sid (concat "00/" (match-string 1 sid)))
              (re-search-forward "<comments>\\([^<]+\\)</comments>")
              (setq articles (string-to-number (match-string 1)))
              (setq gname (concat description " (" sid ")"))
                (nnweb-insert (format nnslashdot-active-url number) t)
                (goto-char (point-min))
                (while (re-search-forward
-                       "article.pl\\?sid=\\([^&]+\\).*<b>\\([^<]+\\)</b>" nil t)
+                       "article.pl\\?sid=\\([^&]+\\).*<b>\\([^<]+\\)</b>"
+                       nil t)
                  (setq sid (match-string 1)
-                       description (nnweb-decode-entities-string (match-string 2)))
+                       description
+                       (nnweb-decode-entities-string (match-string 2)))
                  (forward-line 1)
                  (when (re-search-forward "<b>\\([0-9]+\\)</b>" nil t)
                    (setq articles (string-to-number (match-string 1))))
             (format " *nnslashdot %s*" server))))))
 
 (defun nnslashdot-date-to-date (sdate)
-  (let ((elem (delete "" (split-string sdate))))
-    (concat (substring (nth 0 elem) 0 3) " "
-           (substring (nth 1 elem) 0 3) " "
-           (substring (nth 2 elem) 0 2) " "
-           (substring (nth 3 elem) 1 6) " "
-           (format-time-string "%Y") " "
-           (nth 4 elem))))
+  (condition-case err
+      (let ((elem (delete "" (split-string sdate))))
+       (concat (substring (nth 0 elem) 0 3) " "
+               (substring (nth 1 elem) 0 3) " "
+               (substring (nth 2 elem) 0 2) " "
+               (substring (nth 3 elem) 1 6) " "
+               (format-time-string "%Y") " "
+               (nth 4 elem)))
+    (error "")))
 
 (defun nnslashdot-generate-active ()
   (save-excursion