Comment tweak
This commit is contained in:
parent
14705c505a
commit
4a8bdcaa63
3 changed files with 12 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
-- | Blaze without attribute operators
|
-- | Blaze without attribute operators.
|
||||||
|
|
||||||
module Blaze.Senza where
|
module Blaze.Senza where
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,14 @@ import Text.XML.Cursor
|
||||||
getWikiPage :: Text -> IO (Either Text (Text,Pandoc))
|
getWikiPage :: Text -> IO (Either Text (Text,Pandoc))
|
||||||
getWikiPage article =
|
getWikiPage article =
|
||||||
do request <- parseUrl ("http://www.haskell.org/haskellwiki/Special:Export/" <> unpack article)
|
do request <- parseUrl ("http://www.haskell.org/haskellwiki/Special:Export/" <> unpack article)
|
||||||
withManager $ \manager -> do
|
withManager
|
||||||
response <- http request manager
|
(\manager ->
|
||||||
|
do response <- http request manager
|
||||||
doc <- catch (fmap Just (responseBody response $$+- sinkDoc def))
|
doc <- catch (fmap Just (responseBody response $$+- sinkDoc def))
|
||||||
(\(_::UnresolvedEntityException) -> return Nothing)
|
(\(_::UnresolvedEntityException) -> return Nothing)
|
||||||
case doc >>= parse of
|
case doc >>= parse of
|
||||||
Nothing -> return (Left "Unable to parse XML from haskell.org.")
|
Nothing -> return (Left "Unable to parse XML from haskell.org.")
|
||||||
Just (title,pan) -> return (Right (title,pan))
|
Just (title,pan) -> return (Right (title,pan)))
|
||||||
where
|
where
|
||||||
parse doc =
|
parse doc =
|
||||||
do let cursor = fromDocument doc
|
do let cursor = fromDocument doc
|
||||||
|
|
|
@ -93,7 +93,8 @@ bread url crumbs =
|
||||||
ol [class_ "breadcrumb"]
|
ol [class_ "breadcrumb"]
|
||||||
(forM_ crumbs
|
(forM_ crumbs
|
||||||
(\route ->
|
(\route ->
|
||||||
li [] (a [href (url route)]
|
li []
|
||||||
|
(a [href (url route)]
|
||||||
(toHtml (fromRoute route)))))
|
(toHtml (fromRoute route)))))
|
||||||
|
|
||||||
-- | Generate a human-readable string from a route.
|
-- | Generate a human-readable string from a route.
|
||||||
|
|
Loading…
Reference in a new issue