1;;; sb-sml.el --- shimbun backend for Smalltalkers' Salon Mailing List archive
2
3;; Copyright (C) 2003-2005, 2019 NAKAJIMA Mikio <minakaji@namazu.org>
4
5;; Author: NAKAJIMA Mikio <minakaji@namazu.org>
6;; Keywords: news
7
8;; This file is a part of shimbun.
9
10;; This program is free software; you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 2, or (at your option)
13;; any later version.
14
15;; This program is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with this program; see the file COPYING.  If not, write to
22;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24
25;;; Commentary:
26
27;;; Code:
28
29(require 'shimbun)
30(require 'sb-mailman)
31
32(luna-define-class shimbun-sml (shimbun-mailman) ())
33
34(defvar shimbun-sml-url "http://www.akademia.co.jp/Smalltalk/SML/archives/archive/")
35
36(defvar shimbun-sml-groups '("main"))
37
38;;(luna-define-method shimbun-reply-to ((shimbun shimbun-sml))
39;;  "sml@sra.co.jp")
40
41(luna-define-method shimbun-make-contents
42  ((shimbun shimbun-sml) header)
43  (shimbun-sml-make-contents shimbun header))
44
45(defun shimbun-sml-make-contents (shimbun header)
46  (subst-char-in-region (point-min) (point-max) ?\t ?  t)
47  (shimbun-decode-entities)
48  (goto-char (point-min))
49  (let ((end (search-forward "<!--beginarticle-->")))
50    (goto-char (point-min))
51    (search-forward "</HEAD>")
52    (when (re-search-forward "<H1>\\([^\n]+\\)\\(\n +\\)?</H1>" end t nil)
53      (shimbun-header-set-subject
54       header
55       (shimbun-mime-encode-string (match-string 1))))
56    (when (re-search-forward
57	   "<B>\\([^\n]+\\)\\(\n +\\)?</B> *\n +\\([^\n]+\\)<BR>" end t nil)
58      (shimbun-header-set-from
59       header
60       (shimbun-mime-encode-string
61	(concat (match-string 1) " <" (match-string 3) ">")))
62      (when (re-search-forward "<I>\\([^\n]+\\)</I>" end t nil)
63	(shimbun-header-set-date header (match-string 1)))
64      (delete-region (point-min) end)
65      (delete-region (search-forward "<!--endarticle-->") (point-max))
66      (shimbun-header-insert-and-buffer-string shimbun header nil t))))
67
68(provide 'sb-sml)
69;;; sb-sml.el ends here
70