From: Matt Layher Date: Mon, 1 Aug 2016 16:50:11 +0000 (-0400) Subject: go/doc: allow ToHTML to properly handle URLs containing semicolons X-Git-Tag: go1.8beta1~1521 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7eddaf5f0b275cd2ff37b260246d276748ac6cd4;p=gostls13.git go/doc: allow ToHTML to properly handle URLs containing semicolons Fixes #16565 Change-Id: I3edfd2576a7ca5270644a4e7f126854f821f2c9a Reviewed-on: https://go-review.googlesource.com/25385 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/go/doc/comment.go b/src/go/doc/comment.go index ed8eef4c61..15e034b6df 100644 --- a/src/go/doc/comment.go +++ b/src/go/doc/comment.go @@ -53,7 +53,7 @@ const ( filePart = `[a-zA-Z0-9_?%#~&/\-+=()]+` // parentheses may not be matching; see pairedParensPrefixLen urlRx = `(` + protocol + `)://` + // http:// hostPart + `([.:]` + hostPart + `)*/?` + // //www.google.com:8080/ - filePart + `([:.,]` + filePart + `)*` + filePart + `([:.,;]` + filePart + `)*` ) var matchRx = regexp.MustCompile(`(` + urlRx + `)|(` + identRx + `)`) diff --git a/src/go/doc/comment_test.go b/src/go/doc/comment_test.go index ad65c2a27f..76dfbeac79 100644 --- a/src/go/doc/comment_test.go +++ b/src/go/doc/comment_test.go @@ -162,6 +162,7 @@ var emphasizeTests = []struct { {"Hello http://example.com/%2f/ /world.", `Hello http://example.com/%2f/ /world.`}, {"Lorem http: ipsum //host/path", "Lorem http: ipsum //host/path"}, {"javascript://is/not/linked", "javascript://is/not/linked"}, + {"http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD", `http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD`}, } func TestEmphasize(t *testing.T) {