[wp-trac] [WordPress Trac] #17097: make_clickable() regex should exclude close-quotation marks after URLs

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 9 21:37:03 UTC 2011


#17097: make_clickable() regex should exclude close-quotation marks after URLs
--------------------------+-----------------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  minor         |   Keywords:  needs-patch
--------------------------+-----------------------------
 Originally reported in http://trac.buddypress.org/ticket/2443

 The regex in make_clickable() thinks that a single-quote or a double-quote
 at the end of a URL string is part of the URL. Steps to reproduce:
 1) Write a post:

 {{{
 The websites 'http://wordpress.org' and "http://buddypress.org" are
 awesome
 }}}

 2) Add the make_clickable filter:

 {{{
 add_filter( 'the_content', 'make_clickable' );
 }}}

 3) Output (html source):
 {{{

 The websites &#8216;<a href="http://wordpress.org&#038;#8217"
 rel="nofollow">http://wordpress.org&#038;#8217</a>; and &#8220;<a
 href="http://buddypress.org&#038;#8221"
 rel="nofollow">http://buddypress.org&#038;#8221</a>; are awesome
 }}}

 (front end)
 {{{

 The websites ‘http://wordpress.org&#8217; and
 “http://buddypress.org&#8221; are awesome
 }}}


 I would expect that, in the majority of cases, URLs will not end in a
 double- or single-quote. So it makes sense for the regex to count the
 quote as part of the after-URL backreference. See #5081 for a similar
 issue involving periods.

 I'm afraid I'm not providing a patch because my puny mind cannot
 understand the expression currently being used :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17097>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list