; ; Slashdot Daily Newsletter ; ; As a special feature, any article whose URL matches ; nndoc-slashdot-article-reject will be skipped during undigestifying. ; For example, setting it to "games\\.slashdot\\.org" will suppress ; all articles relating to games. ; (defun nndoc-slashdot-type-p nil "Decide whether an article is a Slashdot digest" (let ((case-fold-search nil)) (not (not (re-search-forward "^Slashdot Daily Newsletter\n\nIn this issue:" nil t))))) (defvar nndoc-slashdot-article-reject nil "Regexp matching Slashdot article URLs that should be skipped") (setq nndoc-slashdot-article-begin-regexp (concat "^\n\\+" (make-string 68 ?-) "\\+\n")) (defun nndoc-slashdot-article-begin nil "Find the beginning of a Slashdot article, rejecting unwanted areas" (let ((case-fold-search nil) here limit (keep-looking t)) (while (and keep-looking (re-search-forward nndoc-slashdot-article-begin-regexp nil t)) (setq here (point)) (nndoc-slashdot-body-end) (setq limit (point)) (goto-char here) (if nndoc-slashdot-article-reject (when (not (and (re-search-forward "^| http://" limit 'x) (looking-at nndoc-slashdot-article-reject))) (setq keep-looking nil) (goto-char here)) )) (beginning-of-line) (not keep-looking) )) (defun nndoc-generate-slashdot-head (article) "Generate headers for a Slashdot article" (let ((entry (cdr (assq article nndoc-dissection-alist))) (subject "Couldn't find subject") (from "(unknown)") date) (save-excursion (set-buffer nndoc-current-buffer) (save-restriction (narrow-to-region (car entry) (nth 3 entry)) (goto-char (point-min)) (forward-line 1) (when (looking-at "^| *\\(.*[^ |]\\) *|$") (setq subject (match-string 1))) (when (re-search-forward "^| *posted by \\(.*\\) on \\(.*, @[0-9:]+\\) .*|" nil t) (setq from (match-string 1)) (setq date (match-string 2)) ))) (insert "From: " from "\n" "Subject: " subject "\n" "Date: " date "\n") )) (defun nndoc-slashdot-head-begin () (forward-line -1)) (defun nndoc-slashdot-body-end () (and (re-search-forward (concat nndoc-slashdot-article-begin-regexp "\\|" nndoc-file-end) nil t) (goto-char (match-beginning 0)) (skip-chars-backward " \t\n") (if (eq (following-char) ?\n) (forward-char 1))) t) (nndoc-add-type `(slashdot (article-begin-function . nndoc-slashdot-article-begin) ;(article-begin . ,(concat "^\n\\+" (make-string 68 ?-) "\\+\n")) (head-begin-function . nndoc-slashdot-head-begin) (body-end-function . nndoc-slashdot-body-end) (file-end . ,(concat "\n+Copyright 1997-[0-9]+ .*\n+" (make-string 70 ?=) "\n")) (generate-head-function . nndoc-generate-slashdot-head) ))