Target links to new tabs/windows

When making a URL a hyperlink target to a new tab or window. Within
Gerrit Code Review this permits reviewers to click on a link in a
comment and not lose their place.

Change-Id: I3fe4477a6ca0bde2357b05856615226ef418e9e1
diff --git a/pom.xml b/pom.xml
index 1268393..fc58f61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
   <groupId>gwtexpui</groupId>
   <artifactId>gwtexpui</artifactId>
   <packaging>jar</packaging>
-  <version>1.3.1</version>
+  <version>1.3.2</version>
   <name>gwtexpui</name>
   <description>Extended UI tools for GWT</description>
   <url>https://gerrit.googlesource.com/gwtexpui</url>
diff --git a/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java b/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java
index 42d76cc..b14d44e 100644
--- a/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java
+++ b/src/main/java/com/google/gwtexpui/safehtml/client/SafeHtml.java
@@ -120,7 +120,7 @@
           "(?:[(]" + part + "*" + "[)])*" +
           part + "*" +
         ")",
-        "<a href=\"$1\">$1</a>");
+        "<a href=\"$1\" target=\"_blank\">$1</a>");
   }
 
   /**
diff --git a/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_LinkifyTest.java b/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_LinkifyTest.java
index 365db0b..a9d9450 100644
--- a/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_LinkifyTest.java
+++ b/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_LinkifyTest.java
@@ -21,35 +21,35 @@
     final SafeHtml o = html("A http://go.here/ B");
     final SafeHtml n = o.linkify();
     assertNotSame(o, n);
-    assertEquals("A <a href=\"http://go.here/\">http://go.here/</a> B", n.asString());
+    assertEquals("A <a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a> B", n.asString());
   }
 
   public void testLinkify_SimpleHttps2() {
     final SafeHtml o = html("A https://go.here/ B");
     final SafeHtml n = o.linkify();
     assertNotSame(o, n);
-    assertEquals("A <a href=\"https://go.here/\">https://go.here/</a> B", n.asString());
+    assertEquals("A <a href=\"https://go.here/\" target=\"_blank\">https://go.here/</a> B", n.asString());
   }
 
   public void testLinkify_Parens1() {
     final SafeHtml o = html("A (http://go.here/) B");
     final SafeHtml n = o.linkify();
     assertNotSame(o, n);
-    assertEquals("A (<a href=\"http://go.here/\">http://go.here/</a>) B", n.asString());
+    assertEquals("A (<a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a>) B", n.asString());
   }
 
   public void testLinkify_Parens() {
     final SafeHtml o = html("A http://go.here/#m() B");
     final SafeHtml n = o.linkify();
     assertNotSame(o, n);
-    assertEquals("A <a href=\"http://go.here/#m()\">http://go.here/#m()</a> B", n.asString());
+    assertEquals("A <a href=\"http://go.here/#m()\" target=\"_blank\">http://go.here/#m()</a> B", n.asString());
   }
 
   public void testLinkify_AngleBrackets1() {
     final SafeHtml o = html("A <http://go.here/> B");
     final SafeHtml n = o.linkify();
     assertNotSame(o, n);
-    assertEquals("A &lt;<a href=\"http://go.here/\">http://go.here/</a>&gt; B", n.asString());
+    assertEquals("A &lt;<a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a>&gt; B", n.asString());
   }
 
   private static SafeHtml html(String text) {
diff --git a/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_WikifyTest.java b/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_WikifyTest.java
index 9b39b77..c983703 100644
--- a/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_WikifyTest.java
+++ b/src/test/java/com/google/gwtexpui/safehtml/client/SafeHtml_WikifyTest.java
@@ -56,35 +56,35 @@
     final SafeHtml o = html("A http://go.here/ B");
     final SafeHtml n = o.wikify();
     assertNotSame(o, n);
-    assertEquals("<p>A <a href=\"http://go.here/\">http://go.here/</a> B</p>", n.asString());
+    assertEquals("<p>A <a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a> B</p>", n.asString());
   }
 
   public void testLinkify_SimpleHttps2() {
     final SafeHtml o = html("A https://go.here/ B");
     final SafeHtml n = o.wikify();
     assertNotSame(o, n);
-    assertEquals("<p>A <a href=\"https://go.here/\">https://go.here/</a> B</p>", n.asString());
+    assertEquals("<p>A <a href=\"https://go.here/\" target=\"_blank\">https://go.here/</a> B</p>", n.asString());
   }
 
   public void testLinkify_Parens1() {
     final SafeHtml o = html("A (http://go.here/) B");
     final SafeHtml n = o.wikify();
     assertNotSame(o, n);
-    assertEquals("<p>A (<a href=\"http://go.here/\">http://go.here/</a>) B</p>", n.asString());
+    assertEquals("<p>A (<a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a>) B</p>", n.asString());
   }
 
   public void testLinkify_Parens() {
     final SafeHtml o = html("A http://go.here/#m() B");
     final SafeHtml n = o.wikify();
     assertNotSame(o, n);
-    assertEquals("<p>A <a href=\"http://go.here/#m()\">http://go.here/#m()</a> B</p>", n.asString());
+    assertEquals("<p>A <a href=\"http://go.here/#m()\" target=\"_blank\">http://go.here/#m()</a> B</p>", n.asString());
   }
 
   public void testLinkify_AngleBrackets1() {
     final SafeHtml o = html("A <http://go.here/> B");
     final SafeHtml n = o.wikify();
     assertNotSame(o, n);
-    assertEquals("<p>A &lt;<a href=\"http://go.here/\">http://go.here/</a>&gt; B</p>", n.asString());
+    assertEquals("<p>A &lt;<a href=\"http://go.here/\" target=\"_blank\">http://go.here/</a>&gt; B</p>", n.asString());
   }
 
   private static SafeHtml html(String text) {