hackage2hwn 0.4 → 0.4.1
raw patch · 2 files changed
+17/−6 lines, 2 filesdep +download
Dependencies added: download
Files
- Main.hs +15/−4
- hackage2hwn.cabal +2/−2
Main.hs view
@@ -18,19 +18,23 @@ import Data.List import Data.Char -import Text.HTML.Download+import Network.Download import Text.HTML.TagSoup import Text.Feed.Import import Text.RSS.Syntax import Text.Feed.Types +import Debug.Trace+ url = "http://hackage.haskell.org/packages/archive/recent.rss" main = do- putStrLn "'''Recent Package Updates''' [http://hackage.haskell.org/packages/archive/recent.rss http://haskell.org/sitewiki/images/0/09/Rss.png]\n"- RSSFeed is <- (fromJust . parseFeedString) `fmap` openURL url- mapM_ (putStr . pprRSS) (rssItems . rssChannel $ is)+ putStrLn "'''Recent Package Updates''' [http://haskell.org/haskellwiki/Hackage_statistics http://galois.com/~dons/images/hackage-daily.png] [http://hackage.haskell.org/packages/archive/recent.rss http://haskell.org/sitewiki/images/0/09/Rss.png]\n"++ Right src <- openURIString url+ let Just (RSSFeed is) = parseFeedString src+ mapM_ (putStr . pprRSS) (clean . rssItems . rssChannel $ is) putStrLn $ "[http://hackage.haskell.org/packages/archive/pkg-list.html More...]" pprRSS :: RSSItem -> String@@ -40,5 +44,12 @@ where Just title = rssItemTitle $ r Just url = rssItemLink $ r++ -- May not be the actual synopsis. Parse the .cabal file instead? synopsis = last [ e | TagText e <- parseTags (fromJust . rssItemDescription $ r) ]++clean :: [RSSItem] -> [RSSItem]+clean = nubBy $ \x y -> let a = takeWhile (/= ' ') . fromJust $ rssItemTitle x+ b = takeWhile (/= ' ') . fromJust $ rssItemTitle y+ in a == b
hackage2hwn.cabal view
@@ -1,5 +1,5 @@ Name: hackage2hwn-Version: 0.4+Version: 0.4.1 homepage: http://code.haskell.org/~dons/code/hackage2hwn 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@@ -8,7 +8,7 @@ License-file: LICENSE Author: Don Stewart Maintainer: <dons@galois.com>-Build-Depends: base, tagsoup, feed+Build-Depends: base, tagsoup, download, feed Build-type: Simple Executable: hackage2hwn