WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 6 years ago

Last modified 6 years ago

#20342 closed defect (bug) (fixed)

Opening Double Quote after 3 hyphens converted to double closing quote

Reported by: PetesGuide Owned by: wonderboymusic
Milestone: 4.0 Priority: normal
Severity: normal Version: 3.3.1
Component: Formatting Keywords: wptexturize has-patch dev-feedback
Focuses: Cc:

Description

The string:

<p>I also remember the line in "Casey at the Bat" when he struck out---"There is no Joy in Mudville!!!"</p>

is converted to this in WordPress 3.3.1:

<p>I also remember the line in &#8220;Casey at the Bat&#8221; when he struck out&#8212;&#8221;There is no Joy in Mudville!!!&#8221;</p>

Seems to be what should be an opening quote that follows an Em dash is always converted into a closing quote.

Attachments (8)

20342.diff (795 bytes) - added by cmmarslender 7 years ago.
Unit Test
20342.2.diff (2.7 KB) - added by adamsilverstein 7 years ago.
opening double quote, even after -
20342.3.diff (3.4 KB) - added by adamsilverstein 7 years ago.
correct space inadvertantly added to unit test
20342.4.diff (2.7 KB) - added by adamsilverstein 7 years ago.
don't breat other tests!
20342-tests.diff (1.6 KB) - added by adamsilverstein 7 years ago.
20342-tests.2.diff (1.6 KB) - added by adamsilverstein 7 years ago.
corrected extra space
miqro-20342-tests.php (1.1 KB) - added by miqrogroove 7 years ago.
miqro-20342.patch (3.5 KB) - added by miqrogroove 6 years ago.

Download all attachments as: .zip

Change History (22)

#1 @nacin
7 years ago

  • Keywords wptexturize added

#2 @nacin
7 years ago

  • Keywords needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

Sorry for you never hearing anything, PetesGuide. This sounds like a lot of other wptexturize tickets. (full list). If a contributor can supply a unit test for this, we'll be in good shape to going forward with possible fixed.

@cmmarslender
7 years ago

Unit Test

#3 @cmmarslender
7 years ago

  • Keywords needs-unit-tests removed

@adamsilverstein
7 years ago

opening double quote, even after -

@adamsilverstein
7 years ago

correct space inadvertantly added to unit test

@adamsilverstein
7 years ago

don't breat other tests!

#4 @adamsilverstein
7 years ago

  • Keywords has-patch dev-feedback added

20342.4.diff adds ';' to the list of characters after which a double quote (and single quote) is replaced with unicode equivalent. Previous attempts broke other unit test in formatting, verified this change does not break any other tests while resolving the test case in this ticket.

This ticket was mentioned in IRC in #wordpress-dev by adamsilverstein. View the logs.


7 years ago

#6 follow-up: @miqrogroove
7 years ago

This patch would fix <"Test Quote"> which is currently broken.

It would also break things like Then he said, "Try using the &"

Last edited 7 years ago by miqrogroove (previous) (diff)

@adamsilverstein
7 years ago

corrected extra space

#7 in reply to: ↑ 6 @adamsilverstein
7 years ago

Replying to miqrogroove:

This patch would fix <"Test Quote"> which is currently broken.

It would also break things like Then he said, "Try using the &"

Thanks for the feedback.

I tried testing these two strings via a unit test in 20342-tests.2.diff and don't see how the patch effects them. What were you expecting from wp_texturize and what are your results, before and after the patch?

#8 @miqrogroove
7 years ago

I'm using those as editor inputs on the Visual tab. They are converted to HTML before wptexturize(). If I had to trade off quotes ending with & for quotes wrapped in angle braces, I would be in favor. Both seem trivial to me.

#9 @miqrogroove
7 years ago

Perhaps the larger concern is that including the semi-colon arbitrarily could have unwanted results on non-UTF-8 websites. That would be a question for the staff to tackle.

#10 @miqrogroove
7 years ago

Note the patch for #23185 will put hyphen conversion at the end of wptexturize, so we can consider simply allowing hyphens before quotes. This will work as long as we never expect input like, "This is my weird quote-"

#11 @miqrogroove
6 years ago

#23185 is fixed now, so this will be much easier. Patch is attached.

This ticket was mentioned in IRC in #wordpress-dev by wonderboymusic. View the logs.


6 years ago

#13 @wonderboymusic
6 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 28726:

In wptexturize(), allow dashes before and after curly quotes. Example: This is what she said---"Wow that is cool."

Adds unit tests.

Props adamsilverstein, miqrogroove.
Fixes #20342.

#14 @wonderboymusic
6 years ago

  • Milestone changed from Future Release to 4.0
Note: See TracTickets for help on using tickets.