Skip to content
Browse files

Experimental filters to remove returns from before and after tags, which

should mean neater formatting of lists and so on.  Needs testing.
  • Loading branch information...
1 parent 793f20b commit 729be1ab37a2eb35cbda4a3ca8be2bf70bdfd3c1 martin committed Aug 22, 2002
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/weblib.php
View
7 lib/weblib.php
@@ -273,6 +273,13 @@ function text_to_html($text, $smiley=true, $para=true) {
$text = eregi_replace("([[:space:]])www.([^[:space:]]*)([[:alnum:]#?/&=])",
"\\1<A HREF=\"http://www.\\2\\3\" TARGET=\"newpage\">www.\\2\\3</A>", $text);
+ // Remove any whitespace that may be between HTML tags
+ $text = eregi_replace(">([[:space:]]+)<", "><", $text);
+
+ // Remove any returns that precede or follow HTML tags
+ $text = eregi_replace("([\n\r])+<", " <", $text);
+ $text = eregi_replace(">([\n\r])+", "> ", $text);
+
// Make returns into HTML newlines.
$text = nl2br($text);

0 comments on commit 729be1a

Please sign in to comment.
Something went wrong with that request. Please try again.