1;;; sb-the-onion.el --- The Onion shimbun backend
2
3;; Copyright (C) 2006 David Hansen
4
5;; Author: David Hansen <david.hansen@physik.fu-berlin.de>
6;; Keywords: news
7
8;; This file is a part of shimbun.
9
10;; This 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 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 GNU Emacs; see the file COPYING.  If not, write to the
22;; 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-rss)
31
32(luna-define-class shimbun-the-onion (shimbun-rss) ())
33
34(defvar shimbun-the-onion-url "http://www.theonion.com/content/feeds/daily")
35(defvar shimbun-the-onion-groups '("news"))
36(defvar shimbun-the-onion-from-address  "invalid@theonion.com")
37(defvar shimbun-the-onion-content-start "<!-- begin content -->")
38(defvar shimbun-the-onion-content-end "<!-- end content -->")
39
40(luna-define-method shimbun-index-url ((shimbun shimbun-the-onion))
41  shimbun-the-onion-url)
42
43(luna-define-method shimbun-get-headers :around
44  ((shimbun shimbun-the-onion) &optional range)
45  (mapcar
46   (lambda (header)
47     (let ((url (shimbun-header-xref header)))
48       (when (string-match "[0-9]+\\(\\?.*=RSS\\)" url)
49	 (shimbun-header-set-xref
50	  header (concat (substring url 0 (match-beginning 1)) "/print/"))))
51     header)
52   (luna-call-next-method)))
53
54(provide 'sb-the-onion)
55
56;;; sb-the-onion.el ends here
57