changeset 16650:092790f767a4

(gnus-button-alist): Allow whitespace in `<URL:...' markup (rfc1738), done last, after possible partial matches. (gnus-button-url): Zap any whitespace from a <URL:...> match.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Dec 1996 06:37:30 +0000
parents 8a01398a26e6
children e7449d679e72
files lisp/gnus-vis.el
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus-vis.el	Mon Dec 09 04:21:11 1996 +0000
+++ b/lisp/gnus-vis.el	Mon Dec 09 06:37:30 1996 +0000
@@ -217,11 +217,13 @@
     ("\\(<?\\(url: ?\\)?news:\\([^>\n\t ]*\\)>?\\)" 1 t
      gnus-button-message-id 3)
     ("\\(<URL: *\\)?mailto: *\\([^> \n\t]+\\)>?" 0 t gnus-button-reply 2)
-    ;; This is how URLs _should_ be embedded in text...
-    ("<URL: *\\([^\n\r>]*\\)>" 0 t gnus-button-url 1)
     ;; Next regexp stolen from highlight-headers.el.
     ;; Modified by Vladimir Alexiev.
-    (,gnus-button-url-regexp 0 t gnus-button-url 0))
+    (,gnus-button-url-regexp 0 t gnus-button-url 0)
+    ;; This is how URLs _should_ be embedded in text...  It should go
+    ;; last to avoid matching only a subset of the URL, depending on
+    ;; how it was broken across lines.
+    ("<URL:\\([^>]+\\)>" 0 t gnus-button-url 1))
   "Alist of regexps matching buttons in article bodies.
 
 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
@@ -1518,7 +1520,13 @@
 
 (defun gnus-button-url (address)
   "Browse ADDRESS."
-  (funcall browse-url-browser-function address))
+  (funcall browse-url-browser-function
+	   ;; Zap whitespace in case <URL:...> contained it.
+	   ;; (Whitespace illegal in raw URL.)
+	   (let ((stripped-address address))
+	     (while (string-match "\\s +\\|\n+" stripped-address)
+	       (setq stripped-address (replace-match "" t t stripped-address)))
+	     stripped-address)))
 
 ;;; Next/prev buttons in the article buffer.