[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sb-rss/sb-haiku-os
- From: Yoichi NAKAYAMA <yoichi@xxxxxxxxx>
- Date: Sat, 31 Jul 2004 16:02:45 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 07021
なかやまです
http://haiku-os.org/ の shimbun を作ったのですが、
shimbun-rss-node-text により URL 末尾に改行が残って
しまいます(記事でヘッダ/ボディの境界と間違われる)。
ここで、
--- sb-rss.el 13 Jun 2004 11:20:00 -0000 1.18
+++ sb-rss.el 31 Jul 2004 06:57:38 -0000
@@ -190,7 +190,7 @@
(shimbun-rss-node-just-text node)
node))
(cleaned-text (if text (shimbun-replace-in-string
- text "^[\000-\037\177]+\\|^ +\\| +$" ""))))
+ text "^[ \000-\037\177]+\\|[ \000-\037\177]+$" ""))))
(if (string-equal "" cleaned-text)
nil
cleaned-text)))
という変更は妥当でしょうか?
元の仕様について前にどこかで見た気がしたので XML 仕様書で
関連箇所を探したのですが見つけられませんでした。
--
Yoichi NAKAYAMA
;;; sb-haiku-os.el --- shimbun backend for haiku-os.org
;; Copyright (C) 2004 Yoichi NAKAYAMA <yoichi@geiin.org>
;; Author: Yoichi NAKAYAMA <yoichi@geiin.org>
;; Keywords: news
;; Created: Jul 30, 2004
;; This file is a part of shimbun.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, you can either send email to this
;; program's maintainer or write to: The Free Software Foundation,
;; Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
(require 'shimbun)
(require 'sb-rss)
(luna-define-class shimbun-haiku-os (shimbun-rss) ())
(defvar shimbun-haiku-os-group-alist
'(("news" "http://haiku-os.org/rss.php?channel=news"
"<td id=\"newsbody\">" "</td>")
("forums" "http://haiku-os.org/rss.php?channel=forums"
"<td width=\"100%\"><span class=\"postbody\">" "</span></td>")
("newsletters" "http://haiku-os.org/rss.php?channel=newsletters"
"<!-- Main Content -->" "<!-- / Main Content -->"))
"Alist of readable groups and URLs of their RSSs.")
(luna-define-method shimbun-groups ((shimbun shimbun-haiku-os))
(mapcar 'car shimbun-haiku-os-group-alist))
(luna-define-method shimbun-index-url ((shimbun shimbun-haiku-os))
(nth 1 (assoc (shimbun-current-group shimbun) shimbun-haiku-os-group-alist)))
(luna-define-method shimbun-rss-process-date ((shimbun shimbun-haiku-os) date)
date)
(luna-define-method shimbun-rss-build-message-id
((shimbun shimbun-haiku-os) url date)
(unless (string-match "=\\([0-9]+\\)\\>" url)
(error "Cannot find message-id base"))
(concat "<" (match-string-no-properties 1 url) "%" (shimbun-current-group shimbun) "@haiku-os.org>"))
(luna-define-method shimbun-make-contents :around ((shimbun shimbun-haiku-os)
&optional header)
(let ((entry (assoc (shimbun-current-group shimbun)
shimbun-haiku-os-group-alist)))
(shimbun-set-content-start-internal shimbun (nth 2 entry))
(shimbun-set-content-end-internal shimbun (nth 3 entry))
(luna-call-next-method)))
(provide 'sb-haiku-os)
;;; sb-haiku-os.el ends here