** // __ do not break url catcher anymore
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Wed, 12 Jul 2006 08:41:44 +0000 (08:41 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:53 +0000 (00:34 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@81 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/misc.inc.php

index 7a782c4..6fb384c 100644 (file)
@@ -493,8 +493,13 @@ function formatbody($_text, $format='plain', $flowed=false)
         $formatting = Array('\*' => 'strong',
                             '_' => 'u',
                             '/' => 'em');
+        $word    = '-a-z0-9\'âäàãéêëêïîìöôòõüûùÿ';
         foreach ($formatting as $limit=>$mark) {
-            $res = preg_replace('@' . $limit . '([^\s]+)' . $limit . '@', "<$mark>\\1</$mark>", $res);
+            $res = preg_replace('@([^' . $word . '])'
+                                . $limit . '([' . $word . ']+)' . $limit 
+                                . '([^' . $word  . '])@i'
+                                ,'\1<' . $mark . '>\2</' . $mark . '>\3'
+                                , $res);
         }
     }