This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "heist".
The branch, master has been updated
via 8c4a863a9b5f77c0afd8ebaae1bfb9e023751697 (commit)
from 632bef64e878148fdd06bc0eccd47836edd5a2ba (commit)
Summary of changes:
heist.cabal | 2 +-
src/Text/Templating/Heist.hs | 13 +++++++------
src/Text/Templating/Heist/Splices/Markdown.hs | 14 +++++++-------
3 files changed, 15 insertions(+), 14 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8c4a863a9b5f77c0afd8ebaae1bfb9e023751697
Author: Mighty Byte <[email protected]>
Date: Sun Dec 12 09:23:40 2010 -0500
Fixed use of hardcoded path in markdown splice. emptyTemplateState now has
to
have the path to the template directory passed as an argument.
diff --git a/heist.cabal b/heist.cabal
index de59442..203f875 100644
--- a/heist.cabal
+++ b/heist.cabal
@@ -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
diff --git a/src/Text/Templating/Heist.hs b/src/Text/Templating/Heist.hs
index 8214587..8cf383d 100644
--- a/src/Text/Templating/Heist.hs
+++ b/src/Text/Templating/Heist.hs
@@ -125,12 +125,12 @@ import Text.Templating.Heist.Types
------------------------------------------------------------------------------
-- | 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 @@ defaultSpliceMap = Map.fromList
-- | 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
diff --git a/src/Text/Templating/Heist/Splices/Markdown.hs
b/src/Text/Templating/Heist/Splices/Markdown.hs
index f612e6c..8878a34 100644
--- a/src/Text/Templating/Heist/Splices/Markdown.hs
+++ b/src/Text/Templating/Heist/Splices/Markdown.hs
@@ -16,6 +16,7 @@ import Data.Typeable
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 @@ markdownTag = "markdown"
------------------------------------------------------------------------------
-- | 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 @@ markdownSplice = do
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 @@ markdownSplice = do
(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 @@ pandoc pandocPath inputFile = do
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
-----------------------------------------------------------------------
hooks/post-receive
--
heist
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap