; ; Yahoo Groups (any group in Yahoo Groups will be properly handled here). ; (defun nndoc-yahoo-groups-type-p nil "Decide whether an article is a Yahoo Groups digest" (let ((case-fold-search nil)) (if (and (re-search-forward "^X-Yahoo-Newman-Property: groups-digest$" nil t) (re-search-forward (concat "^There \\(is\\|are\\) [0-9]+ messages? in this issue.\n\n" "Topics in this digest:\n") nil t)) (progn (setq nndoc-yahoo-groups-cc nil) (goto-char (point-min)) (if (re-search-forward "^From: \\(.*\\)$" nil t) (setq nndoc-yahoo-groups-cc (match-string 1)) )) nil ))) (defun nndoc-generate-yahoo-groups-head (article) "Generate headers for a Yahoo! Groups article" (let ((entry (cdr (assq article nndoc-dissection-alist))) (subject "(none)") (from "(unknown)") date) (save-excursion (set-buffer nndoc-current-buffer) (save-restriction (narrow-to-region (car entry) (nth 3 entry)) (goto-char (point-min)) (when (re-search-forward "^ *Date: \\(.*\\)$" nil t) (setq date (match-string 1))) (goto-char (point-min)) (when (re-search-forward "^\\(Subject:\\|[0-9]+[a-z]*\\.\\) \\(.*\\)$" nil t) (setq subject (match-string 2))) (goto-char (point-min)) (when (re-search-forward "^ *\\(From\\|Posted by\\): \\(.*\\)$" nil t) (setq from (match-string 2)) ))) (insert "From: " from "\n" "Subject: " subject "\n" "Date: " date "\n") (if nndoc-yahoo-groups-cc (insert "CC: " nndoc-yahoo-groups-cc "\n")) )) (defun nndoc-transform-yahoo-groups-article (article) "Transform a Yahoo! Groups article so that it matches nndoc expectations." (save-restriction (save-excursion (goto-char (point-min)) (re-search-forward "^$" nil t) (narrow-to-region (point-min) (point)) (goto-char (point-min)) (if (re-search-forward "^ *Posted by: " nil t) (replace-match "From: ")) (goto-char (point-min)) (while (re-search-forward "^ +[^ ]+: " nil t) (beginning-of-line) (while (eq (following-char) ? ) (delete-char 1))) (goto-char (point-min)) (if (re-search-forward "^[0-9]+[a-z]*\\. " nil t) (replace-match "Subject: ")) (goto-char (point-max)) (if nndoc-yahoo-groups-cc (insert "CC: " nndoc-yahoo-groups-cc "\n")) ) )) (defun nndoc-yahoo-groups-body-end () (and (re-search-forward (concat nndoc-article-begin "\\|" nndoc-file-end) nil t) (goto-char (match-beginning 0)) (skip-chars-backward " _\t\n") (if (eq (following-char) ?\n) (progn (forward-char 1) t) t)) ) (nndoc-add-type `(yahoo-groups (article-begin . ,(concat "^" (make-string 72 ?_) "\n\n" "\\(Message:? [0-9]+\\|[0-9]+[a-z]*\\. \\)")) ;(body-end . ,(concat "^" (make-string 72 ?_) "\n")) (body-end-function . nndoc-yahoo-groups-body-end) ;(file-end . ,(concat "^" (make-string 72 ?_) "\n" ; "\\( \\|\n\\)*" ; (make-string 72 ?-) "\n" ; "Yahoo! Groups Links\n")) (file-end . ,(concat "^" (make-string 72 ?-) "\n" "Yahoo! Groups Links\n")) (generate-head-function . nndoc-generate-yahoo-groups-head) (article-transform-function . nndoc-transform-yahoo-groups-article) ))