hamlet 1.0.0 → 1.0.1
raw patch · 3 files changed
+18/−8 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.Hamlet: HamletSettings :: String -> Bool -> (String -> CloseStyle) -> HamletSettings
+ Text.Hamlet: hamletCloseStyle :: HamletSettings -> String -> CloseStyle
+ Text.Hamlet: hamletDoctype :: HamletSettings -> String
+ Text.Hamlet: hamletNewlines :: HamletSettings -> Bool
+ Text.Hamlet: hamletRules :: Q HamletRules
+ Text.Hamlet: htmlRules :: Q HamletRules
Files
- Text/Hamlet.hs +8/−1
- Text/Hamlet/Parse.hs +8/−5
- hamlet.cabal +2/−2
Text/Hamlet.hs view
@@ -27,13 +27,15 @@ -- * Type classes , ToAttributes (..) -- * Internal, for making more- , HamletSettings+ , HamletSettings (..) , hamletWithSettings , hamletFileWithSettings , defaultHamletSettings , xhtmlHamletSettings , Env (..) , HamletRules (..)+ , hamletRules+ , htmlRules ) where import Text.Shakespeare.Base@@ -211,6 +213,11 @@ hamlet :: QuasiQuoter hamlet = hamletWithSettings hamletRules defaultHamletSettings +-- | A variant which adds newlines to the output. Useful for debugging+-- but may alter browser page layout.+hamlet' :: QuasiQuoter+hamlet' = hamletWithSettings hamletRules defaultHamletSettings{hamletNewlines=True}+ xhamlet :: QuasiQuoter xhamlet = hamletWithSettings hamletRules xhtmlHamletSettings
Text/Hamlet/Parse.hs view
@@ -367,13 +367,14 @@ start = DocContent $ ContentRaw $ "<" ++ tn attrs'' = concatMap attrToContent attrs' newline' = DocContent $ ContentRaw- $ if hamletCloseNewline set then "\n" else ""+ $ if hamletNewlines set then "\n" else "" inside' <- nestToDoc set inside rest' <- nestToDoc set rest Ok $ start : attrs'' ++ map (DocContent . ContentAttrs) attrsD ++ seal+ : newline' : map DocContent content ++ inside' ++ end@@ -382,7 +383,9 @@ nestToDoc set (Nest (LineContent content) inside:rest) = do inside' <- nestToDoc set inside rest' <- nestToDoc set rest- Ok $ map DocContent content ++ inside' ++ rest'+ let newline' = DocContent $ ContentRaw+ $ if hamletNewlines set then "\n" else ""+ Ok $ map DocContent content ++ newline':inside' ++ rest' nestToDoc _set (Nest (LineElseIf _) _:_) = Error "Unexpected elseif" nestToDoc _set (Nest LineElse _:_) = Error "Unexpected else" nestToDoc _set (Nest LineNothing _:_) = Error "Unexpected nothing"@@ -454,9 +457,9 @@ -- | The value to replace a \"!!!\" with. Do not include the trailing -- newline. hamletDoctype :: String- -- | Should we put a newline after closing a tag? Mostly useful for debug- -- output.- , hamletCloseNewline :: Bool+ -- | Should we add newlines to the output, making it more human-readable?+ -- Useful for client-side debugging but may alter browser page layout.+ , hamletNewlines :: Bool -- | How a tag should be closed. Use this to switch between HTML, XHTML -- or even XML output. , hamletCloseStyle :: String -> CloseStyle
hamlet.cabal view
@@ -1,6 +1,6 @@ name: hamlet-version: 1.0.0-license: BSD3+version: 1.0.1+license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com> maintainer: Michael Snoyman <michael@snoyman.com>