/usr/share/emacs/site-lisp/w3m/shimbun/sb-dennou.el is in w3m-el 1.4.538+0.20141022-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | ;;; sb-dennou.el --- shimbun backend class for $BEEG>39$N8=>l%l%]!<%H(B web page. -*- coding: iso-2022-7bit; -*-
;; Copyright (C) 2003, 2004 NAKAJIMA Mikio <minakaji@namazu.org>
;; Author: NAKAJIMA Mikio <minakaji@namazu.org>
;; Keywords: news
;; 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'shimbun)
(eval-and-compile
(luna-define-class shimbun-dennou (shimbun) (content-hash))
(luna-define-internal-accessors 'shimbun-dennou))
(defvar shimbun-dennou-content-hash-length 31)
(defvar shimbun-dennou-url "http://homepage1.nifty.com/akiba/plat.html")
(defvar shimbun-dennou-groups '("report"))
(defvar shimbun-dennou-coding-system 'shift_jis)
(defvar shimbun-dennou-expiration-days 6)
(luna-define-method initialize-instance :after ((shimbun shimbun-dennou)
&rest init-args)
(shimbun-dennou-set-content-hash-internal
shimbun
(make-vector shimbun-dennou-content-hash-length 0))
shimbun)
(defun shimbun-dennou-make-date-string (month day)
(shimbun-make-date-string
(string-to-number (substring (current-time-string) 20))
(string-to-number month)
(string-to-number day)))
(luna-define-method shimbun-reply-to ((shimbun shimbun-dennou))
"Return the author's address."
"pc3s-nnb@asahi-net.or.jp")
(luna-define-method shimbun-headers ((shimbun shimbun-dennou)
&optional range)
(let* ((case-fold-search t)
(url (shimbun-index-url shimbun))
(baseurl (and (string-match "\\(\.+/\\)[^/]+.html" url)
(match-string 1 url)))
month day subject date id start end body headers)
(with-temp-buffer
(shimbun-retrieve-url (shimbun-index-url shimbun) 'reload 'binary)
(set-buffer-multibyte t)
(decode-coding-region (point-min) (point-max)
(shimbun-coding-system-internal shimbun))
(goto-char (point-min))
(catch 'stop
(while (re-search-forward "^<!-- *report start *-->" nil t nil)
;; <td><b>$B"#(B2$B7n(B19$BF|!J?e!K(B $B$H$j$"$($:$N;n1?E>!%!%(B<font color="red">$B!ZDI2C99?7$"$j![(B</font></b></td>
(re-search-forward "<td><b>$B"#(B\\([0-9]+\\)$B7n(B\\([0-9]+\\)$BF|!J(B\\($B7n(B\\|$B2P(B\\|$B?e(B\\|$BLZ(B\\|$B6b(B\\|$BEZ(B\\|$BF|(B\\)$B!K(B\\(.+\\)</b></td>" nil t nil)
(setq month (match-string 1)
day (match-string 2)
subject (match-string 4)
date (shimbun-dennou-make-date-string month day)
;;id (format "<%02d%04d%02d%02d@dennou>"
id (format "<%04d%02d%02d@dennou>"
(string-to-number
(substring (current-time-string) 20))
(string-to-number month)
(string-to-number day)))
(when (shimbun-search-id shimbun id)
(throw 'stop nil))
(with-temp-buffer
(insert subject)
(shimbun-remove-markup)
(setq subject (buffer-string)))
(setq start (point)
end (re-search-forward "^<!-- *report end *-->" nil t nil))
(setq body (buffer-substring-no-properties start end))
(set (intern id (shimbun-dennou-content-hash-internal shimbun))
body)
(push (shimbun-make-header 0
(shimbun-mime-encode-string subject)
(shimbun-from-address shimbun)
date id "" 0 0 baseurl)
headers)))
(nreverse headers))))
(luna-define-method shimbun-article
((shimbun shimbun-dennou) header &optional outbuf)
(let (string)
(with-current-buffer (or outbuf (current-buffer))
(with-temp-buffer
(let ((sym (intern-soft (shimbun-header-id header)
(shimbun-dennou-content-hash-internal
shimbun))))
(when (and (boundp sym) (symbol-value sym))
(insert (symbol-value sym))
(goto-char (point-min))
(insert "<html>\n<head>\n<base href=\""
(shimbun-header-xref header) "\">\n</head>\n<body>\n")
(goto-char (point-max))
(insert "\n</body>\n</html>\n")
(encode-coding-string
(buffer-string)
(mime-charset-to-coding-system "ISO-2022-JP"))
(shimbun-make-mime-article shimbun header)
(setq string (buffer-string)))))
(when string
(w3m-insert-string string)))))
(provide 'sb-dennou)
;;; sb-dennou.el ends here
|