You are here

function codefilter_fix_spaces in Code Filter 6

Same name and namespace in other branches
  1. 5 codefilter.module \codefilter_fix_spaces()
  2. 7 codefilter.module \codefilter_fix_spaces()
2 calls to codefilter_fix_spaces()
codefilter_process_code in ./codefilter.module
Processes chunks of escaped code into HTML.
codefilter_process_php in ./codefilter.module
Processes chunks of escaped PHP code into HTML.

File

./codefilter.module, line 78

Code

function codefilter_fix_spaces($text) {
  $text = preg_replace('@ (?! )@', ' ', $text);

  // A single space before text is ignored by browsers. If a single space
  // follows a break tag, replace it with a non-breaking space.
  $text = preg_replace('@<br /> ([^ ])@', '<br />&nbsp;$1', $text);
  return $text;
}