WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 3 years ago

Last modified 18 months ago

#10606 closed defect (bug) (duplicate)

Curly quotes breakage

Reported by: nbachiyski Owned by: nbachiyski
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: Formatting Keywords: wptexturize needs-patch
Focuses: Cc:

Description

When the closing quote is right after the closing link tag it converted to a opening, instead of a closing quote.

This text:

Here is "<a href="http://yahoo.com">a test with a link</a>".

is wptexturized to:

Here is « a test with a link« .

(the quotes are the French -- they make the discrepancy more obvious.)

The issue was discovered by Xavier Borderie.

Attachments (2)

wp-curly-29rare.png (15.8 KB) - added by xibe 4 years ago.
From a month-old 2.9-rare
wp-curly-29rare2.png (15.7 KB) - added by xibe 4 years ago.
From the latest 2.9-rare

Download all attachments as: .zip

Change History (23)

comment:1 follow-up: nbachiyski5 years ago

  • Owner set to nbachiyski
  • Status changed from new to accepted

comment:2 xibe5 years ago

Thank you Nikolay for the ticket and the hat-tip, but in truth the issue was reported to WPFR by the webmaster for PBGalerie (his own discovery post). Giving credit where credit is due.

comment:3 in reply to: ↑ 1 xibe5 years ago

When the closing quote is right after the closing link tag it converted to a opening, instead of a closing quote.

Only party true: the problem also only appears when the closing quote is not followed by a space.

That is, if in this situation:

Here is "<a href="http://yahoo.com">a test with a link</a>" and a space.

...wptexturize does the work just fine: Here is « a test with a link » and a space. If the closing quote is immediately following by a letter of a punctuation sign, then the issue arises: the opening quote is rendered instead of the closing one.

See my test post with multiple variations.

comment:4 westi5 years ago

  • Cc westi added
  • Keywords needs-unit-tests added

It would be cool to get this excellent test case examples added to the WordPress unit tests.

The file to patch is here: http://svn.automattic.com/wordpress-tests/wp-testcase/test_includes_formatting.php

We need to add an extra test function to TestWPTexturize.

If someone wants to cook up a patch it will be much appreciated else I'll take the supplied test cases and do it myself.

Please let me know if you have any questions about writing test cases

comment:5 westi5 years ago

I've now added some of these cases to that file which shows the failure so we have something to test the fix with easily

comment:6 xibe5 years ago

Another issue I noticed today: if the quote section ends with a number, the closing quote is not converted. See the two last tests here.

comment:7 xibe5 years ago

Note: the previous comment of mine is really interesting for the fact that it fails even though there is no link in the quote section. This might prove the problem is wider than just with the linkification.

comment:8 xibe5 years ago

  • Summary changed from Curly quotes break if in the end of a link to Curly quotes breakage

One further bug I found in wp texturize - which is why I changed the title: the opening quote is turned into a closing quote when the whole quote is between parenthesis, like so: ("no link, everything between parenthesis"). Ditto for curly braces, and square brackets seem safe in this matter. See bottom of test post using fr_FR translation.

comment:9 xibe4 years ago

I see there's been some recent changes in the curly-quotes code, from in #10987 .

Checking out my test post (same link as above) with the latest 2.9-rare, these modifications brought globally no change to the current situation, apart from two tests which are now okay:

  • starting quote stuck to opening parenthesis,
  • starting quote stuck to opening curly brace.

(see attached images below: first one is from a month-old 2.9-rare, second one is from today's trunk update. rest of tests remain the same).

I'll try to build all of these tests into proper unit-tests soon.

xibe4 years ago

From a month-old 2.9-rare

xibe4 years ago

From the latest 2.9-rare

comment:10 xibe4 years ago

  • Keywords needs-unit-tests removed

Promised unit-tests is (finally) in #11099.

comment:11 ryan4 years ago

  • Milestone changed from 2.9 to Future Release

comment:12 hakre4 years ago

  • Cc hanskrentel@… added

comment:13 xibe4 years ago

Decided to have another look at my test post after mrmist's own check, and if some strings seem correct, others are still lacking.

comment:14 mrmist4 years ago

FWIW my testing was only to check on the specific disappearing issue in #8553 and I wasn't observing the curly quotes. There's no end of tickets around texturize, I marked a ton as related a few releases back, and suspect the are still knocking around.

comment:15 johnbillion3 years ago

  • Cc johnbillion@… added

comment:16 nacin3 years ago

#5371 closed as a duplicate.

Considering #15444 a duplicate as well, I think.

comment:17 norbertm3 years ago

#4539 seems to be solving this as well. The tests that @westi added all pass now and I also added some more to make sure.

comment:18 xibe3 years ago

Well, I just updated my test blog to the latest alpha, and my test post for this issue doesn't show any difference since 3.0.1.

comment:19 norbertm3 years ago

It's only a patch for now attached to #4539. Hopefully it will soon make it into SVN and then a release.

comment:20 nacin3 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed

comment:21 bjo18 months ago

  • Cc bjo added
Note: See TracTickets for help on using tickets.