packages feed

hamlet 0.2.3 → 0.2.3.1

raw patch · 3 files changed

+20/−13 lines, 3 filesdep −web-encodingsPVP ok

version bump matches the API change (PVP)

Dependencies removed: web-encodings

API changes (from Hackage documentation)

Files

Text/Hamlet/Monad.hs view
@@ -28,11 +28,11 @@     ) where  import Data.Text (Text, pack)+import qualified Data.Text as S import qualified Data.Text.Lazy as L import qualified Data.Text.IO as T import Control.Applicative import Control.Monad-import Web.Encodings import Data.Monoid import Data.List @@ -109,12 +109,8 @@     deriving (Eq, Show, Read) instance Monoid HtmlContent where     mempty = Encoded mempty-    mappend (Encoded x)   (Encoded y)   = Encoded   $ mappend x y-    mappend (Unencoded x) (Unencoded y) = Unencoded $ mappend x y-    mappend (Encoded x)   (Unencoded y) = Encoded   $ mappend x-                                                    $ encodeHtml y-    mappend (Unencoded x) (Encoded y)   = Encoded   $ mappend-                                                      (encodeHtml x) y+    mappend x y = Encoded $ mappend (htmlContentToText x)+                                    (htmlContentToText y)  -- | Wrap some 'HtmlContent' for embedding in an XML file. cdata :: HtmlContent -> HtmlContent@@ -126,8 +122,7 @@  -- | Outputs the given 'HtmlContent', entity encoding any 'Unencoded' data. outputHtml :: Monad m => HtmlContent -> Hamlet url m ()-outputHtml (Encoded t) = output t-outputHtml (Unencoded t) = output $ encodeHtml t+outputHtml = output . htmlContentToText  -- | 'pack' a 'String' and call 'output'; this will not perform any escaping. outputString :: Monad m => String -> Hamlet url m ()@@ -141,6 +136,7 @@ -- | Same as 'outputUrl', but appends a query-string with given keys and -- values. outputUrlParams :: Monad m => (url, [(String, String)]) -> Hamlet url m ()+outputUrlParams (u, []) = outputUrl u outputUrlParams (u, params) = do     outputUrl u     outputString $ showParams params@@ -253,4 +249,12 @@ -- | Returns HTML-ready text (ie, all entities are escaped properly). htmlContentToText :: HtmlContent -> Text htmlContentToText (Encoded t) = t-htmlContentToText (Unencoded t) = encodeHtml t+htmlContentToText (Unencoded t) = S.concatMap (pack . encodeHtmlChar) t++encodeHtmlChar :: Char -> String+encodeHtmlChar '<' = "&lt;"+encodeHtmlChar '>' = "&gt;"+encodeHtmlChar '&' = "&amp;"+encodeHtmlChar '"' = "&quot;"+encodeHtmlChar '\'' = "&#39;"+encodeHtmlChar c = [c]
Text/Hamlet/Parse.hs view
@@ -67,7 +67,7 @@     deriving (Eq, Show, Read)  parseLines :: HamletSettings -> String -> Result [(Int, Line)]-parseLines set = mapM go . lines where+parseLines set = mapM (go . killCarriage) . lines where     go s = do         let (spaces, s') = countSpaces 0 s         l <- parseLine set s'@@ -75,6 +75,10 @@     countSpaces i (' ':rest) = countSpaces (i + 1) rest     countSpaces i ('\t':rest) = countSpaces (i + 4) rest     countSpaces i x = (i, x)+    killCarriage s+        | null s = s+        | last s == '\r' = init s+        | otherwise = s  parseLine :: HamletSettings -> String -> Result Line parseLine set "!!!" =
hamlet.cabal view
@@ -1,5 +1,5 @@ name:            hamlet-version:         0.2.3+version:         0.2.3.1 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>@@ -40,7 +40,6 @@  library     build-depends:   base >= 4 && < 5,-                     web-encodings >= 0.2.4 && < 0.3,                      text >= 0.5 && < 0.8,                      template-haskell     exposed-modules: Text.Hamlet