Opened 18 months ago

Last modified 18 months ago

#19308 new enhancement

C-style hexadecimal is incorrectly "fixed" to change the 'x' into a mathematical '×'

Reported by: harrym Owned by:
Priority: normal Milestone: Awaiting Review
Component: Formatting Version: 2.1
Severity: normal Keywords: has-patch needs-unit-tests
Cc: kpayne@…

Description

Pretty much what the title says. I'm running trunk. "0x07" gets converted to "0×07".

I've attached a patch which fixes this issue by not performing the conversion if the first number starts with a zero -- this is not perfect, and I might have a go at something better when it's not 0030, if you guys decide this should be changed.

My $0.02 - since it's a bit odd to multiply zero by something, I don't think that very many people will expect/want this conversion to happen -- and the lack of conversion is unlikely to confuse those that do.

On the other hand, this conversion is confusing for any blog post using this hex notation, and does make those posts actually wrong.

Attachments (3)

dont-break-hex.diff (1.2 KB) - added by harrym 18 months ago.
19308.patch (1.3 KB) - added by kurtpayne 18 months ago.
Allowing for decimals, commas, negative signs
19308_unit_test.patch (1.3 KB) - added by kurtpayne 18 months ago.
Unit test wptexturize('AxB') for comma, decimal, and hex numbers

Download all attachments as: .zip

Change History (7)

At a glance, patch looks great! We'll want unit tests for this.

  • Keywords needs-unit-tests added

Allowing for decimals, commas, negative signs

Unit test wptexturize('AxB') for comma, decimal, and hex numbers

  • Cc kpayne@… added
  • Type changed from defect (bug) to enhancement
  • Version set to 2.1
Note: See TracTickets for help on using tickets.