shakespeare 2.0.15 → 2.0.16
raw patch · 17 files changed
+24/−120 lines, 17 filesdep −semigroupsdep ~base
Dependencies removed: semigroups
Dependency ranges changed: base
Files
- ChangeLog.md +4/−0
- Text/Cassius.hs +0/−4
- Text/Coffee.hs +1/−1
- Text/Hamlet.hs +2/−15
- Text/Hamlet/Parse.hs +0/−1
- Text/Hamlet/RT.hs +1/−24
- Text/Internal/Css.hs +0/−7
- Text/Internal/CssCommon.hs +0/−1
- Text/Julius.hs +2/−0
- Text/Lucius.hs +0/−4
- Text/MkSizeType.hs +2/−13
- Text/Roy.hs +1/−1
- Text/Shakespeare.hs +3/−17
- Text/Shakespeare/I18N.hs +1/−18
- Text/Shakespeare/Text.hs +0/−1
- Text/TypeScript.hs +2/−2
- shakespeare.cabal +5/−11
ChangeLog.md view
@@ -1,3 +1,7 @@+### 2.0.16++* Updated `encodeToTextBuilder` also escapes single quotes [#221](https://github.com/yesodweb/shakespeare/pull/221)+ ### 2.0.15 * Semigroup instances
Text/Cassius.hs view
@@ -2,7 +2,6 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} module Text.Cassius ( -- * Datatypes@@ -56,9 +55,6 @@ cassiusFile :: FilePath -> Q Exp cassiusFile fp = do-#ifdef GHC_7_4- qAddDependentFile fp-#endif contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp quoteExp cassius contents
Text/Coffee.hs view
@@ -43,7 +43,7 @@ -- -- Further reading: ----- 1. Shakespearean templates: <http://www.yesodweb.com/book/templates>+-- 1. Shakespearean templates: <https://www.yesodweb.com/book/shakespearean-templates> -- -- 2. CoffeeScript: <http://coffeescript.org/> module Text.Coffee
Text/Hamlet.hs view
@@ -1,5 +1,4 @@ {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-}@@ -50,11 +49,7 @@ import Text.Shakespeare.Base import Text.Hamlet.Parse-#if MIN_VERSION_template_haskell(2,9,0) import Language.Haskell.TH.Syntax hiding (Module)-#else-import Language.Haskell.TH.Syntax-#endif import Language.Haskell.TH.Quote import Data.Char (isUpper, isDigit) import Data.Maybe (fromMaybe)@@ -122,8 +117,8 @@ bindingPattern :: Binding -> Q (Pat, [(Ident, Exp)]) bindingPattern (BindAs i@(Ident s) b) = do name <- newName s- (pattern, scope) <- bindingPattern b- return (AsP name pattern, (i, VarE name):scope)+ (newPattern, scope) <- bindingPattern b+ return (AsP name newPattern, (i, VarE name):scope) bindingPattern (BindVar i@(Ident s)) | s == "_" = return (WildP, []) | all isDigit s = do@@ -183,13 +178,8 @@ -- use 'lookupValueName' instead of just using 'mkName' so we reify the -- data constructor and not the type constructor if their names match. Just conName <- lookupValueName $ conToStr conStr-#if MIN_VERSION_template_haskell(2,11,0) DataConI _ _ typeName <- reify conName TyConI (DataD _ _ _ _ cons _) <- reify typeName-#else- DataConI _ _ typeName _ <- reify conName- TyConI (DataD _ _ _ cons _) <- reify typeName-#endif [fields] <- return [fields | RecC name fields <- cons, name == conName] return [fieldName | (fieldName, _, _) <- fields] @@ -423,9 +413,6 @@ hamletFileWithSettings :: Q HamletRules -> HamletSettings -> FilePath -> Q Exp hamletFileWithSettings qhr set fp = do-#ifdef GHC_7_4- qAddDependentFile fp-#endif contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp hamletFromString qhr set contents
Text/Hamlet/Parse.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleInstances #-} module Text.Hamlet.Parse ( Result (..)
Text/Hamlet/RT.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-}@@ -24,20 +23,11 @@ import Data.Typeable (Typeable) import Text.Hamlet.Parse import Data.List (intercalate)-#if MIN_VERSION_blaze_html(0,5,0) import Text.Blaze.Html (Html) import Text.Blaze.Internal (preEscapedString, preEscapedText)-#else-import Text.Blaze (preEscapedString, preEscapedText, Html)-#endif import Data.Text (Text) -#if MIN_VERSION_exceptions(0,4,0) import Control.Monad.Catch (MonadThrow, throwM)-#else-import Control.Monad.Catch (MonadCatch, throwM)-#define MonadThrow MonadCatch-#endif type HamletMap url = [([String], HamletData url)] type UrlRenderer url = (url -> [(Text, Text)] -> Text)@@ -131,11 +121,7 @@ -> m Html renderHamletRT = renderHamletRT' False -#if MIN_VERSION_exceptions(0,4,0) renderHamletRT' :: MonadThrow m-#else-renderHamletRT' :: MonadCatch m-#endif => Bool -- ^ should embeded template (via ^{..}) be plain Html or actual templates? -> HamletRT -> HamletMap url@@ -192,12 +178,7 @@ renderHamletRT' tempAsHtml (HamletRT docs') scope renderUrl HDBool False -> go scope (SDCond cs els) _ -> fa $ showName b ++ ": expected HDBool"-#if MIN_VERSION_exceptions(0,4,0)- lookup' :: MonadThrow m-#else- lookup' :: MonadCatch m-#endif- => [String] -> [String] -> HamletMap url -> m (HamletData url)+ lookup' :: MonadThrow m => [String] -> [String] -> HamletMap url -> m (HamletData url) lookup' orig k m = case lookup k m of Nothing | k == ["True"] -> return $ HDBool True@@ -210,11 +191,7 @@ showName :: [String] -> String showName = intercalate "." . reverse -#if MIN_VERSION_exceptions(0,4,0) flattenDeref' :: MonadThrow f => Doc -> Deref -> f [String]-#else-flattenDeref' :: MonadCatch f => Doc -> Deref -> f [String]-#endif flattenDeref' orig deref = case flattenDeref deref of Nothing -> throwM $ HamletUnsupportedDocException orig
Text/Internal/Css.hs view
@@ -6,7 +6,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE PatternGuards #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE EmptyDataDecls #-} module Text.Internal.Css where@@ -71,9 +70,6 @@ Mixin a x <> Mixin b y = Mixin (a ++ b) (x ++ y) instance Monoid Mixin where mempty = Mixin mempty mempty-#if !(MIN_VERSION_base(4,11,0))- mappend = (<>)-#endif data TopLevel a where TopBlock :: !(Block a) -> TopLevel a@@ -108,9 +104,6 @@ pack :: String -> Text pack = T.pack-#if !MIN_VERSION_text(0, 11, 2)-{-# NOINLINE pack #-}-#endif fromText :: Text -> Builder fromText = TLB.fromText
Text/Internal/CssCommon.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE CPP #-} module Text.Internal.CssCommon where import Text.Internal.Css
Text/Julius.hs view
@@ -128,12 +128,14 @@ Just (!c,t') -> fromText h <> escape c <> quote t' where (h,t) = {-# SCC "break" #-} T.break isEscape q isEscape c = c == '\"' ||+ c == '\'' || c == '\\' || c == '<' || c == '>' || c == '&' || c < '\x20' escape '\"' = "\\\""+ escape '\'' = "\\\'" escape '\\' = "\\\\" escape '\n' = "\\n" escape '\r' = "\\r"
Text/Lucius.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE CPP #-} {-# LANGUAGE QuasiQuotes #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} module Text.Lucius@@ -223,9 +222,6 @@ luciusFile :: FilePath -> Q Exp luciusFile fp = do-#ifdef GHC_7_4- qAddDependentFile fp-#endif contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp luciusFromString contents
Text/MkSizeType.hs view
@@ -3,7 +3,7 @@ -- | Internal functions to generate CSS size wrapper types. module Text.MkSizeType (mkSizeType) where -#if MIN_VERSION_template_haskell(2,11,0)+#if !MIN_VERSION_template_haskell(2,12,0) import Language.Haskell.TH (conT) #endif import Language.Haskell.TH.Syntax@@ -25,10 +25,8 @@ #if MIN_VERSION_template_haskell(2,12,0) return $ DataD [] name [] Nothing [constructor] [DerivClause Nothing (map ConT derives)]-#elif MIN_VERSION_template_haskell(2,11,0)- DataD [] name [] Nothing [constructor] <$> mapM conT derives #else- return $ DataD [] name [] [constructor] derives+ DataD [] name [] Nothing [constructor] <$> mapM conT derives #endif where constructor = NormalC name [(notStrict, ConT $ mkName "Rational")] derives = map mkName ["Eq", "Ord"]@@ -88,17 +86,8 @@ fun = mkName fun' x = mkName "x" -#if MIN_VERSION_template_haskell(2,11,0) notStrict :: Bang notStrict = Bang NoSourceUnpackedness NoSourceStrictness-#else-notStrict :: Strict-notStrict = NotStrict-#endif instanceD :: Cxt -> Type -> [Dec] -> Dec-#if MIN_VERSION_template_haskell(2,11,0) instanceD = InstanceD Nothing-#else-instanceD = InstanceD-#endif
Text/Roy.hs view
@@ -31,7 +31,7 @@ -- -- Further reading: ----- 1. Shakespearean templates: <http://www.yesodweb.com/book/templates>+-- 1. Shakespearean templates: <https://www.yesodweb.com/book/shakespearean-templates> -- -- 2. Roy: <http://roy.brianmckenna.org/> module Text.Roy
Text/Shakespeare.hs view
@@ -41,11 +41,10 @@ import Language.Haskell.TH.Quote (QuasiQuoter (..)) import Language.Haskell.TH (appE) import Language.Haskell.TH.Syntax-#if !MIN_VERSION_template_haskell(2,8,0)-import Language.Haskell.TH.Syntax.Internals-#endif import Data.Text.Lazy.Builder (Builder, fromText)+#if !MIN_VERSION_base(4,11,0) import Data.Monoid+#endif import System.IO.Unsafe (unsafePerformIO) import qualified Data.Text as TS import qualified Data.Text.Lazy as TL@@ -63,12 +62,6 @@ import System.Process (readProcessWithExitCode) import System.Exit (ExitCode(..)) -#if !MIN_VERSION_base(4,5,0)-(<>) :: Monoid m => m -> m -> m-(<>) = mappend-{-# INLINE (<>) #-}-#endif- -- | A parser with a user state of [String] type Parser = Parsec String [String] -- | run a parser with a user state of [String]@@ -344,9 +337,6 @@ pack' :: String -> TS.Text pack' = TS.pack-#if !MIN_VERSION_text(0, 11, 2)-{-# NOINLINE pack' #-}-#endif contentsToShakespeare :: ShakespeareSettings -> [Content] -> Q Exp contentsToShakespeare rs a = do@@ -394,11 +384,7 @@ contentsToShakespeare r $ contentFromString r s shakespeareFile :: ShakespeareSettings -> FilePath -> Q Exp-shakespeareFile r fp =-#ifdef GHC_7_4- qAddDependentFile fp >>-#endif- readFileQ fp >>= shakespeareFromString r+shakespeareFile r fp = readFileQ fp >>= shakespeareFromString r data VarType = VTPlain | VTUrl | VTUrlParam | VTMixin deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)
Text/Shakespeare/I18N.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE ExistentialQuantification #-}-{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- |@@ -156,9 +155,6 @@ files <- qRunIO $ getDirectoryContents folder let files' = filter (`notElem` [".", ".."]) files (_files', contents) <- qRunIO $ fmap (unzip . catMaybes) $ mapM (loadLang folder) files'-#ifdef GHC_7_4- mapM_ qAddDependentFile $ concat _files'-#endif let contents' = Map.toList $ Map.fromListWith (++) contents sdef <- case lookup lang contents' of@@ -171,11 +167,7 @@ c3 <- defClause return $ ( if genType- then ((DataD [] mname []-#if MIN_VERSION_template_haskell(2,11,0)- Nothing-#endif- (map (toCon dt) sdef) []) :)+ then ((DataD [] mname [] Nothing (map (toCon dt) sdef) []) :) else id) [ instanceD []@@ -407,17 +399,8 @@ instance master ~ master' => RenderMessage master (SomeMessage master') where renderMessage a b (SomeMessage msg) = renderMessage a b msg -#if MIN_VERSION_template_haskell(2,11,0) notStrict :: Bang notStrict = Bang NoSourceUnpackedness NoSourceStrictness-#else-notStrict :: Strict-notStrict = NotStrict-#endif instanceD :: Cxt -> Type -> [Dec] -> Dec-#if MIN_VERSION_template_haskell(2,11,0) instanceD = InstanceD Nothing-#else-instanceD = InstanceD-#endif
Text/Shakespeare/Text.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-missing-fields #-} module Text.Shakespeare.Text ( TextUrl
Text/TypeScript.hs view
@@ -49,9 +49,9 @@ -- -- Further reading: ----- 1. Shakespearean templates: <http://www.yesodweb.com/book/templates>+-- 1. Shakespearean templates: <https://www.yesodweb.com/book/shakespearean-templates> ----- 2. TypeScript: <http://typescript.codeplex.com/>+-- 2. TypeScript: <https://www.typescriptlang.org/> module Text.TypeScript ( -- * Functions -- ** Template-Reading Functions
shakespeare.cabal view
@@ -1,5 +1,5 @@ name: shakespeare-version: 2.0.15+version: 2.0.16 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -34,7 +34,7 @@ ChangeLog.md library- build-depends: base >= 4 && < 5+ build-depends: base >= 4.9 && < 5 , time >= 1 , containers , template-haskell >= 2.7@@ -53,9 +53,6 @@ , unordered-containers , scientific >= 0.3.0.0 - if !impl(ghc >= 8.0)- build-depends: semigroups >= 0.16- exposed-modules: Text.Shakespeare.I18N Text.Shakespeare.Text Text.Roy@@ -82,9 +79,6 @@ extensions: TemplateHaskell - if impl(ghc >= 7.4)- cpp-options: -DGHC_7_4- if os(windows) CPP-Options: "-DWINDOWS" @@ -106,8 +100,8 @@ default: False flag test_roy- description: render tests through coffeescript render function- -- cabal configure --enable-tests -ftest_coffee && cabal build && dist/build/test/test+ description: render tests through roy render function+ -- cabal configure --enable-tests -ftest_roy && cabal build && dist/build/test/test default: False test-suite test@@ -127,7 +121,7 @@ type: exitcode-stdio-1.0 ghc-options: -Wall- build-depends: base >= 4 && < 5+ build-depends: base >= 4.9 && < 5 , shakespeare , time >= 1 , containers