Make WordPress Core

Opened 19 years ago

Closed 15 years ago

Last modified 7 years ago

#1418 closed defect (bug) (fixed)

wptexturize doesn't correctly translate doublequote in brackets

Reported by: kafkaesqui's profile Kafkaesqui Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.4
Component: Formatting Keywords: dev-feedback has-patch needs-testing
Focuses: Cc:

Description

When a doublequote directly follows an opening bracket (parenthesis, etc), the quote is incorrectly translated to the closing doublequote ncr (”). I've modified line 30 of functions-formatting.php to partially account for non-whitespace characters before the opening quote.

Attachments (2)

wptexturize.patch (772 bytes) - added by Kafkaesqui 19 years ago.
Patch to functions-formatting.php for wptexturize doublequote regexp fix.
quotes_in_parentheses.patch (1.1 KB) - added by voyou1 15 years ago.

Download all attachments as: .zip

Change History (19)

@Kafkaesqui
19 years ago

Patch to functions-formatting.php for wptexturize doublequote regexp fix.

#1 @kafkaesqui
19 years ago

  • Keywords bg|has-patch bg|dev-feedback added

#2 @matt
18 years ago

  • Milestone changed from 1.6 to 2.1

#3 @matt
17 years ago

  • Milestone changed from 2.1 to 2.2

#4 @foolswisdom
17 years ago

  • Keywords has-patch dev-feedback added; bg|has-patch bg|dev-feedback removed
  • Milestone changed from 2.2 to 2.3

#5 @rob1n
17 years ago

  • Keywords has-patch formatting wptexturize curl quotes removed

Patch won't apply -- for one thing the filenames are different now.

Also, I'm not fluent in REGEX, so I'm not sure. Probably needs testing.

#6 @rob1n
17 years ago

  • Component changed from Administration to General

#7 @markjaquith
17 years ago

  • Milestone changed from 2.3 to 2.4 (next)

We need some examples of input text and output text (and desired output).

#8 @jokeofalltrades
16 years ago

Example:
("ABC") should render as (“NRDC”), but in fact renders as (”ABC“) - precisely backwards. These types of expressions are often used in legal texts (and lots of other texts) to signify abbreviations that will be used throughout the text the first time they are encountered. The only example I can find at the moment is here (search for "NRDC").

As far as I can see, ideal behavior for wptexturize would require that:
(1) opening quotes (entities &#8220 or &#8216) never appear immediately before a closing bracket of any sort or whitespace of any sort; and
(2) closing double quotes (entity &#8221) should never appear immediately after an opening bracket of any sort or whitespace of any sort.

The closing single quote (entity &#8217) is trickier, because there may be times when a parenthetical or other bracketed expression starts with a contracted year reference or a slang term ("cockney") beginning with an apostrophe (though these should be rare), and obviously any of those expressions will usually be preceded by whitespace.

The two rules above, though, should be top-level rules that trump all other smart-quote replacement rules, shouldn't they?

See also ticket #1258 for problems with quotes near whitespace.

#9 @jokeofalltrades
16 years ago

Oops, that should read:
Example: ("ABC") should render as (“ABC”), but in fact renders as (”ABC“) - precisely backwards.

#10 @thee17
16 years ago

  • Keywords recomend-closing added

#11 @Nazgul
16 years ago

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

I agree with thee17, so closing as wontfix for now.

Feel free to re-open if you have additional patches/information/suggestions/...

#12 @voyou1
15 years ago

  • Cc voyou1 added
  • Component changed from General to Formatting
  • Keywords recomend-closing removed
  • Resolution wontfix deleted
  • Status changed from closed to reopened
  • Version changed from 1.5.1.1 to 2.8.4

I'm reopening, as this bug still exists. The current behaviour is:

  • ("test") converts to (”test”)
    • incorrect, should be (“test”)
  • ('test') converts to (’test’)
    • incorrect, should be (‘test’)
  • ('twas) converts to (’twas)
    • correct, cockney.

I've attached a patch against HEAD which fixes the two incorrect behaviours, and doesn't alter the third, correct, behaviour.

#13 @westi
15 years ago

  • Milestone set to 2.9

#14 @voyou1
15 years ago

  • Keywords has-patch needs-testing added

#15 @westi
15 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in [11813]

#16 @SergeyBiryukov
10 years ago

#9306 was marked as a duplicate.

This ticket was mentioned in Slack in #core-editor by chopinbach. View the logs.


7 years ago

Note: See TracTickets for help on using tickets.