Jump to content

Obsolete:Bugzilla linking patch

From Wikitech

Obsoleted by extensions/Wikimedia/Extension.pm in /wikimedia/bugzilla/modifications

Index: Bugzilla/Template.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Template.pm,v
retrieving revision 1.68.2.1
diff -u -r1.68.2.1 Template.pm
--- Bugzilla/Template.pm	10 Mar 2007 11:43:14 -0000	1.68.2.1
+++ Bugzilla/Template.pm	27 Jan 2009 00:54:08 -0000
@@ -294,14 +294,31 @@
     my $safe_protocols = join('|', SAFE_PROTOCOLS);
     my $protocol_re = qr/($safe_protocols)/i;
 
+    # dirty nofollow hack --brion 2005-04-13
     $text =~ s~\b(${protocol_re}:  # The protocol:
                   [^\s<>\"]+       # Any non-whitespace
                   [\w\/])          # so that we end in \w or /
               ~($tmp = html_quote($1)) &&
-               ($things[$count++] = "<a href=\"$tmp\">$tmp</a>") &&
+               ($things[$count++] = "<a href=\"$tmp\" rel=\"nofollow\">$tmp</a>") &&
                ("\0\0" . ($count-1) . "\0\0")
               ~egox;
 
+    # **** Dirty hack! --brion
+    $text =~ s~\[\[([a-zA-Z0-9_ ,./'()!#%:\x80-\xff-]+)\]\]
+              ~($tmp = html_quote($1)) &&
+               ($things[$count++] = "<a href=\"http://en.wikipedia.org/wiki/$tmp\">[[$tmp]]</a>") &&
+               ("\0\0" . ($count-1) . "\0\0")
+              ~egox;
+    # **** end dirty hack
+    # **** More dirty hacks! --brion
+    $text =~ s~\br(\d+)\b
+              ~($things[$count++] = "<a href=\"http://www.mediawiki.org" .
+               "/wiki/Special:Code/MediaWiki/$1\" " .
+               "title=\"revision $1 in SVN\">r$1</a>") &&
+               ("\0\0" . ($count-1) . "\0\0")
+              ~egox;
+    # **** end dirty hack
+
     # We have to quote now, otherwise the html itself is escaped
     # THIS MEANS THAT A LITERAL ", <, >, ' MUST BE ESCAPED FOR A MATCH