packages feed

hamlet 0.8.1 → 0.8.2

raw patch · 4 files changed

+21/−9 lines, 4 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Text.Hamlet.NonPoly: hrEmbed :: HamletRules -> Env -> Exp -> Q Exp
+ Text.Shakespeare: DerefBranch :: Deref -> Deref -> Deref
+ Text.Shakespeare: DerefIdent :: Ident -> Deref
+ Text.Shakespeare: DerefIntegral :: Integer -> Deref
+ Text.Shakespeare: DerefModulesIdent :: [String] -> Ident -> Deref
+ Text.Shakespeare: DerefRational :: Rational -> Deref
+ Text.Shakespeare: DerefString :: String -> Deref
+ Text.Shakespeare: Ident :: String -> Ident
+ Text.Shakespeare: data Deref
+ Text.Shakespeare: derefToExp :: Scope -> Deref -> Exp
+ Text.Shakespeare: flattenDeref :: Deref -> Maybe [String]
+ Text.Shakespeare: instance Data Deref
+ Text.Shakespeare: instance Data Ident
+ Text.Shakespeare: instance Eq Deref
+ Text.Shakespeare: instance Eq Ident
+ Text.Shakespeare: instance Lift Deref
+ Text.Shakespeare: instance Lift Ident
+ Text.Shakespeare: instance Read Deref
+ Text.Shakespeare: instance Read Ident
+ Text.Shakespeare: instance Show Deref
+ Text.Shakespeare: instance Show Ident
+ Text.Shakespeare: instance Typeable Deref
+ Text.Shakespeare: instance Typeable Ident
+ Text.Shakespeare: newtype Ident
+ Text.Shakespeare: parseAt :: Parser (Either String (Deref, Bool))
+ Text.Shakespeare: parseCaret :: Parser (Either String Deref)
+ Text.Shakespeare: parseDeref :: Parser Deref
+ Text.Shakespeare: parseHash :: Parser (Either String Deref)
+ Text.Shakespeare: parseInt :: Char -> Parser (Either String Deref)
+ Text.Shakespeare: parseUnder :: Parser (Either String Deref)
+ Text.Shakespeare: parseUrl :: Char -> Char -> Parser (Either String (Deref, Bool))
+ Text.Shakespeare: parseVar :: Char -> Parser (Either String Deref)
+ Text.Shakespeare: type Scope = [(Ident, Exp)]
- Text.Hamlet.NonPoly: HamletRules :: Exp -> ((Env -> Q Exp) -> Q Exp) -> HamletRules
+ Text.Hamlet.NonPoly: HamletRules :: Exp -> ((Env -> Q Exp) -> Q Exp) -> (Env -> Exp -> Q Exp) -> HamletRules

Files

Text/Hamlet/NonPoly.hs view
@@ -136,7 +136,7 @@             let d' = derefToExp scope d             pet <- [|preEscapedText|]             return $ hrFromHtml hr `AppE` (pet `AppE` (ou `AppE` d'))-contentToExp _ hr scope (ContentEmbed d) = return $ derefToExp scope d+contentToExp env hr scope (ContentEmbed d) = hrEmbed hr env $ derefToExp scope d contentToExp env hr scope (ContentMsg d) =     case msgRender env of         Nothing -> error "Message interpolation used, but no message renderer provided"@@ -149,7 +149,7 @@ htmlRules :: Q HamletRules htmlRules = do     i <- [|id|]-    return $ HamletRules i ($ (Env Nothing Nothing))+    return $ HamletRules i ($ (Env Nothing Nothing)) (\_ b -> return b)  hamlet :: QuasiQuoter hamlet = hamletWithSettings hamletRules defaultHamletSettings@@ -165,7 +165,9 @@                     }             h <- f env             return $ LamE [VarP r] h-    return $ HamletRules i ur+    let em (Env (Just urender) Nothing) e =+            urender $ \ur -> return (e `AppE` ur)+    return $ HamletRules i ur em  ihamlet :: QuasiQuoter ihamlet = hamletWithSettings ihamletRules defaultHamletSettings@@ -182,7 +184,9 @@                     }             h <- f env             return $ LamE [VarP m, VarP u] h-    return $ HamletRules i ur+    let em (Env (Just urender) (Just mrender)) e =+            urender $ \ur -> mrender $ \mr -> return (e `AppE` mr `AppE` ur)+    return $ HamletRules i ur em  hamletWithSettings :: Q HamletRules -> HamletSettings -> QuasiQuoter hamletWithSettings hr set =@@ -193,6 +197,7 @@ data HamletRules = HamletRules     { hrFromHtml :: Exp     , hrWithEnv :: (Env -> Q Exp) -> Q Exp+    , hrEmbed :: Env -> Exp -> Q Exp     }  data Env = Env
Text/Hamlet/Parse.hs view
@@ -103,9 +103,16 @@         return $ LineContent []     htmlComment = do         _ <- try $ string "<!--"-        _ <- many $ noneOf "\r\n"+        _ <- manyTill anyChar $ try $ string "-->"+        x <- many nonComments         eol-        return $ LineContent []+        return $ LineContent [ContentRaw $ concat x] -- FIXME handle variables?+    nonComments = (many1 $ noneOf "\r\n<") <|> (do+        _ <- char '<'+        (do+            try $ string "!--"+            _ <- manyTill anyChar $ try $ string "-->"+            return "") <|> return "<")     backslash = do         _ <- char '\\'         (eol >> return (LineContent [ContentRaw "\n"]))
Text/Shakespeare.hs view
@@ -4,7 +4,7 @@ {-# LANGUAGE CPP #-} -- | General parsers, functions and datatypes for all three languages. module Text.Shakespeare-    ( Deref+    ( Deref (..)     , Ident (..)     , Scope     , parseDeref
hamlet.cabal view
@@ -1,5 +1,5 @@ name:            hamlet-version:         0.8.1+version:         0.8.2 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -46,11 +46,11 @@                      Text.Julius                      Text.Coffee                      Text.Romeo+                     Text.Shakespeare     other-modules:   Text.Hamlet.Parse                      Text.Hamlet.Quasi                      Text.Hamlet.Debug                      Text.MkSizeType-                     Text.Shakespeare                      Text.Css     ghc-options:     -Wall