(nndoc-type-alist, nndoc-lanl-gov-announce-type-p)
authorKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 24 Apr 2002 11:25:09 +0000 (11:25 +0000)
committerKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 24 Apr 2002 11:25:09 +0000 (11:25 +0000)
(nndoc-transform-lanl-gov-announce, nndoc-generate-lanl-gov-head):
Recognize math postings properly.  Extract Date and email address
correctly.  Create Date and From header for revised versions.  Get
rid of spurious \\ lines.  Detect end of message correctly.
Correctly rephrase the URL.

lisp/ChangeLog
lisp/nndoc.el

index 4c9d84d..74c118f 100644 (file)
@@ -1,3 +1,13 @@
+2002-04-24  Kai Gro\e,A_\e(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+       From Dan Christensen <jdc+news@uwo.ca>.
+       
+       * nndoc.el (nndoc-type-alist, nndoc-lanl-gov-announce-type-p)
+       (nndoc-transform-lanl-gov-announce, nndoc-generate-lanl-gov-head):
+       Recognize math postings properly.  Extract Date and email address
+       correctly.  Create Date and From header for revised versions.  Get
+       rid of spurious \\ lines.  Detect end of message correctly.
+       Correctly rephrase the URL.
+
 2002-04-23  Simon Josefsson  <jas@extundo.com>
 
        * netrc.el: New file, functions copied from gnus-util.el by Ted
index b3a287b..51d83ef 100644 (file)
@@ -123,8 +123,8 @@ from the document.")
      (head-begin . "^Paper.*:")
      (head-end   . "\\(^\\\\\\\\.*\n\\|-----------------\\)")
      (body-begin . "")
-     (body-end   . "-------------------------------------------------")
-     (file-end   . "^Title: Recent Seminal")
+     (body-end   . "\\(-------------------------------------------------\\|%-%-%-%-%-%-%-%-%-%-%-%-%-%-\\|%%--%%--%%--%%--%%--%%--%%--%%--\\|%%%---%%%---%%%---%%%---\\)")
+     (file-end   . "\\(^Title: Recent Seminal\\|%%%---%%%---%%%---%%%---\\)")
      (generate-head-function . nndoc-generate-lanl-gov-head)
      (article-transform-function . nndoc-transform-lanl-gov-announce)
      (subtype preprints guess))
@@ -597,35 +597,54 @@ from the document.")
 
 (defun nndoc-lanl-gov-announce-type-p ()
   (when (let ((case-fold-search nil))
-         (re-search-forward "^\\\\\\\\\nPaper: [a-z-]+/[0-9]+" nil t))
+         (re-search-forward "^\\\\\\\\\nPaper\\( (\\*cross-listing\\*)\\)?: [a-zA-Z-\\.]+/[0-9]+" nil t))
     t))
 
 (defun nndoc-transform-lanl-gov-announce (article)
   (goto-char (point-max))
-  (when (re-search-backward "^\\\\\\\\ +(\\([^ ]*\\) , *\\([^ ]*\\))" nil t)
-    (replace-match "\n\nGet it at \\1 (\\2)" t nil)))
+  (when (re-search-backward "^\\\\\\\\ +( *\\([^ ]*\\) , *\\([^ ]*\\))" nil t)
+    (replace-match "\n\nGet it at \\1 (\\2)" t nil))
+  (goto-char (point-min))
+  (while (re-search-forward "^\\\\\\\\$" nil t)
+    (replace-match "" t nil))
+  (goto-char (point-min))
+  (when (re-search-forward "^replaced with revised version +\\(.*[^ ]\\) +" nil t)
+    (replace-match "Date: \\1 (revised) " t nil))
+  (goto-char (point-min))
+  (unless (re-search-forward "^From" nil t)
+    (goto-char (point-min))
+    (when (re-search-forward "^Authors?: \\(.*\\)" nil t)
+      (goto-char (point-min))
+      (insert "From: " (match-string 1) "\n"))))
 
 (defun nndoc-generate-lanl-gov-head (article)
   (let ((entry (cdr (assq article nndoc-dissection-alist)))
-       (e-mail "no address given")
-       subject from)
+       (from "<no address given>")
+       subject date)
     (save-excursion
       (set-buffer nndoc-current-buffer)
       (save-restriction
        (narrow-to-region (car entry) (nth 1 entry))
        (goto-char (point-min))
-       (when (looking-at "^Paper.*: \\([a-z-]+/[0-9]+\\)")
+       (when (looking-at "^Paper.*: \\([a-zA-Z-\\.]+/[0-9]+\\)")
          (setq subject (concat " (" (match-string 1) ")"))
-         (when (re-search-forward "^From: \\([^ ]+\\)" nil t)
-           (setq e-mail (match-string 1)))
+         (when (re-search-forward "^From: \\(.*\\)" nil t)
+           (setq from (concat "<"
+                              (cadr (funcall gnus-extract-address-components 
+                                             (match-string 1))) ">")))
+         (if (re-search-forward "^Date: +\\([^(]*\\)" nil t)
+             (setq date (match-string 1))
+           (when (re-search-forward "^replaced with revised version +\\([^(]*\\)" nil t)
+             (setq date (match-string 1))))
          (when (re-search-forward "^Title: \\([^\f]*\\)\nAuthors?: \\(.*\\)"
                                   nil t)
            (setq subject (concat (match-string 1) subject))
-           (setq from (concat (match-string 2) " <" e-mail ">"))))))
+           (setq from (concat (match-string 2) " " from))))))
     (while (and from (string-match "(\[^)\]*)" from))
       (setq from (replace-match "" t t from)))
     (insert "From: "  (or from "unknown")
-           "\nSubject: " (or subject "(no subject)") "\n")))
+           "\nSubject: " (or subject "(no subject)") "\n")
+    (if date (insert "Date: " date))))
 
 (defun nndoc-nsmail-type-p ()
   (when (looking-at "From - ")