xml-hamlet 0.4.0.8 → 0.4.0.9
raw patch · 2 files changed
+6/−4 lines, 2 files
Files
- Text/Hamlet/XML.hs +5/−3
- xml-hamlet.cabal +1/−1
Text/Hamlet/XML.hs view
@@ -10,7 +10,7 @@ import qualified Data.Text.Lazy as TL import Control.Monad ((<=<)) import Text.Hamlet.XMLParse-import Text.Shakespeare.Base (readUtf8File, derefToExp, Scope, Deref (DerefIdent), Ident (Ident))+import Text.Shakespeare.Base (readUtf8File, derefToExp, Scope, Deref, Ident (Ident)) import Data.Text (pack, unpack) import qualified Data.Text as T import qualified Text.XML as X@@ -18,6 +18,7 @@ import qualified Data.Foldable as F import Data.Maybe (fromMaybe) import qualified Data.Map as Map+import Control.Arrow (first) xml :: QuasiQuoter xml = QuasiQuoter { quoteExp = strToExp }@@ -69,12 +70,13 @@ [| maybe $(return nothing') $(return inside'') $(return deref') |] docToExp scope (DocCond conds final) = do unit <- [| () |]- body <- fmap GuardedB $ mapM go $ conds ++ [(DerefIdent $ Ident "otherwise", fromMaybe [] final)]+ otherwise' <- [|otherwise|]+ body <- fmap GuardedB $ mapM go $ map (first (derefToExp scope)) conds ++ [(otherwise', fromMaybe [] final)] return $ CaseE unit [Match (TupP []) body []] where go (deref, inside) = do inside' <- docsToExp scope inside- return (NormalG $ derefToExp scope deref, inside')+ return (NormalG deref, inside') mkAttrs :: Scope -> [(Maybe Deref, String, [Content])] -> Q Exp mkAttrs _ [] = [| Map.empty |]
xml-hamlet.cabal view
@@ -1,5 +1,5 @@ Name: xml-hamlet-Version: 0.4.0.8+Version: 0.4.0.9 Synopsis: Hamlet-style quasiquoter for XML content Homepage: http://www.yesodweb.com/ License: BSD3