Commits

Luke Plant  committed 9accedd

Moved some code around, removed unused code

  • Participants
  • Parent commits 874ca7b

Comments (0)

Files changed (2)

File src/Blog/Templates.hs

 import qualified Blog.Post as P
 import qualified Blog.Settings as Settings
 import qualified Data.ByteString.Lazy.UTF8 as UTF8
+import qualified Data.ByteString.Lazy as LB
 import qualified Data.Map as Map
 
+-- Templates
+
+get_templates :: IO (STGroup LB.ByteString)
+get_templates = do
+  templates' <- directoryGroup Settings.template_path
+  return $ setEncoderGroup escapeHtmlString templates'
+
+get_template :: String -> IO (StringTemplate LB.ByteString)
+get_template name = do
+  templates <- get_templates
+  return $ fromJust $ getStringTemplate name templates
+
 -- Widgets
 
 commentNameLabel       = makeLabel "Name:" nameWidget
                   then "Anonymous Coward"
                   else name
 
-categoryLink c = toHtml $ hotlink (categoryUrl c) << (C.name c)
-
-postLink p = toHtml $ hotlink (postUrl p) << (P.title p)
-
 showDate timestamp = formatCalendarTime defaultTimeLocale  "%e %B %Y" (toUTCTime $ epochToClockTime timestamp)
 
-
 -- HStringTemplate related:
 
 -- Allow for heterogeneous lists

File src/Blog/Views.hs

 import Blog.Links
 import Blog.Model
 import Blog.Templates
-import Blog.Utils (escapeHtmlString)
-import Data.ByteString.Lazy (ByteString)
 import Ella.Framework (default404, View)
 import Ella.GenUtils (utf8, with, exactParse, getTimestamp)
 import Ella.Param (captureOrDefault, capture)
                         setStatus 404
                        ]
 
--- Templates
-
-get_templates :: IO (STGroup ByteString)
-get_templates = do
-  templates' <- directoryGroup Settings.template_path
-  return $ setEncoderGroup escapeHtmlString templates'
-
-get_template :: String -> IO (StringTemplate ByteString)
-get_template name = do
-  templates <- get_templates
-  return $ fromJust $ getStringTemplate name templates
-
 ---- Views
 
 -- View for the main page