packages feed

hamlet 0.0.0 → 0.0.1

raw patch · 7 files changed

+41/−6 lines, 7 filessetup-changedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Hamlet: xhamlet :: QuasiQuoter
+ Text.Hamlet.Quasi: xhamlet :: QuasiQuoter

Files

− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
+ Setup.lhs view
@@ -0,0 +1,11 @@+#!/usr/bin/env runhaskell++> module Main where+> import Distribution.Simple+> import System.Cmd (system)++> main :: IO ()+> main = defaultMainWithHooks (simpleUserHooks { runTests = runTests' })++> runTests' :: a -> b -> c -> d -> IO ()+> runTests' _ _ _ _ = system "runhaskell -DTEST runtests.hs" >> return ()
Text/Hamlet.hs view
@@ -1,5 +1,6 @@ module Text.Hamlet     ( hamlet+    , xhamlet     , hamletWithSettings     , HamletSettings (..)     , defaultHamletSettings
Text/Hamlet/Parse.hs view
@@ -135,7 +135,7 @@                                     _ -> error $ "Invalid delim in parseContent: " ++ [delim]                         rest' <- parseContent rest                         return $ x deref' : rest'-                    _ -> error "Invalid branch in parseContent"+                    (_, "") -> error $ "Missing ending delimiter in " ++ s             case a of                 "" -> return b                 _ -> return $ ContentRaw a : b@@ -334,14 +334,15 @@ closeTag :: HamletSettings -> String -> CloseStyle closeTag h s =     if canBeEmpty s-        then (if hamletCloseEmpties h then CloseInside else NoClose)-        else CloseSeparate+        then CloseSeparate+        else (if hamletCloseEmpties h then CloseInside else NoClose)   where     canBeEmpty "img" = False     canBeEmpty "link" = False     canBeEmpty "meta" = False     canBeEmpty "br" = False     canBeEmpty "hr" = False+    canBeEmpty "input" = False     canBeEmpty _ = True  parseConds :: HamletSettings
Text/Hamlet/Quasi.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE TemplateHaskell #-} module Text.Hamlet.Quasi     ( hamlet+    , xhamlet     , hamletWithSettings     ) where @@ -103,6 +104,13 @@ -- | Calls 'hamletWithSettings' with 'defaultHamletSettings'. hamlet :: QuasiQuoter hamlet = hamletWithSettings defaultHamletSettings++-- | Calls 'hamletWithSettings' using XHTML 1.0 Strict settings.+xhamlet :: QuasiQuoter+xhamlet = hamletWithSettings $ HamletSettings doctype True where+    doctype =+      "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " +++      "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"  -- | A quasi-quoter that converts Hamlet syntax into a function of form: --
hamlet.cabal view
@@ -1,5 +1,5 @@ name:            hamlet-version:         0.0.0+version:         0.0.1 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>
runtests.hs view
@@ -42,6 +42,9 @@     , testCase "enum" caseEnum     , testCase "list chain" caseListChain     , testCase "enum chain" caseEnumChain+    , testCase "script not empty" caseScriptNotEmpty+    , testCase "meta empty" caseMetaEmpty+    , testCase "input empty" caseInputEmpty     ]  data Url = Home@@ -221,3 +224,16 @@ $forall getArg.*getArgM.getArg.getArg.*getArgM.*enum x     @x.*murl@ |]++caseScriptNotEmpty :: Assertion+caseScriptNotEmpty = helper "<script></script>" [$hamlet|%script|]++caseMetaEmpty :: Assertion+caseMetaEmpty = do+    helper "<meta>" [$hamlet|%meta|]+    helper "<meta/>" [$xhamlet|%meta|]++caseInputEmpty :: Assertion+caseInputEmpty = do+    helper "<input>" [$hamlet|%input|]+    helper "<input/>" [$xhamlet|%input|]