WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 2 weeks ago

#8775 reopened defect (bug)

Numbers in quotation marks get wrong smart quotes

Reported by: filosofo Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.8
Component: Formatting Keywords: has-patch needs-testing wptexturize
Focuses: Cc:

Description

Have a number in quotation marks, such as "12345" or '12345' and wptexturize converts the right quotation mark to double-prime and prime marks, respectively.

Patch fixes.

Attachments (7)

number_curly_quotes.diff (1.3 KB) - added by filosofo 5 years ago.
number_curly_quotes.2.diff (1.3 KB) - added by mrmist 5 years ago.
Update against current trunk
8775-quotes-patch.diff (1.2 KB) - added by aliso 21 months ago.
Quotation mark fix for most recent code in formatting.php
before-8775-patch.png (1.5 KB) - added by MikeHansenMe 18 months ago.
screenshot of problem
after-8775-patch.png (2.1 KB) - added by MikeHansenMe 18 months ago.
screenshot after patch
8775.4.diff (1.2 KB) - added by MikeHansenMe 18 months ago.
Updated patch path relative from wp folder
miqro-8775.patch (3.7 KB) - added by miqrogroove 3 weeks ago.

Download all attachments as: .zip

Change History (39)

comment:1 mrmist5 years ago

Probably a dupe see also #7754 #4539 #3810 #4116 #1258

There neeeds to be a big old wp_texturize fix task or something.

comment:2 ryan5 years ago

  • Component changed from General to Formatting
  • Owner anonymous deleted

comment:4 Denis-de-Bernardy5 years ago

  • Keywords needs-testing added

mrmist5 years ago

Update against current trunk

comment:5 mrmist5 years ago

  • Keywords tested commit added; needs-testing removed

Updated patch. Tested with numbers and single/double quotes. Seems to work. doesn't appear to break anything else, so marking as tested. Comitting would seem the fastest way of geting more test exposure.

comment:7 follow-up: Denis-de-Bernardy5 years ago

are there any unit tests on wptexturize?

comment:8 Denis-de-Bernardy5 years ago

or at least, known, funky test cases to watch for?

comment:9 azaozz5 years ago

  • Keywords needs-testing added; tested wptexturize formatting curly-quotes numbers commit removed

comment:10 in reply to: ↑ 7 azaozz5 years ago

Replying to Denis-de-Bernardy:

are there any unit tests on wptexturize?

Seems like this needs more testing with non-latin languages.

comment:11 Denis-de-Bernardy5 years ago

  • Component changed from Formatting to i18n
  • Owner set to nbachiyski

k... moving this over to i18n then. I wouldn't know what to test on this front. :-)

D.

comment:12 azaozz5 years ago

Also see #3810.

comment:13 Denis-de-Bernardy5 years ago

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

punting pending unit tests... even though, like the one wpautop one I just punted, I think this should get committed outright.

comment:14 Denis-de-Bernardy5 years ago

  • Component changed from i18n to Formatting
  • Milestone changed from Future Release to 2.9
  • Owner nbachiyski deleted

comment:15 janeforshort4 years ago

  • Milestone changed from 2.9 to Future Release

Punting b/c no tests done in 6 months and we're in beta.

comment:16 follow-up: filosofo4 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Let's be realistic.

comment:17 in reply to: ↑ 16 ; follow-up: Viper007Bond3 years ago

  • Milestone set to Future Release
  • Resolution wontfix deleted
  • Status changed from closed to reopened

It's still a valid issue. Just because progress isn't being made isn't reason enough to close the ticket.

comment:18 in reply to: ↑ 17 Denis-de-Bernardy3 years ago

Replying to Viper007Bond:

It's still a valid issue. Just because progress isn't being made isn't reason enough to close the ticket.

Any chances you've got a patch? :-)

comment:19 filosofo3 years ago

We have a patch. It's the prerequisite wptexturize unit tests that are missing.

aliso21 months ago

Quotation mark fix for most recent code in formatting.php

comment:21 aliso21 months ago

It looks like the previous patch won't work with the code change from [19795]. I attached a patch that fixes it in the most recent code.

This also solves part 1 of #16957 (same bug).

MikeHansenMe18 months ago

screenshot of problem

MikeHansenMe18 months ago

screenshot after patch

MikeHansenMe18 months ago

Updated patch path relative from wp folder

comment:22 MikeHansenMe18 months ago

  • Cc mdhansen@… added

aliso patch works for me. I updated the patch path and included some screenshots of the problem.

Version 0, edited 18 months ago by MikeHansenMe (next)

comment:23 damst16 months ago

  • Cc damst added

comment:25 aliso12 months ago

Any idea when this fix can make it into core? The unit tests should be the same as in http://unit-tests.trac.wordpress.org/changeset/757, right?

comment:26 nacin3 months ago

  • Keywords wptexturize added

comment:27 miqrogroove6 weeks ago

What is this intended output for these examples?

I need 4 x 20'=80' of trim.

The best year "was that time in 2012" when everyone partied, he said.

comment:28 miqrogroove6 weeks ago

I recommend narrowing the focus of this patch so that it will not affect text other than numbers surrounded by quotes preceded by spaces. Examples:

"2004"
'27'
The answer is "42".

Numbers at the beginning or ending of quoted phrases have ambiguous meaning if we want to keep using the primes logic.

comment:29 miqrogroove5 weeks ago

#14491 was marked as a duplicate.

comment:30 miqrogroove5 weeks ago

#16957 was marked as a duplicate.

miqrogroove3 weeks ago

comment:31 miqrogroove3 weeks ago

  • Keywords needs-unit-tests removed

New patch against trunk should be much closer to what we need. In miqro-8775.patch:

  • Quoted numbers preceded by spaces get curly quotes.
  • So, "123" works, but"123"blah does not work.
  • Trailing space not required. Will this break things like '99's?
  • Decimals and commas are allowed after the first digit.
  • nbsp works as whitespace.
  • Regexp will search for quotes first for optimum performance.
  • Unit tests updated to match.

comment:32 miqrogroove2 weeks ago

This will also break the assertion for 'Class of '99', but that is highly ambiguous.

Note: See TracTickets for help on using tickets.