Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/0587533bf2d8a28ebd133b663902bfbaf319b3fd

>---------------------------------------------------------------

commit 0587533bf2d8a28ebd133b663902bfbaf319b3fd
Author: Brent Yorgey <[email protected]>
Date:   Wed Mar 5 19:34:07 2008 +0000

    Hackage/List.hs: reflow paragraphs when displaying synopsis/description.

>---------------------------------------------------------------

 cabal-install/Hackage/List.hs |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/cabal-install/Hackage/List.hs b/cabal-install/Hackage/List.hs
index e769e51..0cd8856 100644
--- a/cabal-install/Hackage/List.hs
+++ b/cabal-install/Hackage/List.hs
@@ -14,7 +14,7 @@ module Hackage.List (
   list
   ) where
 
-import Data.List (sortBy, groupBy, sort, nub)
+import Data.List (sortBy, groupBy, sort, nub, intersperse)
 import Data.Maybe (listToMaybe, fromJust)
 import Data.Monoid (Monoid(mconcat))
 import Control.Monad (MonadPlus(mplus))
@@ -107,13 +107,19 @@ showPackageInfo pkg =
          (text . showVersion . maximum)
      , maybeShow (homepage pkg) "Homepage:" text
      , maybeShow (category pkg) "Category:" text
-     , maybeShow (synopsis pkg) "Synopsis:" (vcat . map text . lines)
+     , maybeShow (synopsis pkg) "Synopsis:" reflowParas
      , text "License: " <+> text (show (license pkg))
      ])
      $+$ text ""
   where
     maybeShow [] _ _ = empty
     maybeShow l  s f = text s <+> (f l)
+    reflowParas = vcat
+                . intersperse (text "")           -- re-insert blank lines
+                . map (fsep . map text . concatMap words)  -- reflow paras
+                . filter (/= [""])
+                . groupBy (\x y -> "" `notElem` [x,y])  -- break on blank lines
+                . lines
 
 -- | We get the 'PackageDisplayInfo' by combining the info for the installed
 -- and available versions of a package.



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to