[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug#537327: w3m-el can't render http://www.crummy.com/software/BeautifulSoup/documentation.html
- From: Hideyuki SHIRAI (白井秀行) <shirai@xxxxxxxxxxx>
- Date: Tue, 04 Aug 2009 09:51:03 +0900 (JST)
- X-ml-name: emacs-w3m
- X-mail-count: 10984
- References: <20090717025612.5793.22044.reportbug@Clio> <20090803.204534.59000234.tats%nobody@xxxxxxxxxxxxxxx> <20090804.093931.194975499.shirai.hideyuki@xxxxxxxxxxx>
From: Hideyuki SHIRAI (白井秀行) <shirai@xxxxxxxxxxx> 曰く
Subject: [emacs-w3m:10983] Re: Bug#537327: w3m-el can't render http://www.crummy.com/software/BeautifulSoup/documentation.html
Message-ID: <20090804.093931.194975499.shirai.hideyuki@xxxxxxxxxxx>
Date: Tue, 04 Aug 2009 09:39:31 +0900 (JST)
> http://www.crummy.com/software/BeautifulSoup/documentation.html
> だけど、エラーになっちゃうのはまずいので、
>
> (defun w3m-decode-anchor-string (str)
> ;; snip
> (let ((start 0) (buf))
> (while (string-match "&" str start)
> (setq buf (cons "&" (cons (substring str start (match-beginning 0)) buf))
> start (match-end 0)))
> (setq str
> (apply (function concat)
> (nreverse (cons (substring str start) buf))))
> (setq start 0)
> (setq buf nil)
> (while (string-match "[\t\r\f\n]+" str start)
> (setq buf (cons (substring str start (match-beginning 0)) buf)
> start (match-end 0)))
> (apply (function concat)
> (nreverse (cons (substring str start) buf)))))
>
> として、他のブラウザと一緒にしたぐらいでよいか、
>
> (defun w3m-decode-anchor-string (str)
> ;; snip
> (let ((start 0) (buf))
> (while (string-match "&" str start)
> (setq buf (cons "&" (cons (substring str start (match-beginning 0)) buf))
> start (match-end 0)))
> (setq str
> (apply (function concat)
> (nreverse (cons (substring str start) buf))))
> (setq start 0)
> (setq buf nil)
> (while (string-match "[\t\r\f\n]+" str start)
> (setq buf (cons " " (cons (substring str start (match-beginning 0)) buf))
> start (match-end 0)))
> (apply (function concat)
> (nreverse (cons (substring str start) buf)))))
>
> それともこうやって、積極的に救うか?どっちがよいでしょうか?
二回ループ回すのもなんだからこうかな?
(defun w3m-decode-anchor-string (str)
;; snip
(let ((start 0) (buf))
(while (string-match "\\(&\\)\\|\\([\t\r\f\n]+\\)" str start)
(setq buf (cons (if (match-beginning 1) "&" " ")
(cons (substring str start (match-beginning 0)) buf))
start (match-end 0)))
(apply (function concat)
(nreverse (cons (substring str start) buf)))))
--
白井秀行 (mailto:shirai@xxxxxxxxxxx)