hsx-jmacro 6.0.1 → 6.0.2
raw patch · 2 files changed
+5/−13 lines, 2 filesdep ~jmacroPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: jmacro
API changes (from Hackage documentation)
Files
- HSX/JMacro.hs +3/−11
- hsx-jmacro.cabal +2/−2
HSX/JMacro.hs view
@@ -27,7 +27,7 @@ import Control.Monad.Trans (lift) import Control.Monad.State (MonadState(get,put)) import HSX.XMLGenerator (XMLGenerator(..), XMLGen(..), EmbedAsChild(..), EmbedAsAttr(..), IsName(..), Attr(..), Name)-import Language.Javascript.JMacro (JStat(..), jsToDoc, jsSaturate, renderJs)+import Language.Javascript.JMacro (JStat(..), jsToDoc, jsSaturate, renderPrefixJs) import Text.PrettyPrint.HughesPJ (Style(..), Mode(..), render, renderStyle, style) class IntegerSupply m where @@ -51,19 +51,11 @@ do i <- lift nextInteger asChild $ genElement (Nothing, "script") [asAttr ("type" := "text/javascript")]- [asChild (escapeForHtml $ render $ jsToDoc $ jsSaturate (Just ('i' : show i)) jstat)]- where- escapeForHtml :: String -> String- escapeForHtml [] = []- escapeForHtml [c] = [c]- escapeForHtml (b:c:cs)- | b == '<' && c == '/' - = b : '\\' : c : (escapeForHtml cs)- | otherwise = b : escapeForHtml (c : cs)+ [asChild (render $ renderPrefixJs (show i) jstat)] instance (IntegerSupply m, IsName n, EmbedAsAttr m (Attr Name String)) => EmbedAsAttr m (Attr n JStat) where asAttr (n := jstat) = do i <- lift nextInteger- asAttr $ (toName n := (renderStyle lineStyle $ jsToDoc $ jsSaturate (Just ('i' : show i)) jstat))+ asAttr $ (toName n := (renderStyle lineStyle $ renderPrefixJs (show i) jstat)) where lineStyle = style { mode= OneLineMode }
hsx-jmacro.cabal view
@@ -1,5 +1,5 @@ Name: hsx-jmacro-Version: 6.0.1+Version: 6.0.2 Synopsis: hsx+jmacro support Description: HSX allows for the use of literal XML in Haskell program text. JMacro allows for the use of javascript-syntax for generating javascript in Haskell. This library makes it easy to embed JMacro generated javascript in HSX templates. Homepage: http://www.happstack.com/@@ -18,6 +18,6 @@ Build-depends: base >4 && <5, hsx,- jmacro,+ jmacro >= 0.5 && < 0.6, mtl, pretty