[Added HStringTemplate support, reorganized AppView a little Matthew Elder **20090222214909 Ignore-this: 5a9990b624942545c9415c63a3f3abfb ] hunk ./CHANGELOG 16 - ? Builtin support for HSP, HStringTemplate (see example template / release notes) + * Builtin support for HSP, HStringTemplate (see example template / release notes) + * happstack-server once again builds on Windows hunk ./happstack/happstack.cabal 41 + Happstack.Server.HStringTemplate hunk ./happstack/happstack.cabal 52 + hslogger, hunk ./happstack/happstack.cabal 54 + HStringTemplate >= 0.4.3 && < 0.5, hunk ./happstack/templates/project/src/AppControl.hs 12 -import Happstack.Server.HSP.HTML (webHSP) hunk ./happstack/templates/project/src/AppControl.hs 19 + , dir "README" getREADME -- StringTemplate example hunk ./happstack/templates/project/src/AppControl.hs 25 - webHSP $ pageFromBody "Happstack Guestbook Example" gb + renderFromBody "Happstack Guestbook Example" gb hunk ./happstack/templates/project/src/AppControl.hs 27 +getREADME = methodM GET >> do + now <- liftIO getClockTime + renderREADME now hunk ./happstack/templates/project/src/AppView.hs 9 - +import Control.Monad.Trans (MonadIO) +import Happstack.Server.HStringTemplate (webST) +import Happstack.Server.HSP.HTML (webHSP) + +-- Convenience Functions +dateStr ct = + formatCalendarTime + defaultTimeLocale + "%a, %B %d, %Y at %H:%M:%S (UTC)" + (toUTCTime ct) + +-- Main Implementation hunk ./happstack/templates/project/src/AppView.hs 31 - where - p str =

<% str %>

- dateStr ct = formatCalendarTime defaultTimeLocale "%a, %B %d, %Y at %H:%M:%S (UTC)" (toUTCTime ct) + where p str =

<% str %>

hunk ./happstack/templates/project/src/AppView.hs 44 - + +renderFromBody title body = webHSP $ pageFromBody title body hunk ./happstack/templates/project/src/AppView.hs 90 +

+ This page is written using Haskell Server Pages (HSP). For an example + of a page using HStringTemplate, look at the + dynamic README. +

hunk ./happstack/templates/project/src/AppView.hs 115 + +renderREADME now = do + webST "readme" [("time", dateStr now)] + adddir ./happstack/templates/project/templates addfile ./happstack/templates/project/templates/readme.st hunk ./happstack/templates/project/templates/readme.st 1 +This is a dynamic README file which uses HStringTemplate. + +The time is $time$. + +Thanks for reading! +