packages feed

shakespeare 1.2.0.4 → 1.2.1

raw patch · 2 files changed

+22/−16 lines, 2 filesdep ~base

Dependency ranges changed: base

Files

Text/Shakespeare.hs view
@@ -3,6 +3,8 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE CPP #-} {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} -- | For lack of a better name... a parameterized version of Julius.@@ -19,14 +21,15 @@     , shakespeareFromString     , shakespeareUsedIdentifiers     , RenderUrl-    , VarType+    , VarType (..)     , Deref     , Parser  #ifdef TEST_EXPORT     , preFilter #endif-      -- Internal+      -- * Internal+      -- can we remove this?     , shakespeareRuntime     , pack'     ) where@@ -53,6 +56,9 @@ import Data.Time (UTCTime) import Data.IORef import qualified Data.Map as M+import GHC.Generics (Generic)+import Data.Typeable (Typeable)+import Data.Data (Data)  -- for pre conversion import System.Process (readProcessWithExitCode)@@ -283,7 +289,7 @@       <> removeTrailingSemiColon       <> (if wrapInsertionAddParens then ")" else "")       <> "("-      <> (mconcat $ intersperse ", " vars)+      <> mconcat (intersperse ", " vars)       <> ");\n"         where            removeTrailingSemiColon = reverse $@@ -293,7 +299,7 @@     addVars Nothing _ str = str     addVars (Just WrapInsertion {..}) vars str =          wrapInsertionStartBegin-      <> (mconcat $ intersperse wrapInsertionSeparator $ map shakespeare_var_conversion vars)+      <> mconcat (intersperse wrapInsertionSeparator $ map shakespeare_var_conversion vars)       <> wrapInsertionStartClose       <> addIndent wrapInsertionIndent str       <> wrapInsertionEnd@@ -322,7 +328,7 @@             parseChar' preEscapeIgnoreLine preEscapeIgnoreBalanced          recordRight (Left str)  = return str-        recordRight (Right str) = modifyState (\vars -> str:vars) >> (return $ varConvert str)+        recordRight (Right str) = modifyState (\vars -> str:vars) >> return (varConvert str)          newLine = "\r\n"         parseCommentLine cs = do@@ -355,17 +361,17 @@         _   -> do               mc <- [|mconcat|]               return $ mc `AppE` ListE c-    fmap (maybe id AppE $ modifyFinalValue rs) $+    fmap (maybe id AppE $ modifyFinalValue rs) $ return $         if justVarInterpolation rs-            then return compiledTemplate-            else return $ LamE [VarP r] compiledTemplate+            then compiledTemplate+            else LamE [VarP r] compiledTemplate       where         contentToBuilder :: Name -> Content -> Q Exp         contentToBuilder _ (ContentRaw s') = do             ts <- [|fromText . pack'|]             return $ wrap rs `AppE` (ts `AppE` LitE (StringL s'))         contentToBuilder _ (ContentVar d) =-            return $ (toBuilder rs `AppE` derefToExp [] d)+            return (toBuilder rs `AppE` derefToExp [] d)         contentToBuilder r (ContentUrl d) = do             ts <- [|fromText|]             return $ wrap rs `AppE` (ts `AppE` (VarE r `AppE` derefToExp [] d `AppE` ListE []))@@ -389,13 +395,14 @@     contentsToShakespeare r $ contentFromString r s  shakespeareFile :: ShakespeareSettings -> FilePath -> Q Exp-shakespeareFile r fp = do+shakespeareFile r fp = #ifdef GHC_7_4-    qAddDependentFile fp+    qAddDependentFile fp >> #endif-    readFileQ fp >>= shakespeareFromString r+        readFileQ fp >>= shakespeareFromString r  data VarType = VTPlain | VTUrl | VTUrlParam | VTMixin+    deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)  getVars :: Content -> [(Deref, VarType)] getVars ContentRaw{} = []@@ -406,7 +413,7 @@  data VarExp url = EPlain Builder                 | EUrl url-                | EUrlParam (url, [(TS.Text, TS.Text)])+                | EUrlParam (url, QueryParameters)                 | EMixin (Shakespeare url)  -- | Determine which identifiers are used by the given template, useful for@@ -454,7 +461,6 @@   - shakespeareRuntime :: ShakespeareSettings -> FilePath -> [(Deref, VarExp url)] -> Shakespeare url shakespeareRuntime settings fp cd render' = unsafePerformIO $ do     mtime <- qRunIO $ getModified $ decodeString fp@@ -468,7 +474,7 @@     newContent mtime = do         str <- readFileUtf8 fp         s <- preFilter (Just fp) settings str-        insertReloadMap fp $ (mtime, contentFromString settings s)+        insertReloadMap fp (mtime, contentFromString settings s)      go' = mconcat . map go 
shakespeare.cabal view
@@ -1,5 +1,5 @@ name:            shakespeare-version:         1.2.0.4+version:         1.2.1 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>