packages feed

heist 0.14.1.1 → 0.14.1.2

raw patch · 7 files changed

+74/−21 lines, 7 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Heist: dfDoc :: DocumentFile -> Document
- Heist: dfFile :: DocumentFile -> Maybe FilePath
- Heist.Internal.Types: _attrSpliceMap :: HeistState m -> HashMap Text (AttrSplice m)
- Heist.Internal.Types: _compiledSpliceMap :: HeistState m -> HashMap Text (HeistT m IO (DList (Chunk m)))
- Heist.Internal.Types: _compiledTemplateMap :: HeistState m -> !(HashMap TPath ([Chunk m], MIMEType))
- Heist.Internal.Types: _curContext :: HeistState m -> TPath
- Heist.Internal.Types: _curMarkup :: HeistState m -> Markup
- Heist.Internal.Types: _curTemplateFile :: HeistState m -> Maybe FilePath
- Heist.Internal.Types: _doctypes :: HeistState m -> [DocType]
- Heist.Internal.Types: _errorNotBound :: HeistState m -> Bool
- Heist.Internal.Types: _hcErrorNotBound :: HeistConfig m -> Bool
- Heist.Internal.Types: _hcNamespace :: HeistConfig m -> Text
- Heist.Internal.Types: _hcSpliceConfig :: HeistConfig m -> SpliceConfig m
- Heist.Internal.Types: _keygen :: HeistState m -> KeyGen
- Heist.Internal.Types: _preprocessingMode :: HeistState m -> Bool
- Heist.Internal.Types: _recurse :: HeistState m -> Bool
- Heist.Internal.Types: _recursionDepth :: HeistState m -> Int
- Heist.Internal.Types: _scAttributeSplices :: SpliceConfig m -> Splices (AttrSplice m)
- Heist.Internal.Types: _scCompiledSplices :: SpliceConfig m -> Splices (Splice m)
- Heist.Internal.Types: _scInterpretedSplices :: SpliceConfig m -> Splices (Splice m)
- Heist.Internal.Types: _scLoadTimeSplices :: SpliceConfig m -> Splices (Splice IO)
- Heist.Internal.Types: _scTemplateLocations :: SpliceConfig m -> [TemplateLocation]
- Heist.Internal.Types: _spliceErrors :: HeistState m -> [Text]
- Heist.Internal.Types: _spliceMap :: HeistState m -> HashMap Text (HeistT m m Template)
- Heist.Internal.Types: _splicePrefix :: HeistState m -> Text
- Heist.Internal.Types: _templateMap :: HeistState m -> HashMap TPath DocumentFile
- Heist.Internal.Types: dfDoc :: DocumentFile -> Document
- Heist.Internal.Types: dfFile :: DocumentFile -> Maybe FilePath
- Heist.Internal.Types: instance Monoid (SpliceConfig m)
- Heist.Internal.Types: runHeistT :: HeistT n m a -> Node -> HeistState n -> m (a, HeistState n)
- Heist.Internal.Types: unRT :: RuntimeSplice m a -> StateT HeterogeneousEnvironment m a
- Heist.Splices.Markdown: instance Exception MarkdownException
- Heist.Splices.Markdown: instance Exception NoMarkdownFileException
- Heist.Splices.Markdown: instance Exception PandocMissingException
- Heist.Splices.Markdown: instance Show MarkdownException
- Heist.Splices.Markdown: instance Show NoMarkdownFileException
- Heist.Splices.Markdown: instance Show PandocMissingException
- Heist.Splices.Markdown: instance Typeable MarkdownException
- Heist.Splices.Markdown: instance Typeable NoMarkdownFileException
- Heist.Splices.Markdown: instance Typeable PandocMissingException
+ Heist: [dfDoc] :: DocumentFile -> Document
+ Heist: [dfFile] :: DocumentFile -> Maybe FilePath
+ Heist.Internal.Types: [_attrSpliceMap] :: HeistState m -> HashMap Text (AttrSplice m)
+ Heist.Internal.Types: [_compiledSpliceMap] :: HeistState m -> HashMap Text (HeistT m IO (DList (Chunk m)))
+ Heist.Internal.Types: [_compiledTemplateMap] :: HeistState m -> !(HashMap TPath ([Chunk m], MIMEType))
+ Heist.Internal.Types: [_curContext] :: HeistState m -> TPath
+ Heist.Internal.Types: [_curMarkup] :: HeistState m -> Markup
+ Heist.Internal.Types: [_curTemplateFile] :: HeistState m -> Maybe FilePath
+ Heist.Internal.Types: [_doctypes] :: HeistState m -> [DocType]
+ Heist.Internal.Types: [_errorNotBound] :: HeistState m -> Bool
+ Heist.Internal.Types: [_hcErrorNotBound] :: HeistConfig m -> Bool
+ Heist.Internal.Types: [_hcNamespace] :: HeistConfig m -> Text
+ Heist.Internal.Types: [_hcSpliceConfig] :: HeistConfig m -> SpliceConfig m
+ Heist.Internal.Types: [_keygen] :: HeistState m -> KeyGen
+ Heist.Internal.Types: [_preprocessingMode] :: HeistState m -> Bool
+ Heist.Internal.Types: [_recurse] :: HeistState m -> Bool
+ Heist.Internal.Types: [_recursionDepth] :: HeistState m -> Int
+ Heist.Internal.Types: [_scAttributeSplices] :: SpliceConfig m -> Splices (AttrSplice m)
+ Heist.Internal.Types: [_scCompiledSplices] :: SpliceConfig m -> Splices (Splice m)
+ Heist.Internal.Types: [_scInterpretedSplices] :: SpliceConfig m -> Splices (Splice m)
+ Heist.Internal.Types: [_scLoadTimeSplices] :: SpliceConfig m -> Splices (Splice IO)
+ Heist.Internal.Types: [_scTemplateLocations] :: SpliceConfig m -> [TemplateLocation]
+ Heist.Internal.Types: [_spliceErrors] :: HeistState m -> [Text]
+ Heist.Internal.Types: [_spliceMap] :: HeistState m -> HashMap Text (HeistT m m Template)
+ Heist.Internal.Types: [_splicePrefix] :: HeistState m -> Text
+ Heist.Internal.Types: [_templateMap] :: HeistState m -> HashMap TPath DocumentFile
+ Heist.Internal.Types: [dfDoc] :: DocumentFile -> Document
+ Heist.Internal.Types: [dfFile] :: DocumentFile -> Maybe FilePath
+ Heist.Internal.Types: [runHeistT] :: HeistT n m a -> Node -> HeistState n -> m (a, HeistState n)
+ Heist.Internal.Types: [unRT] :: RuntimeSplice m a -> StateT HeterogeneousEnvironment m a
+ Heist.Internal.Types: instance GHC.Base.Monoid (Heist.Internal.Types.SpliceConfig m)
+ Heist.Splices.Markdown: instance GHC.Exception.Exception Heist.Splices.Markdown.MarkdownException
+ Heist.Splices.Markdown: instance GHC.Exception.Exception Heist.Splices.Markdown.NoMarkdownFileException
+ Heist.Splices.Markdown: instance GHC.Exception.Exception Heist.Splices.Markdown.PandocMissingException
+ Heist.Splices.Markdown: instance GHC.Show.Show Heist.Splices.Markdown.MarkdownException
+ Heist.Splices.Markdown: instance GHC.Show.Show Heist.Splices.Markdown.NoMarkdownFileException
+ Heist.Splices.Markdown: instance GHC.Show.Show Heist.Splices.Markdown.PandocMissingException
- Heist: evalHeistT :: Monad m => HeistT n m a -> Node -> HeistState n -> m a
+ Heist: evalHeistT :: (Monad m) => HeistT n m a -> Node -> HeistState n -> m a
- Heist.Compiled: bindLater :: Monad n => (a -> RuntimeSplice n Builder) -> RuntimeSplice n a -> Splice n
+ Heist.Compiled: bindLater :: (Monad n) => (a -> RuntimeSplice n Builder) -> RuntimeSplice n a -> Splice n
- Heist.Compiled.LowLevel: getPromise :: Monad n => Promise a -> RuntimeSplice n a
+ Heist.Compiled.LowLevel: getPromise :: (Monad n) => Promise a -> RuntimeSplice n a
- Heist.Compiled.LowLevel: putPromise :: Monad n => Promise a -> a -> RuntimeSplice n ()
+ Heist.Compiled.LowLevel: putPromise :: (Monad n) => Promise a -> a -> RuntimeSplice n ()
- Heist.Internal.Types: evalHeistT :: Monad m => HeistT n m a -> Node -> HeistState n -> m a
+ Heist.Internal.Types: evalHeistT :: (Monad m) => HeistT n m a -> Node -> HeistState n -> m a
- Heist.Interpreted: runChildrenWith :: Monad n => Splices (Splice n) -> Splice n
+ Heist.Interpreted: runChildrenWith :: (Monad n) => Splices (Splice n) -> Splice n
- Heist.Interpreted: runChildrenWithTemplates :: Monad n => Splices Template -> Splice n
+ Heist.Interpreted: runChildrenWithTemplates :: (Monad n) => Splices Template -> Splice n
- Heist.Interpreted: runChildrenWithText :: Monad n => Splices Text -> Splice n
+ Heist.Interpreted: runChildrenWithText :: (Monad n) => Splices Text -> Splice n
- Heist.Interpreted: runChildrenWithTrans :: Monad n => (b -> Splice n) -> Splices b -> Splice n
+ Heist.Interpreted: runChildrenWithTrans :: (Monad n) => (b -> Splice n) -> Splices b -> Splice n
- Heist.Splices.Apply: rawApply :: Monad n => Text -> [Node] -> Maybe FilePath -> TPath -> [Node] -> Splice n
+ Heist.Splices.Apply: rawApply :: (Monad n) => Text -> [Node] -> Maybe FilePath -> TPath -> [Node] -> Splice n
- Heist.Splices.Cache: cacheImpl :: MonadIO n => CacheTagState -> Splice n
+ Heist.Splices.Cache: cacheImpl :: (MonadIO n) => CacheTagState -> Splice n
- Heist.Splices.Cache: cacheImplCompiled :: MonadIO n => CacheTagState -> Splice n
+ Heist.Splices.Cache: cacheImplCompiled :: (MonadIO n) => CacheTagState -> Splice n
- Heist.TemplateDirectory: getDirectoryHS :: MonadIO n => TemplateDirectory n -> IO (HeistState n)
+ Heist.TemplateDirectory: getDirectoryHS :: (MonadIO n) => TemplateDirectory n -> IO (HeistState n)
- Heist.TemplateDirectory: reloadTemplateDirectory :: MonadIO n => TemplateDirectory n -> IO (Either String ())
+ Heist.TemplateDirectory: reloadTemplateDirectory :: (MonadIO n) => TemplateDirectory n -> IO (Either String ())

Files

heist.cabal view
@@ -1,5 +1,5 @@ name:           heist-version:        0.14.1.1+version:        0.14.1.2 synopsis:       An Haskell template system supporting both HTML5 and XML. description:     Heist is a powerful template system that supports both HTML5 and XML.@@ -140,7 +140,7 @@    build-depends:     MonadCatchIO-transformers  >= 0.2.1   && < 0.4,-    aeson                      >= 0.6     && < 0.9,+    aeson                      >= 0.6     && < 0.12,     attoparsec                 >= 0.10    && < 0.14,     base                       >= 4.5     && < 5,     blaze-builder              >= 0.2     && < 0.5,@@ -161,7 +161,7 @@     time                       >= 1.1     && < 1.6,     transformers               >= 0.3     && < 0.5,     unordered-containers       >= 0.1.4   && < 0.3,-    vector                     >= 0.9     && < 0.11,+    vector                     >= 0.9     && < 0.12,     xmlhtml                    >= 0.2.3   && < 0.3    if impl(ghc >= 6.12.0)
src/Heist/Common.hs view
@@ -47,6 +47,15 @@ runMapNoErrors = either (const mempty) id .     runMapSyntax' (\_ new _ -> Just new) Map.lookup Map.insert +applySpliceMap :: HeistState n+                -> (HeistState n -> HashMap Text v)+                -> MapSyntaxM Text v a+                -> HashMap Text v+applySpliceMap hs f =  (flip Map.union (f hs)) .+    runMapNoErrors .+    mapK (mappend pre)+  where+    pre = _splicePrefix hs  ------------------------------------------------------------------------------ -- | If Heist is running in fail fast mode, then this function will throw an@@ -338,9 +347,7 @@                      -> HeistState n           -- ^ start state                      -> HeistState n bindAttributeSplices ss hs =-    hs { _attrSpliceMap = Map.union (runMapNoErrors ss)-                                    (_attrSpliceMap hs) }-+    hs { _attrSpliceMap = applySpliceMap hs _attrSpliceMap ss }  ------------------------------------------------------------------------------ -- | Mappends a doctype to the state.
src/Heist/Compiled/Internal.hs view
@@ -526,8 +526,9 @@            -> HeistState n     -- ^ source state            -> HeistState n bindSplice n v ts =-    ts { _compiledSpliceMap = H.insert n v (_compiledSpliceMap ts) }-+    ts { _compiledSpliceMap = H.insert n' v (_compiledSpliceMap ts) }+  where+    n' = _splicePrefix ts `mappend` n  ------------------------------------------------------------------------------ -- | Binds a list of compiled splices.  This function should not be exported.@@ -535,8 +536,7 @@             -> HeistState n        -- ^ source state             -> HeistState n bindSplices ss hs =-    hs { _compiledSpliceMap = H.union (runMapNoErrors ss)-                                      (_compiledSpliceMap hs) }+    hs { _compiledSpliceMap = applySpliceMap hs _compiledSpliceMap ss }   ------------------------------------------------------------------------------
src/Heist/Internal/Types/HeistState.hs view
@@ -500,12 +500,14 @@  ------------------------------------------------------------------------------ -- | Restores the HeistState.  This function is almost like putHS except it--- preserves the current doctypes.  You should use this function instead of--- @putHS@ to restore an old state.  This was needed because doctypes needs to--- be in a "global scope" as opposed to the template call "local scope" of--- state items such as recursionDepth, curContext, and spliceMap.+-- preserves the current doctypes and splice errors.  You should use this+-- function instead of @putHS@ to restore an old state.  This was needed+-- because doctypes needs to be in a "global scope" as opposed to the template+-- call "local scope" of state items such as recursionDepth, curContext, and+-- spliceMap. restoreHS :: Monad m => HeistState n -> HeistT n m ()-restoreHS old = modifyHS (\cur -> old { _doctypes = _doctypes cur })+restoreHS old = modifyHS (\cur -> old { _doctypes = _doctypes cur+                                      , _spliceErrors = _spliceErrors cur }) {-# INLINE restoreHS #-}  
src/Heist/Interpreted/Internal.hs view
@@ -47,7 +47,7 @@             -> HeistState n       -- ^ start state             -> HeistState n bindSplices ss hs =-    hs { _spliceMap = Map.union (runMapNoErrors ss) (_spliceMap hs) }+    hs { _spliceMap = applySpliceMap hs _spliceMap ss }   ------------------------------------------------------------------------------
test/heist-testsuite.cabal view
@@ -14,7 +14,7 @@     test-framework             >= 0.4      && < 0.9,     test-framework-hunit       >= 0.2.7    && < 0.4,     test-framework-quickcheck2 >= 0.2.12.1 && < 0.4,-    aeson                      >= 0.6      && < 0.9,+    aeson                      >= 0.6      && < 0.12,     attoparsec                 >= 0.10     && < 0.14,     base                       >= 4.5      && < 5,     blaze-builder              >= 0.2      && < 0.5,@@ -28,7 +28,7 @@     errors                     >= 1.4      && < 1.5,     filepath                   >= 1.3      && < 1.5,     hashable                   >= 1.1      && < 1.3,-    lens                       >= 4.3      && < 4.12,+    lens                       >= 4.3      && < 4.14,     mtl                        >= 2.0      && < 2.3,     process                    >= 1.1      && < 1.3,     random                     >= 1.0.1.0  && < 1.2,@@ -36,7 +36,7 @@     time                       >= 1.1      && < 1.6,     transformers               >= 0.2      && < 0.5,     unordered-containers       >= 0.1.4    && < 0.3,-    vector                     >= 0.9      && < 0.11,+    vector                     >= 0.9      && < 0.12,     xmlhtml                    >= 0.2.3    && < 0.3  @@ -56,7 +56,7 @@      -- Copied from regular dependencies: -    aeson                      >= 0.6     && < 0.9,+    aeson                      >= 0.6     && < 0.12,     attoparsec                 >= 0.10    && < 0.14,     base                       >= 4.5     && < 5,     blaze-builder              >= 0.2     && < 0.5,@@ -79,7 +79,7 @@     time                       >= 1.1     && < 1.6,     transformers               >= 0.2     && < 0.5,     unordered-containers       >= 0.1.4   && < 0.3,-    vector                     >= 0.9     && < 0.11,+    vector                     >= 0.9     && < 0.12,     xmlhtml                    >= 0.2.3   && < 0.3    ghc-options: -O2 -Wall -fwarn-tabs -funbox-strict-fields -threaded
test/suite/Heist/Compiled/Tests.hs view
@@ -35,6 +35,8 @@         , testCase     "compiled/namespace3"    namespaceTest3         , testCase     "compiled/namespace4"    namespaceTest4         , testCase     "compiled/namespace5"    namespaceTest5+        , testCase     "compiled/nsbind"        nsBindTest+        , testCase     "compiled/nsbinderr"     nsBindErrorTest         ]  simpleCompiledTest :: IO ()@@ -131,3 +133,45 @@     H.assertEqual "namespace test" (Left ["templates/namespaces.tpl: No splice bound for h:foo"]) res  +nsBindTemplateHC :: HeistConfig IO+nsBindTemplateHC = HeistConfig sc "h" False+  where+    sc = mempty & scLoadTimeSplices .~ defaultLoadTimeSplices+                & scCompiledSplices .~ nsBindTestSplices+                & scTemplateLocations .~ [loadTemplates "templates-nsbind"]++nsBindTestSplices :: Splices (Splice IO)+nsBindTestSplices = "main" ## do+    tpl <- withSplices runChildren nsBindSubSplices (return ())+    return $ yieldRuntime $ codeGen tpl++nsBindSubSplices :: Splices (RuntimeSplice IO () -> Splice IO)+nsBindSubSplices = mapV (pureSplice . textSplice) $+    "sub" ## const "asdf"+++nsBindTest :: IO ()+nsBindTest = do+    res <- runEitherT $ do+        hs <- initHeist $ nsBindTemplateHC+        runner <- noteT ["Error rendering"] $ hoistMaybe $+                    renderTemplate hs "nsbind"+        b <- lift $ fst runner+        return $ toByteString b++    H.assertEqual "namespace bind test" (Right expected)  res+  where+    expected = "Alpha\n&#10;Beta\nasdf&#10;Gamma\n<sub></sub>&#10;&#10;"+++nsBindErrorTest :: IO ()+nsBindErrorTest = do+    res <- runEitherT $ do+        hs <- initHeist $ nsBindTemplateHC+                           & hcErrorNotBound .~ True+        runner <- noteT ["Error rendering"] $ hoistMaybe $+                    renderTemplate hs "nsbinderror"+        b <- lift $ fst runner+        return $ toByteString b++    H.assertEqual "namespace bind error test" (Left ["templates-nsbind/nsbinderror.tpl: No splice bound for h:invalid"])  res