[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: jump to <cite id=...



jidanni@xxxxxxxxxxx writes:

> emacs-w3m and w3m do not correctly jump to IDs like
> <cite id="CITEREFHannas1997">
>
> $ set http://en.wikipedia.org/wiki/Vietnamese_phonology#CITEREFHannas1997
> $ lynx $@    #Good
> $ firefox $@ #Good
> $ w3m $@     #FAILS
>
> (Sorry if I should report this directly to w3m and not emacs-w3m, but I
> found such bugs get fixed quicker via the latter :-))

How about applying this patch and `(setq w3m-use-filter t)'.

diff -u w3m-filter.el.~1.38.~ w3m-filter.el
--- w3m-filter.el.~1.38.~	2008-06-06 10:10:42.000000000 +0900
+++ w3m-filter.el	2008-07-15 17:07:32.000000000 +0900
@@ -356,16 +356,12 @@
 (defun w3m-filter-wikipedia (url)
   "Make anchor reference to work."
   (goto-char (point-min))
-  (let (refname citename citenum)
+  (let (matched-text refid)
     (while (re-search-forward 
-	    "<sup id=\"\\(cite_ref-[^\"]*\\)\" class=\"reference\"><a href=\"\\(#cite_note-[^\"]*\\\)\" title=\"\">\\[\\([0-9]*\\)\\]</a></sup>"
-	    nil t)
-      (setq refname (match-string 1)
-	    citename (match-string 2)
-	    citenum (match-string 3))
+	    "<\\(?:sup\\|cite\\) id=\"\\([^\"]*\\)\"" nil t)
+      (setq matched-text (match-string 0)
+	    refid        (match-string 1))
       (delete-region (match-beginning 0) (match-end 0))
-      (insert (format "<a name=\"%s\"><a href=\"%s\" title=\"\">[%s]</a></a>"
-		      refname citename citenum)))))
-			    
+      (insert (format "<a name=\"%s\"></a>%s" refid matched-text)))))
 
 ;;; w3m-filter.el ends here