* sb-asahi.el: Follow the page renewal.
[elisp/wanderlust.git] / elmo / sb-text.el
1 ;;; sb-text.el --- shimbun backend class for text content.
2
3 ;; Author: TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>
4 ;;         Akihiro Arisawa    <ari@atesoft.advantest.co.jp>
5 ;;         Yuuichi Teranishi <teranisi@gohome.org>
6
7 ;; Keywords: news
8
9 ;;; Copyright:
10
11 ;; This program is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; This program is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, you can either send email to this
23 ;; program's maintainer or write to: The Free Software Foundation,
24 ;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;; Original code was nnshimbun.el written by
29 ;; TSUCHIYA Masatoshi <tsuchiya@pine.kuee.kyoto-u.ac.jp>.
30
31 ;;; Code:
32
33 (require 'shimbun)
34 (luna-define-class shimbun-text (shimbun) ())
35
36 (luna-define-method shimbun-make-contents ((shimbun shimbun-text)
37                                            header)
38   (let ((case-fold-search t) (html t) (start))
39     (when (and (re-search-forward (shimbun-content-start-internal shimbun)
40                                   nil t)
41                (setq start (point))
42                (re-search-forward (shimbun-content-end-internal shimbun)
43                                   nil t))
44       (delete-region (match-beginning 0) (point-max))
45       (delete-region (point-min) start)
46       (shimbun-shallow-rendering)
47       (setq html nil))
48     (goto-char (point-min))
49     (shimbun-header-insert header)
50     (insert "Content-Type: " (if html "text/html" "text/plain")
51             "; charset=ISO-2022-JP\nMIME-Version: 1.0\n")
52     (when (shimbun-x-face-internal shimbun)
53       (insert (shimbun-x-face-internal shimbun))
54       (unless (bolp)
55         (insert "\n")))
56     (insert "\n")
57     (encode-coding-string (buffer-string)
58                           (mime-charset-to-coding-system "ISO-2022-JP"))))
59
60 (provide 'sb-text)
61
62 ;;; sb-text.el ends here