[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Links not working
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Mon, 22 Feb 2010 13:39:03 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 11153
- References: <20524da71002201158u27636d76w5d9a4008850052a7@xxxxxxxxxxxxxx> <b4m4olajfh7.fsf@xxxxxxx>
>>>>> In [emacs-w3m : No.11152] Katsumi Yamaoka wrote:
>>>>>> In [emacs-w3m : No.11151] Samuel Wales wrote:
>> When I go to
>> http://en.wikipedia.org/wiki/Microglia
>> and RET on the appropriate link, I get
>> No such anchor: Role_in_chronic_neuroinflammation
>> but it works in Safari.
> Unfortunately w3m doesn't understand such a type of name anchors.
> Here's a quick hack that works around the problem:
Here's a generalized version, that also helps a similar problem
Jidanni posted as: http://article.gmane.org/gmane.emacs.w3m/8225
(defadvice w3m-rendering-half-dump (before add-name-anchors activate)
"Add name anchors that w3m can handle."
(goto-char (point-min))
(let (start tag name)
(while (re-search-forward "<\\([^\t\n\r >]+\\)\
\[\t\n\r ]+\\(?:[^\t\n\r >]+[\t\n\r ]+\\)*id=\\(\"[^\"]+\"\\)"
nil t)
(setq start (match-beginning 0)
tag (match-string 1)
name (match-string 2))
(when (looking-at (concat "[^>]*>[^<]+</" tag ">"))
(save-restriction
(narrow-to-region (goto-char start) (match-end 0))
(insert "<a name=" name ">")
(goto-char (point-max))
(insert "</a>"))))))
This advice replaces
<TAG ... id="FOO_BAR" ...>FOO BAR</TAG>
with
<a name="FOO_BAR"><TAG ... id="FOO_BAR" ...>FOO BAR</TAG></a>
in an html source. Developers, is it worth implementing to w3m.el?