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

Re: <nobr> injection



In [emacs-w3m : No.12308] 積丹尼 Dan Jacobson wrote:
> Do you see all those <nobr>'s in
> http://radioscanningtw.jidanni.org/index.php?title=%E6%B8%AF%E5%8B%99&action=edit

> They don't show up in lynx, w3m, chromium, etc.

Fixed in emacs-w3m CVS.  The patch is below.  The cause was the
`w3m-markup-urls-nobreak' function added by your suggestion:
<http://thread.gmane.org/gmane.emacs.w3m/9097>

--- w3m.el~	2014-03-26 07:28:01.000000000 +0000
(B+++ w3m.el	2014-03-31 01:22:32.642162900 +0000
(B@@ -6174,8 +6174,9 @@
(B (defun w3m-markup-urls-nobreak ()
(B   "Make things that look like urls unbreakable.
(B This function prevents non-link long urls from being broken (w3m tries
(B-to fold them)."
(B+to fold them).  Things in textarea won't be modified."
(B   (let ((case-fold-search t)
(B+	(beg (point-min))
(B 	(regexp
(B 	 (eval-when-compile
(B 	   ;; A copy of `gnus-button-url-regexp'.
(B@@ -6201,25 +6202,40 @@
(B 	    "\\)")))
(B 	(nd (make-marker))
(B 	st)
(B-    (goto-char (point-min))
(B-    (while (re-search-forward regexp nil t)
(B-      (set-marker nd (match-end 0))
(B-      (setq st (goto-char (match-beginning 0)))
(B-      (if (and (re-search-backward "\\(<\\)\\|>" nil t)
(B-	       (match-beginning 1))
(B+    (goto-char beg)
(B+    (while beg
(B+      (narrow-to-region
(B+       beg
(B+       (if (re-search-forward "[\t\n ]*\\(<textarea[\t\n ]\\)" nil t)
(B+	   (prog1
(B+	       (match-beginning 0)
(B+	     (goto-char beg)
(B+	     (setq beg (match-beginning 1)))
(B+	 (point-max)))
(B+      (while (re-search-forward regexp nil t)
(B+	(set-marker nd (match-end 0))
(B+	(setq st (goto-char (match-beginning 0)))
(B+	(if (and (re-search-backward "\\(<\\)\\|>" nil t)
(B+		 (match-beginning 1))
(B+	    (goto-char nd)
(B+	  (goto-char st)
(B+	  (skip-chars-backward "\t\f ")
(B+	  (if (string-match "&lt;" (buffer-substring (max (- (point) 4)
(B+							  (point-min))
(B+						     (point)))
(B+	      (forward-char -4)
(B+	    (goto-char st))
(B+	  (insert "<nobr>")
(B 	  (goto-char nd)
(B-	(goto-char st)
(B-	(skip-chars-backward "\t\f ")
(B-	(if (string-match "&lt;" (buffer-substring (max (- (point) 4)
(B-							(point-min))
(B-						   (point)))
(B-	    (forward-char -4)
(B-	  (goto-char st))
(B-	(insert "<nobr>")
(B-	(goto-char nd)
(B-	(when (looking-at "[\t\f ]*&gt;")
(B-	  (goto-char (match-end 0)))
(B-	(insert "</nobr>")))
(B+	  (when (looking-at "[\t\f ]*&gt;")
(B+	    (goto-char (match-end 0)))
(B+	  (insert "</nobr>")))
(B+      (goto-char (point-max))
(B+      (widen)
(B+      (setq beg (and (not (eobp))
(B+		     (progn
(B+		       (goto-char beg)
(B+		       (w3m-end-of-tag "textarea")))))
(B     (set-marker nd nil)))
(B 
(B (defun w3m-rendering-buffer (&optional charset)