packages feed

hackage2hwn 0.2.1 → 0.3

raw patch · 2 files changed

+34/−26 lines, 2 filesdep +filepathdep ~xml

Dependencies added: filepath

Dependency ranges changed: xml

Files

Main.hs view
@@ -19,22 +19,26 @@ import Data.List import Data.Char +import Debug.Trace+import System.FilePath import Text.HTML.Download import Text.HTML.TagSoup import Control.Applicative  url = "http://hackage.haskell.org/packages/archive/recent.rss" -main = mapM_ ppr . render . parseXMLDoc =<< openURL url+main = do+    putStrLn "'''Recent Package Updates'''\n"+    mapM_ ppr . render . parseXMLDoc =<< openURL url+    putStrLn $ " [http://hackage.haskell.org/packages/archive/pkg-list.html More...]\n[http://hackage.haskell.org/packages/archive/recent.rss RSS]"  -- pretty print in human readable format-ppr (HackageItem a b c) = putStrLn $-    unlines [ "HackageItem"-            , show a-            , show b-            , show c ++ ","-            ]+ppr (HackageItem title url _ _ synopsis) = putStrLn $+  unlines+    [(";" ++ "[" ++ url ++ " "++  title ++ "]")+    ,(":" ++ synopsis)] + -- parse xml into hackage items render Nothing  = error "Unable to download hackage" render (Just e) = map process items@@ -44,17 +48,16 @@           items    = map onlyElems [ (elContent e) | Elem e <- drop 10 body ]  -          process [a,b,c,d,e] =+          process xs@[a,b,c,d,e] =                 HackageItem proj+                            projurl+                            name                             author-                            ("[" ++ projurl-                                 ++ " "-                                 ++ takeWhile (not.isSpace) proj-                                 ++ "]: " ++ synopsis ++ "."-                            )+                            synopsis              where                proj     = strContent a                projurl  = strContent b+               name     = takeFileName projurl                descr    = strContent e                author   =                     let (h:rest) =@@ -68,7 +71,16 @@                synopsis = last [ e |  TagText e <- parseTags descr ]  -- hackage items in the haskell weekly news-data HackageItem = HackageItem Title Author Body-type Title  = String-type Author = String-type Body   = String+data HackageItem =+    HackageItem+        Title+        Url+        CanonicalName+        Author+        Body++type Title         = String+type Url           = String+type Author        = String+type CanonicalName = String+type Body          = String
hackage2hwn.cabal view
@@ -1,19 +1,15 @@ Name:                hackage2hwn-Version:             0.2.1+Version:             0.3 homepage:            http://code.haskell.org/~dons/code/hackage2hwn-Synopsis:            Convert Hackage RSS feeds to Haskell Weekly News format-Description:         Download and parse the Hackage RSS 2.0 feed for the-                     automatic inclusion in the Haskell Weekly News.-                     .-                     Code coverage results for this tool are available:-                     <http://code.haskell.org/~dons/tests/hackage2hwn/hpc_index.html>-                     .+Synopsis:            Convert Hackage RSS feeds to wiki format for publishing on Haskell.org+Description:         Convert Hackage RSS feeds to wiki format for publishing on Haskell.org Category:            Text License:             BSD3 License-file:        LICENSE Author:              Don Stewart  Maintainer:          <dons@galois.com>-Build-Depends:       base, tagsoup ==0.4, xml ==1.2.3+Build-Depends:       base, filepath, tagsoup ==0.4, xml+Build-type:          Simple  Executable:          hackage2hwn Main-is:             Main.hs