From: x2003bruneau Date: Fri, 14 Jul 2006 22:04:53 +0000 (+0000) Subject: Better... X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=26f87187e453ccd383ee1fad48afa9863cfbaa0e;p=banana.git Better... It seems that autoformat behaviour depends a lot on Text::Autoformat version :/ git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@100 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/banana/misc.inc.php b/banana/misc.inc.php index c379ba0..5a76e82 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -427,12 +427,16 @@ function displayShortcuts($first = -1) * FORMATTING STUFF : BODY */ -function autoformat($text) +function autoformat($text, $part = false) { global $banana; $length = $banana->wrap; + $all = null; + if (!$part) { + $all = ', all=1'; + } - $cmd = "echo ".escapeshellarg($text)." | perl -MText::Autoformat -e 'autoformat {left=>1, right=>$length };'"; + $cmd = "echo ".escapeshellarg($text)." | perl -MText::Autoformat -e 'autoformat {left=>1, right=>$length$all };'"; exec($cmd, $result, $ret); if ($ret != 0) { $result = split("\n", $text); @@ -486,7 +490,7 @@ function wrap($text, $_prefix="", $_force=false) } } else { if (strlen($line) > 2 * $max) { - $next = array_merge($next, autoformat($line)); + $next = array_merge($next, autoformat($line, true)); } else { $format = true; array_push($next, $line);