; ; Photography on the Net Forums updates ; (defun nndoc-potn-forum-type-p nil "Decide whether an article is a photography-on-the.net forum update" (let ((case-fold-search nil)) (not (not (and (re-search-forward "^From: .*" nil t) (re-search-forward "^You are subscribed to the thread " nil t) (re-search-forward "^These following posts were made to the thread:" nil t) ))) )) (defun nndoc-generate-potn-forum-head (article) "Generate headers for a POTN forum article" (let ((entry (cdr (assq article nndoc-dissection-alist))) (from "(unknown)") (subject "(none)") here) (save-excursion (set-buffer nndoc-current-buffer) (save-restriction (narrow-to-region (car entry) (nth 3 entry)) (goto-char (point-min)) (end-of-line) (setq subject (buffer-substring (point-min) (point))) (if (re-search-forward "^Posted by: " nil t) (progn (setq here (point)) (end-of-line) (setq from (buffer-substring here (point))) )) )) (insert "From: " from "\n" "Subject: " subject "\n") )) (defun nndoc-transform-potn-forum-article (article) "Transform a POTN article so that it matches nndoc expectations." (let (here url) (goto-char (point-min)) (insert "Subject: ") (forward-line 1) (insert "X-URL: ") (setq here (point)) (end-of-line) (setq url (buffer-substring here (point))) (if (re-search-forward "^Posted by:" nil t) (replace-match "From:" nil nil)) (if (re-search-forward "^On:" nil t) (replace-match "Date:" nil nil)) (if (re-search-forward "^\n" nil t) (insert "URL: " url "\n\n")) ) ) (nndoc-add-type '(potn-forum (first-article . "^The\\(se\\)? following posts? were made to the thread:\n\\*\\{8,\\}\n") (article-begin . "^\\*\\{8,\\}\n") (body-end . "^\\*\\{8,\\}$") (file-end . "^~\\{10,\\}\nUnsubscription information:$") (generate-head-function . nndoc-generate-potn-forum-head) (article-transform-function . nndoc-transform-potn-forum-article) ))