Add Eric Marsden's patch.
[gnus] / lisp / nnwarchive.el
index a9d2dbb..8c0d443 100644 (file)
      (t
       (nnweb-insert (apply 'format (nnwarchive-eval xurl)))))))
 
-(defun nnwarchive-decode-entities ()
-  (goto-char (point-min))
-  (while (re-search-forward "&\\(#[0-9]+\\|[a-z]+\\);" nil t)
-    (replace-match (char-to-string 
-                   (if (eq (aref (match-string 1) 0) ?\#)
-                       (string-to-number (substring (match-string 1) 1))
-                     (or (cdr (assq (intern (match-string 1))
-                                    w3-html-entities))
-                         ?#)))
-                  t t)))
-
-(defun nnwarchive-decode-entities-string (str)
-  (with-temp-buffer
-    (insert str)
-    (nnwarchive-decode-entities)
-    (buffer-substring (point-min) (point-max))))
-
-(defun nnwarchive-remove-markup ()
-  (goto-char (point-min))
-  (while (search-forward "<!--" nil t)
-    (delete-region (match-beginning 0)
-                  (or (search-forward "-->" nil t)
-                      (point-max))))
-  (goto-char (point-min))
-  (while (re-search-forward "<[^>]+>" nil t)
-    (replace-match "" t t)))
-
-(defun nnwarchive-date-to-date (sdate)
-  (let ((elem (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))))
-
 (defun nnwarchive-generate-active ()
   (save-excursion
     (set-buffer nntp-server-buffer)
               article
               (make-full-mail-header
                article 
-               (nnwarchive-decode-entities-string subject)
-               (nnwarchive-decode-entities-string from)
+               (nnweb-decode-entities-string subject)
+               (nnweb-decode-entities-string from)
                date
                (concat "<" group "%"
                        (number-to-string article) 
   (goto-char (point-min))
   (while (re-search-forward "<a[^>]+>\\([^<]+\\)</a>" nil t)
     (replace-match "<\\1>"))
-  (nnwarchive-decode-entities)
+  (nnweb-decode-entities)
   (buffer-string))
 
 (defun nnwarchive-egroups-xover-files (group articles)
               article
               (make-full-mail-header
                article 
-               (nnwarchive-decode-entities-string subject)
-               (nnwarchive-decode-entities-string from)
+               (nnweb-decode-entities-string subject)
+               (nnweb-decode-entities-string from)
                date
                (format "<%05d%%%s>\n" (1- article) group)
                ""
       (when (search-forward "X-Head-End" nil t)
        (beginning-of-line)
        (narrow-to-region (point-min) (point))
-       (nnwarchive-decode-entities)
+       (nnweb-decode-entities)
        (goto-char (point-min))
        (while (search-forward "<!--X-" nil t)
          (replace-match ""))
        (search-forward "</ul>" nil t)
        (end-of-line)
        (narrow-to-region (point-min) (point))
-       (nnwarchive-remove-markup)
-       (nnwarchive-decode-entities)
+       (nnweb-remove-markup)
+       (nnweb-decode-entities)
        (goto-char (point-min))
        (delete-blank-lines)
        (when from
                (delete-region (match-beginning 0) (match-end 0))
                (save-restriction
                  (narrow-to-region p (point))
-                 (nnwarchive-remove-markup)
-                 (nnwarchive-decode-entities)
+                 (nnweb-remove-markup)
+                 (nnweb-decode-entities)
                  (goto-char (point-max)))))
             ((looking-at "<P><A HREF=\"\\([^\"]+\\)")
              (setq url (match-string 1))