1;;; sb-vinelinux.el --- shimbun backend class for vinelinux web site. 2 3;; Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 4;; NAKAJIMA Mikio <minakaji@namazu.org> 5 6;; Author: NAKAJIMA Mikio <minakaji@namazu.org> 7;; Keywords: news 8 9;; This file is a part of shimbun. 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; see the file COPYING. If not, write to 23;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 24;; Boston, MA 02110-1301, USA. 25 26;;; Commentary: 27 28;;; Code: 29 30(require 'shimbun) 31 32(luna-define-class shimbun-vinelinux (shimbun) ()) 33 34(defconst shimbun-vinelinux-url "http://www.vinelinux.org") 35(defconst shimbun-vinelinux-group-path-alist 36 '(("errata.4x.i386" . "errata/4x/i386.html") 37 ("errata.4x.ppc" . "errata/4x/ppc.html") 38 ("errata.3x.i386" . "errata/3x/i386.html") 39 ("errata.3x.ppc" . "errata/3x/ppc.html") 40 ("errata.3x.alpha" . "errata/3x/alpha.html") 41 ("errata.25x.i386" . "errata/25x/i386.html") 42 ("errata.25x.ppc" . "errata/25x/ppc.html") 43 ("errata.25x.sparc" . "errata/25x/sparc.html") 44 ("errata.25x.alpha" . "errata/25x/alpha.html") 45 ("errata.2x.i386" . "errata/2x/i386.html") 46 ("errata.2x.ppc" . "errata/2x/ppc.html") 47 ("errata.2x.sparc" . "errata/2x/sparc.html") 48 ("errata.2x.alpha" . "errata/2x/alpha.html") 49 ("errata.1x" . "errata/1x/index.html"))) 50 51(defconst shimbun-vinelinux-groups 52 (mapcar 'car shimbun-vinelinux-group-path-alist)) 53(defconst shimbun-vinelinux-from-address "webmaster@www.vinelinux.org") 54 55(defun shimbun-vinelinux-parse-time (str) 56 (shimbun-make-date-string 57 (string-to-number (substring str 0 4)) 58 (string-to-number (substring str 4 6)) 59 (string-to-number (substring str 6)))) 60 61(luna-define-method shimbun-index-url ((shimbun shimbun-vinelinux)) 62 (concat (shimbun-url-internal shimbun) 63 "/" 64 (cdr (assoc (shimbun-current-group-internal shimbun) 65 shimbun-vinelinux-group-path-alist)))) 66 67(luna-define-method shimbun-get-headers ((shimbun shimbun-vinelinux) 68 &optional range) 69 (let ((case-fold-search t) 70 start end headers url id date subject) 71 (subst-char-in-region (point-min) (point-max) ?\t ? t) 72 (setq start (progn 73 (search-forward "</font>の更新/障害情報です</h4>" nil t nil) 74 (search-forward "<table>" nil t nil) 75 (point)) 76 end (progn (search-forward "</table>" nil t nil) 77 (point))) 78 (goto-char start) 79 ;; Use entire archive. 80 (catch 'stop 81 (while (re-search-forward 82 ;; <td><a href="20010501.html">quota の更新</a></td> 83 ;; <td><a href="20010501-3.html">Vine Linux 2.1.5 にアップグレードした時の xdvi や tgif 等の日本語表示の不具合</a></td> 84 "^<td><a href=\"\\(\\([0-9]+\\)\\(-[0-9]+\\)*\\.html\\)\">\\(.+\\)</a></td>" 85 end t) 86 (setq url (shimbun-expand-url (match-string-no-properties 1) 87 (shimbun-index-url shimbun)) 88 id (format "<%s%05d%%%s>" 89 (match-string-no-properties 1) 90 (string-to-number (match-string-no-properties 2)) 91 (shimbun-current-group-internal shimbun)) 92 date (shimbun-vinelinux-parse-time (match-string-no-properties 2)) 93 subject (match-string 4)) 94 (if (shimbun-search-id shimbun id) 95 (throw 'stop nil)) 96 (forward-line 1) 97 (push (shimbun-make-header 0 98 (shimbun-mime-encode-string subject) 99 (shimbun-from-address shimbun) 100 date id "" 0 0 url) 101 headers))) 102 headers)) 103 104(luna-define-method shimbun-make-contents ((shimbun shimbun-vinelinux) header) 105 ;;<h4>●2002,1,22(2002,1,24 更新)● ppxp パッケージの修正</h4> 106 ;; <h3>[ 2003,01,29 ] telnet にバグ</h4> ;; start with h3 and end with h4...f(^^;;; 107 (if (not (re-search-forward 108 "^<h4>●[,0-9]+.*●.*</h4>\\|^<h[34]>\\[ [,0-9]+ \\] .+</h[34]>" 109 nil t nil)) 110 nil 111 (delete-region (progn (forward-line 1) (point)) (point-min)) 112 (shimbun-header-insert shimbun header) 113 (insert 114 "Content-Type: text/html; charset=ISO-2022-JP\nMIME-Version: 1.0\n\n" 115 "<html><head><base href=\"" 116 (shimbun-header-xref header) 117 "\"></head><body>") 118 (goto-char (point-min)) 119 (while (re-search-forward "</*blockquote>\n" nil t nil) 120 (delete-region (match-beginning 0) (point))) 121 (goto-char (point-max)) 122 (insert "</body></html>") 123 (encode-coding-string (buffer-string) 124 (mime-charset-to-coding-system "ISO-2022-JP")))) 125 126(provide 'sb-vinelinux) 127 128;;; sb-vinelinux.el ends here 129