From f6d12672b141d372806d0d08cef0efbd4b209f9a Mon Sep 17 00:00:00 2001 From: Andrew Berry Date: Wed, 11 May 2011 19:40:33 -0400 Subject: [PATCH] #76234: Fix leading space in code being ignored by browsers. --- codefilter.module | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/codefilter.module b/codefilter.module index 28d6d1d..0d6ce6f 100644 --- a/codefilter.module +++ b/codefilter.module @@ -76,7 +76,11 @@ function codefilter_process_code($text) { } function codefilter_fix_spaces($text) { - return preg_replace('@ (?! )@', ' ', $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('@
([^ ])@', '
 $1', $text); + return $text; } /** -- 1.7.5