[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sb-the-register fixes
- From: David Hansen <david.hansen@xxxxxxx>
- Date: Tue, 25 Jan 2005 10:35:13 +0100
- X-ml-name: emacs-w3m
- X-mail-count: 07436
2005-01-25 David Hansen <david.hansen@physik.fu-berlin.de>
* shimbun/sb-the-register.el (shimbun-rss-process-date): Work around
sb-rss.el date parsing.
(shimbun-get-headers): Rewrite URL to be able to get the images.
(shimbun-make-contents): Remove ads.
--- cvs-src/emacs-w3m/shimbun/sb-the-register.el 2004-12-19 08:16:16.000000000 +0000
+++ share/emacs/site-lisp/w3m/sb-the-register.el 2005-01-25 09:13:44.000000000 +0000
@@ -56,22 +56,42 @@
(cdr (assoc (shimbun-current-group-internal shimbun)
shimbun-the-register-path-alist))))
+;; work around the sb-rss.el date parsing
+(luna-define-method shimbun-rss-process-date
+ ((shimbun shimbun-the-register) date)
+ (or date ""))
+
(luna-define-method shimbun-get-headers :around
((shimbun shimbun-the-register) &optional range)
(mapcar
(lambda (header)
- (shimbun-header-set-xref
- header (concat (shimbun-header-xref header) "print.html"))
+ ;; we will get redirected from http://go.theregister.com/feed/... to
+ ;; http://www.theregister.co.uk/...
+ ;; if we don't set the URL right shimbun can't follow the <img src=
+ (let ((url (shimbun-header-xref header)))
+ (setq url (w3m-replace-in-string
+ url
+ "http://go\\.theregister\\.com/feed/"
+ "http://www.theregister.co.uk/"))
+ (shimbun-header-set-xref
+ header (concat url "print.html")))
header)
(luna-call-next-method)))
(luna-define-method shimbun-make-contents
:before ((shimbun shimbun-the-register) header)
(save-excursion
- (goto-char (point-min))
- (while (re-search-forward "(<span class=\"URL\">" nil t nil)
- (delete-region (match-beginning 0)
- (re-search-forward "</span>)" nil t nil)))))
+ ;; remove annoying stuff
+ (let ((junk '(("(<span class=\"URL\">" . "</span>)")
+ ("<div class=\"Ad\">" . "</div>"))))
+ (while junk
+ (goto-char (point-min))
+ (let ((beg-str (caar junk)) (end-str (cdar junk)) beg end)
+ (setq junk (cdr junk))
+ (while (search-forward beg-str nil t)
+ (setq beg (match-beginning 0))
+ (when (setq end (search-forward end-str nil t))
+ (delete-region beg end))))))))
(luna-define-method shimbun-rss-build-message-id
((shimbun shimbun-the-register) url date)