packages feed

heist 0.2.2 → 0.2.3

raw patch · 7 files changed

+26/−14 lines, 7 filesdep ~hexpatPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: hexpat

API changes (from Hackage documentation)

+ Text.Templating.Heist: bindString :: (Monad m) => ByteString -> ByteString -> TemplateState m -> TemplateState m
- Text.Templating.Heist: addTemplate :: (Monad m) => ByteString -> InternalTemplate -> TemplateState m -> TemplateState m
+ Text.Templating.Heist: addTemplate :: (Monad m) => ByteString -> Template -> TemplateState m -> TemplateState m

Files

heist.cabal view
@@ -1,5 +1,5 @@ name:           heist-version:        0.2.2+version:        0.2.3 synopsis:       An xhtml templating system license:        BSD3 license-file:   LICENSE@@ -95,7 +95,7 @@     directory,     directory-tree,     filepath,-    hexpat >= 0.16 && <0.17,+    hexpat >= 0.18.2 && <0.19,     MonadCatchIO-transformers >= 0.2.1 && < 0.3,     monads-fd,     process,
src/Text/Templating/Heist.hs view
@@ -22,8 +22,11 @@   @getUser :: MyAppMonad (Maybe ByteString)@ that gets the current user.   You can implement this functionality with a 'Splice' as follows: -  >-  > import Text.XML.Expat.Tree+  > import             Data.ByteString.Char8 (ByteString)+  > import qualified   Data.ByteString.Char8 as B+  > import qualified   Text.XML.Expat.Tree as X+  > +  > import             Text.Templating.Heist   >   > link :: ByteString -> ByteString -> Node   > link target text = X.Element "a" [("href", target)] [X.Text text]@@ -103,6 +106,7 @@   , callTemplate   , renderTemplate   , bindStrings+  , bindString      -- * Misc functions   , getDoc
src/Text/Templating/Heist/Constants.hs view
@@ -12,7 +12,7 @@ heistExpatOptions :: ParserOptions ByteString ByteString heistExpatOptions =     defaultParserOptions {-           parserEncoding = Just UTF8+           overrideEncoding = Just UTF8          , entityDecoder  = Just (\k -> Map.lookup k htmlEntityLookupTable)          } 
src/Text/Templating/Heist/Internal.hs view
@@ -192,10 +192,11 @@ -- | Adds a template to the template state. addTemplate :: Monad m =>                ByteString-            -> InternalTemplate+            -> Template             -> TemplateState m             -> TemplateState m-addTemplate n t st = insertTemplate (splitTemplatePath n) t st+addTemplate n t st = insertTemplate (splitTemplatePath n)+                                    (InternalTemplate Nothing t) st   ------------------------------------------------------------------------------@@ -391,14 +392,22 @@   --------------------------------------------------------------------------------- | Binds a list of constant string splices+-- | Binds a list of constant string splices. bindStrings :: Monad m             => [(ByteString, ByteString)]             -> TemplateState m             -> TemplateState m-bindStrings pairs ts = foldr add ts pairs-  where-    add (n,v) = bindSplice n (return [X.Text v])+bindStrings pairs ts = foldr (uncurry bindString) ts pairs+++------------------------------------------------------------------------------+-- | Binds a single constant string splice.+bindString :: Monad m+            => ByteString+            -> ByteString+            -> TemplateState m+            -> TemplateState m+bindString n v = bindSplice n $ return [X.Text v]   ------------------------------------------------------------------------------
src/Text/Templating/Heist/TemplateDirectory.hs view
@@ -18,7 +18,6 @@ import           Control.Concurrent import           Control.Monad import           Control.Monad.Trans-import           Data.ByteString.Char8 (ByteString) import           Text.Templating.Heist import           Text.Templating.Heist.Splices.Static 
test/heist-testsuite.cabal view
@@ -17,7 +17,7 @@      directory-tree,      process,      filepath,-     hexpat >= 0.11,+     hexpat >= 0.18.2 && <0.19,      HUnit >= 1.2 && < 2,      monads-fd,      random,
test/suite/Text/Templating/Heist/Tests.hs view
@@ -61,7 +61,7 @@ addTest = do   H.assertBool "lookup test" $ Just [] == (fmap (_itNodes . fst) $ lookupTemplate "aoeu" ts)   H.assertBool "splice touched" $ Map.size (_spliceMap ts) == 0-  where ts = addTemplate "aoeu" (InternalTemplate Nothing []) (mempty::TemplateState IO)+  where ts = addTemplate "aoeu" [] (mempty::TemplateState IO)  isLeft :: Either a b -> Bool isLeft (Left _) = True