[Completed naive HTML generation and tested lightly Manuel M T Chakravarty **20060502173533] { hunk ./Config.hs 14 + -- * Identity + version, copyright, disclaimer, + hunk ./Config.hs 49 -versnick = "\"Lambdas for all!\"" -date = "26 Apr 2006" +versnick = "'Lambdas for all!'" +date = "02 May 2006" hunk ./Feed.hs 72 +-- Generic categorisation information +-- +data Category = Category { + categoryCategory :: String, + domainCategory :: Maybe String + } + deriving Show + hunk ./Feed.hs 92 --- Generic categorisation information --- -data Category = Category { - categoryCategory :: String, - domainCategory :: Maybe String - } - deriving Show - hunk ./HTML.hs 23 +import Data.Maybe ( + isJust) hunk ./HTML.hs 88 -itemToHTML item = noHtml -- !!!FIXME +itemToHTML item = + thediv ! [theclass "item"] << concatHtml + [ titleItem item `optional` + \title -> linkItem item `optionalHrefFor` (h2 << title) + , descriptionItem item `optional` (p <<) + , thediv ! [theclass "authorDate"] << concatHtml + [ authorItem item `optional` toHtml + , if isJust (authorItem item) && isJust (authorItem item) + then bullet else noHtml + , pubDateItem item `optional` (toHtml . show) + ] + , thediv ! [theclass "commentsEnclosure"] << concatHtml + [ enclosureItem item `optional` enclosureToHtml + , if isJust (enclosureItem item) && + isJust (commentsItem item) + then bullet else noHtml + , commentsItem item `optional` + \commentsLink -> anchor ! [href commentsLink] << "Comments" + ] + ] + +-- Render an enclosure to HTML. +-- +enclosureToHtml :: Enclosure -> Html +enclosureToHtml enc = + anchor ! [href (urlEnclosure enc), thetype (typeEnclosure enc) ] << + "Enclosure" hunk ./HTML.hs 127 +-- An optional enclosing href. +-- +optionalHrefFor :: Maybe String -> Html -> Html +optionalHrefFor Nothing inner = inner +optionalHrefFor (Just link) inner = anchor ! [href link] << inner + hunk ./LambdaFeed.hs 65 +-- * Channel formatting. +-- hunk ./LambdaFeed.hs 71 +-- * Support cloud specification. +-- hunk ./LambdaFeed.hs 180 - generatorChan = version, + generatorChan = Just version, hunk ./LambdaFeed.hs 186 - } + }, + docsChan = docsChan chan `mplus` Just specUrl hunk ./LambdaFeed.hs 189 + where + specUrl = "http://www.rssboard.org/rss-specification" hunk ./LambdaFeed.hs 228 - return feed + do + sayV config $ "Formatting feed (NOTHING DONE YET)" + return feed hunk ./LambdaFeed.hs 245 + sayV config $ "Writing HTML for channel `" ++ titleChan chan ++ + "' to `" ++ fname ++ "'" hunk ./LambdaFeed.hs 252 + sayV config $ "Writing RSS for channel `" ++ titleChan chan ++ + "' to `" ++ fname ++ "'" }