packages feed

heist 0.3.0.0 → 0.4.0.0

raw patch · 4 files changed

+17/−17 lines, 4 filesdep ~hexpatPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hexpat

API changes (from Hackage documentation)

- Text.Templating.Heist: emptyTemplateState :: MonadIO m => TemplateState m
+ Text.Templating.Heist: emptyTemplateState :: MonadIO m => FilePath -> TemplateState m
- Text.Templating.Heist.Splices.Markdown: markdownSplice :: MonadIO m => Splice m
+ Text.Templating.Heist.Splices.Markdown: markdownSplice :: MonadIO m => FilePath -> Splice m
- Text.Templating.Heist.Splices.Markdown: pandoc :: FilePath -> FilePath -> IO ByteString
+ Text.Templating.Heist.Splices.Markdown: pandoc :: FilePath -> FilePath -> FilePath -> IO ByteString

Files

heist.cabal view
@@ -1,5 +1,5 @@ name:           heist-version:        0.3.0.0+version:        0.4.0.0 synopsis:       An xhtml templating system license:        BSD3 license-file:   LICENSE@@ -95,7 +95,7 @@     directory,     directory-tree,     filepath,-    hexpat >= 0.19 && <0.20,+    hexpat >= 0.19.5 && <0.20,     MonadCatchIO-transformers >= 0.2.1 && < 0.3,     mtl >= 2.0 && < 2.1,     process,
src/Text/Templating/Heist.hs view
@@ -125,12 +125,12 @@  ------------------------------------------------------------------------------ -- | The default set of built-in splices.-defaultSpliceMap :: MonadIO m => SpliceMap m-defaultSpliceMap = Map.fromList+defaultSpliceMap :: MonadIO m => FilePath -> SpliceMap m+defaultSpliceMap templatePath = Map.fromList     [(applyTag, applyImpl)     ,(bindTag, bindImpl)     ,(ignoreTag, ignoreImpl)-    ,(markdownTag, markdownSplice)+    ,(markdownTag, markdownSplice templatePath)     ]  @@ -138,9 +138,10 @@ -- | An empty template state, with Heist's default splices (@\<apply\>@, -- @\<bind\>@, @\<ignore\>@, and @\<markdown\>@) mapped.  The static tag is -- not mapped here because it must be mapped manually in your application.-emptyTemplateState :: MonadIO m => TemplateState m-emptyTemplateState = TemplateState defaultSpliceMap Map.empty True [] 0-                                   return return return []+emptyTemplateState :: MonadIO m => FilePath -> TemplateState m+emptyTemplateState templatePath =+    TemplateState (defaultSpliceMap templatePath) Map.empty+                  True [] 0 return return return []   -- $hookDoc
src/Text/Templating/Heist/Splices/Markdown.hs view
@@ -16,6 +16,7 @@ import           Prelude hiding (catch) import           System.Directory import           System.Exit+import           System.FilePath.Posix import           System.IO import           System.Process import           Text.XML.Expat.Tree hiding (Node)@@ -51,8 +52,8 @@  ------------------------------------------------------------------------------ -- | Implementation of the markdown splice.-markdownSplice :: MonadIO m => Splice m-markdownSplice = do+markdownSplice :: MonadIO m => FilePath -> Splice m+markdownSplice templatePath = do     pdMD <- liftIO $ findExecutable "pandoc"      when (isNothing pdMD) $ liftIO $ throwIO PandocMissingException@@ -60,7 +61,7 @@     tree <- getParamNode     markup <- liftIO $         case getAttribute tree "file" of-            Just f  -> pandoc (fromJust pdMD) $ BC.unpack f+            Just f  -> pandoc (fromJust pdMD) templatePath $ BC.unpack f             Nothing -> pandocBS (fromJust pdMD) $ textContent tree      let ee = parse' heistExpatOptions markup@@ -70,8 +71,8 @@       (Right n) -> return [n]  -pandoc :: FilePath -> FilePath -> IO ByteString-pandoc pandocPath inputFile = do+pandoc :: FilePath -> FilePath -> FilePath -> IO ByteString+pandoc pandocPath templatePath inputFile = do     (ex, sout, serr) <- readProcessWithExitCode' pandocPath args ""      when (isFail ex) $ throw $ MarkdownException serr@@ -83,8 +84,7 @@     isFail ExitSuccess = False     isFail _           = True -    -- FIXME: hardcoded path-    args = [ "-S", "--no-wrap", "templates/"++inputFile ]+    args = [ "-S", "--no-wrap", templatePath </> inputFile ]   pandocBS :: FilePath -> ByteString -> IO ByteString
src/Text/Templating/Heist/Types.hs view
@@ -27,7 +27,6 @@ import             Control.Monad.Error import             Control.Monad.Reader import             Control.Monad.State-import             Control.Monad.Trans import             Data.ByteString.Char8 (ByteString) import qualified   Data.Map as Map import             Data.Map (Map)@@ -361,7 +360,7 @@ -- scope" as opposed to the template call "local scope" of state items such -- as recursionDepth, curContext, and spliceMap. restoreTS :: Monad m => TemplateState m -> TemplateMonad m ()-restoreTS ts1 = +restoreTS ts1 =     modifyTS (\ts2 -> ts2         { _recursionDepth = _recursionDepth ts1         , _curContext = _curContext ts1