- Timestamp:
- 02/09/2010 12:57:43 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/WordPress/plugin/transposh/core/parser.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/core/parser.php
r376 r379 261 261 */ 262 262 function is_number($page, $position) { 263 return strspn($page,'0123456789-+ ,.\\/',$position);263 return strspn($page,'0123456789-+$%,.\\/',$position); 264 264 } 265 265 … … 329 329 } 330 330 // Numbers also break, if they are followed by whitespace (or a sentence breaker) (don't break 42nd) // TODO: probably by breaking entities too... 331 // also prefixed by whitespace? 331 332 elseif($num_len = $this->is_number($string,$pos)) { 332 if ($this->is_white_space($string[$pos+$num_len]) || $this->is_sentence_breaker($string[$pos+$num_len],$string[$pos+$num_len+1],$string[$pos+$num_len+2])) { 333 // this is the case of B2 or B2, 334 if (($this->is_white_space($string[$pos-1]) || ($start == $pos) 335 || ($this->is_sentence_breaker($string[$pos+$num_len-1],$string[$pos+$num_len],$string[$pos+$num_len+1]))) && 336 ($this->is_white_space($string[$pos+$num_len]) || $this->is_sentence_breaker($string[$pos+$num_len],$string[$pos+$num_len+1],$string[$pos+$num_len+2]))) { 337 // we will now compensate on the number followed by breaker case, if we need to 338 if (!($this->is_white_space($string[$pos-1]) || ($start == $pos))) { 339 if ($this->is_sentence_breaker($string[$pos+$num_len-1],$string[$pos+$num_len],$string[$pos+$num_len+1])) { 340 $num_len--; //this makes the added number shorter by one, and the pos will be at a sentence breaker next so we don't have to compensate 341 } 342 $pos += $num_len; 343 $num_len = 0; // we have already added this 344 } 333 345 $this->tag_phrase($string,$start,$pos); 334 346 $start = $pos + $num_len + 1;
Note: See TracChangeset
for help on using the changeset viewer.
