shakespeare 1.0.1.4 → 1.0.2
raw patch · 3 files changed
+19/−8 lines, 3 filesdep −shakespearedep ~process
Dependencies removed: shakespeare
Dependency ranges changed: process
Files
- Text/Shakespeare.hs +9/−1
- Text/Shakespeare/Base.hs +2/−2
- shakespeare.cabal +8/−5
Text/Shakespeare.hs view
@@ -16,7 +16,10 @@ , shakespeareFileReload -- * low-level , shakespeareFromString+ , shakespeareUsedIdentifiers , RenderUrl+ , VarType+ , Deref #ifdef TEST_EXPORT , preFilter@@ -287,11 +290,16 @@ | EUrlParam (url, [(TS.Text, TS.Text)]) | EMixin (Shakespeare url) +-- | Determine which identifiers are used by the given template, useful for+-- creating systems like yesod devel.+shakespeareUsedIdentifiers :: ShakespeareSettings -> String -> [(Deref, VarType)]+shakespeareUsedIdentifiers settings = concatMap getVars . contentFromString settings+ shakespeareFileReload :: ShakespeareSettings -> FilePath -> Q Exp shakespeareFileReload rs fp = do str <- readFileQ fp s <- qRunIO $ preFilter rs str- let b = concatMap getVars $ contentFromString rs s+ let b = shakespeareUsedIdentifiers rs s c <- mapM vtToExp b rt <- [|shakespeareRuntime|] wrap' <- [|\x -> $(return $ wrap rs) . x|]
Text/Shakespeare/Base.hs view
@@ -37,7 +37,7 @@ import Control.Monad (when) newtype Ident = Ident String- deriving (Show, Eq, Read, Data, Typeable)+ deriving (Show, Eq, Read, Data, Typeable, Ord) type Scope = [(Ident, Exp)] @@ -49,7 +49,7 @@ | DerefBranch Deref Deref | DerefList [Deref] | DerefTuple [Deref]- deriving (Show, Eq, Read, Data, Typeable)+ deriving (Show, Eq, Read, Data, Typeable, Ord) instance Lift Ident where lift (Ident s) = [|Ident|] `appE` lift s
shakespeare.cabal view
@@ -1,5 +1,5 @@ name: shakespeare-version: 1.0.1.4+version: 1.0.2 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -41,18 +41,21 @@ default: False test-suite test- hs-source-dirs: test- main-is: ../test.hs+ hs-source-dirs: ., test+ main-is: test.hs other-modules: ShakespeareBaseTest + cpp-options: -DTEST_EXPORT+ type: exitcode-stdio-1.0 ghc-options: -Wall- build-depends: shakespeare- , base >= 4 && < 5+ build-depends: base >= 4 && < 5 , parsec >= 2 && < 4 , hspec >= 1.3 , text >= 0.7 && < 0.12+ , process+ , template-haskell source-repository head