; ; ACLU Online newsletters ; (defun nndoc-aclu-online-type-p nil "Decide whether an article is an ACLU online newsletter" (let ((case-fold-search t)) (not (not (and (re-search-forward "^From: .*" nil t) (re-search-forward "^ACLU Online" nil t) (re-search-forward "^The e-newsletter of the American Civil Liberties Union" nil t) ))) )) (defun nndoc-generate-aclu-online-head (article) "Generate headers for an ACLU online article" (let ((entry (cdr (assq article nndoc-dissection-alist))) (subject "(none)") here) (save-excursion (set-buffer nndoc-current-buffer) (save-restriction (narrow-to-region (car entry) (nth 3 entry)) (goto-char (point-min)) (skip-chars-forward " \t\n") (if (looking-at "IN THE STATES") (forward-line 2)) (skip-chars-forward " \t\n") (setq here (point)) (end-of-line) (condition-case nil (setq subject (quoted-printable-decode-string (buffer-substring here (point)))) (error (setq subject (buffer-substring here (point))))) )) (insert "From: ACLU Online \n" "Subject: " subject "\n") )) (defun nndoc-transform-aclu-online-article (article) "Transform an ACLU online article so that it matches nndoc expectations." (let (here subject) (goto-char (point-min)) (condition-case nil (gnus-article-de-quoted-unreadable t) (error nil)) (gnus-article-fill-long-lines) (goto-char (point-min)) (skip-chars-forward " \t\n") (if (looking-at "IN THE STATES") (kill-line 2)) (skip-chars-forward " \t\n") (insert "Subject: ") (setq here (point)) (end-of-line) (condition-case nil (setq subject (quoted-printable-decode-string (buffer-substring here (point)))) (error (setq subject (buffer-substring here (point))))) (delete-region here (point)) (insert subject) ) ) (nndoc-add-type `(aclu-online (first-article . "^In This Issue:?\\(.\\|\n\\)*?\\*\\{8,\\}\n*") (article-begin . "^\\*\\{8,\\}\n*") (body-end . "^\\*\\{8,\\}$") (file-end . ,(concat "^THANK YOU FOR YOUR EXCEPTIONAL SUPPORT OF THE ACLU!" "\\|" "^American Civil Liberties Union\n" "125 Broad Street, 18th Floor$")) (generate-head-function . nndoc-generate-aclu-online-head) (article-transform-function . nndoc-transform-aclu-online-article) ))