Ticket #1418 (closed defect (bug): fixed)

Opened 7 years ago

Last modified 2 years ago

wptexturize doesn't correctly translate doublequote in brackets

Reported by: Kafkaesqui Owned by: anonymous
Priority: normal Milestone: 2.9
Component: Formatting Version: 2.8.4
Severity: normal Keywords: dev-feedback has-patch needs-testing
Cc: voyou1

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

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

Change History

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

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

comment:2   matt6 years ago

  • Milestone changed from 1.6 to 2.1

comment:3   matt5 years ago

  • Milestone changed from 2.1 to 2.2
  • Keywords has-patch dev-feedback added; bg|has-patch bg|dev-feedback removed
  • Milestone changed from 2.2 to 2.3
  • 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.

  • Component changed from Administration to General
  • Milestone changed from 2.3 to 2.4 (next)

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

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.

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

  • Keywords recomend-closing added
  • Status changed from new to closed
  • Resolution set to wontfix
  • Milestone 2.5 deleted

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

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

voyou12 years ago

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

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.

  • Milestone set to 2.9
  • Keywords has-patch needs-testing added
  • Status changed from reopened to closed
  • Resolution set to fixed

Fixed in [11813]

Note: See TracTickets for help on using tickets.