blogination 0.4 → 0.5
raw patch · 3 files changed
+14/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.Blogination: blogHome :: Blog -> Maybe URL
+ Text.Blogination: blogHomeName :: Blog -> Maybe String
- Text.Blogination: Blog :: String -> String -> [String] -> FilePath -> FilePath -> String -> Bool -> String -> FilePath -> String -> Maybe String -> Blog
+ Text.Blogination: Blog :: String -> String -> [String] -> FilePath -> FilePath -> String -> Bool -> String -> FilePath -> URL -> Maybe String -> Maybe URL -> Maybe String -> Blog
- Text.Blogination: blogURL :: Blog -> String
+ Text.Blogination: blogURL :: Blog -> URL
Files
- blogination.cabal +1/−1
- executable/Main.hs +4/−1
- library/Text/Blogination.hs +9/−3
blogination.cabal view
@@ -1,5 +1,5 @@ name: blogination-version: 0.4+version: 0.5 synopsis: Very simple static blog software description: Blogination reads files written in markdown and outputs xhtml. Supports syntax highlighting. Philosophy is simplicity. Can be used as a library, in a web application for example. Intended use is a simple commandline program to run after changes are made. Ideally use darcs or git with it. category: Web
executable/Main.hs view
@@ -29,6 +29,7 @@ contents <- liftIO $ readFile filePath config <- C.readstring C.emptyCP contents let get = C.get config "BLOG"+ optional key = Just <$> get key <|> return Nothing Blog <$> get "name" <*> get "root" <*> (read <$> get "css") @@ -39,4 +40,6 @@ <*> get "date" <*> return "tags" <*> get "url"- <*> (Just <$> get "analytics" <|> return Nothing)+ <*> optional "analytics"+ <*> optional "home"+ <*> optional "home-name"
library/Text/Blogination.hs view
@@ -47,8 +47,10 @@ , blogDate :: String -- date format e.g. -- "%A %d %b, %Y" makes "Tuesday 10 Feb, 2009" , blogTags :: FilePath- , blogURL :: String -- e.g. "http://chrisdone.com/blog"+ , blogURL :: URL -- e.g. "http://chrisdone.com/blog" , blogAnalytics :: Maybe String -- google analytics ID e.g. UA-7443395-1+ , blogHome :: Maybe URL -- home page e.g. "http://chrisdone.com/"+ , blogHomeName :: Maybe String -- home page e.g. Chris Done's Home Page } deriving (Read,Show) type Blogination = ErrorT String (StateT Blog IO)@@ -150,7 +152,7 @@ entryTags <- mapM (entryTags alltags) entries anal <- analytics let html = toHtml [header<<[title,encoding,rss,toHtml $ map style blogCSS]- ,body<<[name,menu,tags,anal]]+ ,body<<[back,hr,name,menu,tags,hr,back,anal]] title = thetitle << blogName name = h1 << blogName menu = h2 << "Posts" +++ ul (map (showLink blog) $ zip links entryTags)@@ -160,6 +162,10 @@ ,href $ blogRoot++"rss.xml"] << noHtml style css = thelink ! [rel "stylesheet",href (blogRoot++css)] << noHtml+ back = fromMaybe noHtml $ do+ url <- blogHome+ name <- blogHomeName+ return $ p << hotlink url << ("« Back to " ++ name) liftIO $ writeFile "index.html" $ showHtml html showLink :: Blog -> ((URL,String,UTCTime,ClockTime),[FilePath]) -> Html@@ -342,7 +348,7 @@ highlightOpts _ = Nothing highlightWith :: String -> String -> Block-highlightWith lang code = RawHtml $ showHtml html where+highlightWith lang code = RawHtml $ showHtmlFragment html where html = either (const def) format highlight format = formatAsXHtml [] lang highlight = highlightAs lang code