Make WordPress Core


Ignore:
Timestamp:
06/17/2014 05:40:07 PM (12 years ago)
Author:
wonderboymusic
Message:

wptexturize() adjustments:

  • Only place an apostrophe before a number when it has exactly two digits.
  • Never match '99' with the single prime pattern.
  • Always assume '99' is an abbreviated year at the end of a quotation.
  • Add unit tests.
  • Resolves the unit test broken in [28721] for #8775.

See #26850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r28727 r28761  
    101101        $dynamic = array();
    102102
     103        // '99' is an ambiguous case among other patterns; assume it's an abbreviated year at the end of a quotation.
     104        if ( "'" !== $apos && "'" !== $closing_single_quote ) {
     105            $dynamic[ '/\'(\d\d)\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_single_quote;
     106        }
     107
     108        // '99 '99s '99's (apostrophe)  But never '9 or '999 or '99.0.
     109        if ( "'" !== $apos ) {
     110            $dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos;
     111        }
     112
    103113        // Quoted Numbers like "42" or '42.00'
    104114        if ( '"' !== $opening_quote && '"' !== $closing_quote ) {
     
    107117        if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) {
    108118            $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
    109         }
    110 
    111         // '99 '99s '99's (apostrophe)
    112         if ( "'" !== $apos ) {
    113             $dynamic[ '/\'(?=\d)/' ] = $apos;
    114119        }
    115120
Note: See TracChangeset for help on using the changeset viewer.