[wp-trac] [WordPress Trac] #18549: wp_texturize incorrectly curls closing quotes after inline HTML end tags

WordPress Trac wp-trac at lists.automattic.com
Sat Jan 14 00:40:44 UTC 2012


#18549: wp_texturize incorrectly curls closing quotes after inline HTML end tags
--------------------------+------------------------------
 Reporter:  justincwatt   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  3.3.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by Ammaletu):

 * cc: Ammaletu (added)
 * version:  3.2.1 => 3.3.1


Comment:

 I can confirm this issue. Haven't had time yet to write a test case or
 patch, but I took a look at the plugin "InTypo" (which I have been using
 for years to change the English quote characters to German ones). This
 plugin completely replaces wptexturize and does not show this bug except
 in one minor case. What InTypo does: It first replaces the closing quotes
 and then the opening ones. This way, when you get to replacing the opening
 quotes, the closing quotes are already safely replaced.

 The code looks like this:

 {{{
 $dynamic_character = '/"([\.,;\!\?\s\)\]])/'
 $dynamic_replacement = $closing_quote . '$1'
 }}}

 Basically, it replaces every quote character with a closing quote that is
 followed by a space, a closing bracket or a number of punctuation marks.
 That is not perfect yet, for example wptexturize handles { and < for
 opening quotes, so these should be handled here as well. Also probably any
 punctuation marks from different languages (are there any missing?). And
 finally this fails if the closing quote is the very last character of the
 post, a case that could be handled by adding \Z.

 Could this be the basis for a patch?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18549#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list