update android patches for new version of shakespeare
This commit is contained in:
parent
34c6e0ea1a
commit
ce93ba24d4
6 changed files with 1282 additions and 870 deletions
|
@ -1,4 +1,5 @@
|
|||
constraints: Crypto ==4.2.5.1,
|
||||
binary ==0.7.6.1,
|
||||
DAV ==1.0.3,
|
||||
HTTP ==4000.2.17,
|
||||
HUnit ==1.2.5.2,
|
||||
|
@ -47,7 +48,6 @@ constraints: Crypto ==4.2.5.1,
|
|||
cryptohash ==0.11.6,
|
||||
cryptohash-conduit ==0.1.1,
|
||||
css-text ==0.1.2.1,
|
||||
shakespeare-text ==1.0.2,
|
||||
data-default ==0.5.3,
|
||||
data-default-class ==0.0.1,
|
||||
data-default-instances-base ==0.0.1,
|
||||
|
@ -76,7 +76,6 @@ constraints: Crypto ==4.2.5.1,
|
|||
gnutls ==0.1.4,
|
||||
gsasl ==0.3.5,
|
||||
hS3 ==0.5.7,
|
||||
hamlet ==1.1.9.2,
|
||||
hashable ==1.2.1.0,
|
||||
hinotify ==0.3.5,
|
||||
hjsmin ==0.1.4.7,
|
||||
|
@ -137,10 +136,7 @@ constraints: Crypto ==4.2.5.1,
|
|||
securemem ==0.1.3,
|
||||
semigroupoids ==4.2,
|
||||
semigroups ==0.15.3,
|
||||
shakespeare ==1.2.1.1,
|
||||
shakespeare-css ==1.0.7.4,
|
||||
shakespeare-i18n ==1.0.0.5,
|
||||
shakespeare-js ==1.2.0.4,
|
||||
shakespeare ==2.0.5,
|
||||
silently ==1.2.4.1,
|
||||
simple-sendfile ==0.2.14,
|
||||
skein ==1.0.9,
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
From dca2a30ca06865bf66cd25cc14b06f5d28190231 Mon Sep 17 00:00:00 2001
|
||||
From: dummy <dummy@example.com>
|
||||
Date: Thu, 16 Oct 2014 02:46:57 +0000
|
||||
Subject: [PATCH] remove TH
|
||||
|
||||
---
|
||||
Text/Shakespeare/Text.hs | 125 +++++------------------------------------------
|
||||
1 file changed, 11 insertions(+), 114 deletions(-)
|
||||
|
||||
diff --git a/Text/Shakespeare/Text.hs b/Text/Shakespeare/Text.hs
|
||||
index 6865a5a..e25a8be 100644
|
||||
--- a/Text/Shakespeare/Text.hs
|
||||
+++ b/Text/Shakespeare/Text.hs
|
||||
@@ -7,18 +7,18 @@ module Text.Shakespeare.Text
|
||||
( TextUrl
|
||||
, ToText (..)
|
||||
, renderTextUrl
|
||||
- , stext
|
||||
- , text
|
||||
- , textFile
|
||||
- , textFileDebug
|
||||
- , textFileReload
|
||||
- , st -- | strict text
|
||||
- , lt -- | lazy text, same as stext :)
|
||||
+ --, stext
|
||||
+ --, text
|
||||
+ --, textFile
|
||||
+ --, textFileDebug
|
||||
+ --, textFileReload
|
||||
+ --, st -- | strict text
|
||||
+ --, lt -- | lazy text, same as stext :)
|
||||
-- * Yesod code generation
|
||||
- , codegen
|
||||
- , codegenSt
|
||||
- , codegenFile
|
||||
- , codegenFileReload
|
||||
+ --, codegen
|
||||
+ --, codegenSt
|
||||
+ --, codegenFile
|
||||
+ --, codegenFileReload
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
@@ -45,106 +45,3 @@ instance ToText Int32 where toText = toText . show
|
||||
instance ToText Int64 where toText = toText . show
|
||||
instance ToText Int where toText = toText . show
|
||||
|
||||
-settings :: Q ShakespeareSettings
|
||||
-settings = do
|
||||
- toTExp <- [|toText|]
|
||||
- wrapExp <- [|id|]
|
||||
- unWrapExp <- [|id|]
|
||||
- return $ defaultShakespeareSettings { toBuilder = toTExp
|
||||
- , wrap = wrapExp
|
||||
- , unwrap = unWrapExp
|
||||
- }
|
||||
-
|
||||
-
|
||||
-stext, lt, st, text :: QuasiQuoter
|
||||
-stext =
|
||||
- QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- settings
|
||||
- render <- [|toLazyText|]
|
||||
- rendered <- shakespeareFromString rs { justVarInterpolation = True } s
|
||||
- return (render `AppE` rendered)
|
||||
- }
|
||||
-lt = stext
|
||||
-
|
||||
-st =
|
||||
- QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- settings
|
||||
- render <- [|TL.toStrict . toLazyText|]
|
||||
- rendered <- shakespeareFromString rs { justVarInterpolation = True } s
|
||||
- return (render `AppE` rendered)
|
||||
- }
|
||||
-
|
||||
-text = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- settings
|
||||
- quoteExp (shakespeare rs) $ filter (/='\r') s
|
||||
- }
|
||||
-
|
||||
-
|
||||
-textFile :: FilePath -> Q Exp
|
||||
-textFile fp = do
|
||||
- rs <- settings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
-
|
||||
-textFileDebug :: FilePath -> Q Exp
|
||||
-textFileDebug = textFileReload
|
||||
-{-# DEPRECATED textFileDebug "Please use textFileReload instead" #-}
|
||||
-
|
||||
-textFileReload :: FilePath -> Q Exp
|
||||
-textFileReload fp = do
|
||||
- rs <- settings
|
||||
- shakespeareFileReload rs fp
|
||||
-
|
||||
--- | codegen is designed for generating Yesod code, including templates
|
||||
--- So it uses different interpolation characters that won't clash with templates.
|
||||
-codegenSettings :: Q ShakespeareSettings
|
||||
-codegenSettings = do
|
||||
- toTExp <- [|toText|]
|
||||
- wrapExp <- [|id|]
|
||||
- unWrapExp <- [|id|]
|
||||
- return $ defaultShakespeareSettings { toBuilder = toTExp
|
||||
- , wrap = wrapExp
|
||||
- , unwrap = unWrapExp
|
||||
- , varChar = '~'
|
||||
- , urlChar = '*'
|
||||
- , intChar = '&'
|
||||
- , justVarInterpolation = True -- always!
|
||||
- }
|
||||
-
|
||||
--- | codegen is designed for generating Yesod code, including templates
|
||||
--- So it uses different interpolation characters that won't clash with templates.
|
||||
--- You can use the normal text quasiquoters to generate code
|
||||
-codegen :: QuasiQuoter
|
||||
-codegen =
|
||||
- QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- codegenSettings
|
||||
- render <- [|toLazyText|]
|
||||
- rendered <- shakespeareFromString rs { justVarInterpolation = True } s
|
||||
- return (render `AppE` rendered)
|
||||
- }
|
||||
-
|
||||
--- | Generates strict Text
|
||||
--- codegen is designed for generating Yesod code, including templates
|
||||
--- So it uses different interpolation characters that won't clash with templates.
|
||||
-codegenSt :: QuasiQuoter
|
||||
-codegenSt =
|
||||
- QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- codegenSettings
|
||||
- render <- [|TL.toStrict . toLazyText|]
|
||||
- rendered <- shakespeareFromString rs { justVarInterpolation = True } s
|
||||
- return (render `AppE` rendered)
|
||||
- }
|
||||
-
|
||||
-codegenFileReload :: FilePath -> Q Exp
|
||||
-codegenFileReload fp = do
|
||||
- rs <- codegenSettings
|
||||
- render <- [|TL.toStrict . toLazyText|]
|
||||
- rendered <- shakespeareFileReload rs{ justVarInterpolation = True } fp
|
||||
- return (render `AppE` rendered)
|
||||
-
|
||||
-codegenFile :: FilePath -> Q Exp
|
||||
-codegenFile fp = do
|
||||
- rs <- codegenSettings
|
||||
- render <- [|TL.toStrict . toLazyText|]
|
||||
- rendered <- shakespeareFile rs{ justVarInterpolation = True } fp
|
||||
- return (render `AppE` rendered)
|
||||
--
|
||||
2.1.1
|
||||
|
|
@ -8,10 +8,6 @@
|
|||
# versions that have been gotten working. To update, delete the
|
||||
# cabal.config, run this script with an empty cabal and fix up the broken
|
||||
# patches, and then use cabal freeze to generate a new cabal.config.
|
||||
#
|
||||
# This only installs haskell packages for ghc-android. The host ghc
|
||||
# also needs to have all the git-annex build deps installed, in similar
|
||||
# versions. Those are installed from Debian packages using apt.
|
||||
|
||||
set -e
|
||||
|
||||
|
@ -59,7 +55,7 @@ patched () {
|
|||
if [ -e config.guess ]; then
|
||||
cp /usr/share/misc/config.guess .
|
||||
fi
|
||||
cabal install # --reinstall --force-reinstalls
|
||||
cabal install # --force-reinstalls --reinstall
|
||||
rm -f cabal.config
|
||||
|
||||
rm -rf $pkg*
|
||||
|
@ -69,7 +65,7 @@ patched () {
|
|||
installgitannexdeps () {
|
||||
pushd ../..
|
||||
ln -sf standalone/android/cabal.config
|
||||
cabal install --only-dependencies "$@"
|
||||
cabal install --only-dependencies "$@" # --force-reinstalls --reinstall
|
||||
rm -f cabal.config
|
||||
popd
|
||||
}
|
||||
|
@ -90,7 +86,6 @@ EOF
|
|||
patched iproute
|
||||
patched primitive
|
||||
patched socks
|
||||
# patched entropy # needed for newer version, not current pinned version
|
||||
patched vector
|
||||
patched stm-chans
|
||||
patched persistent
|
||||
|
@ -103,10 +98,8 @@ EOF
|
|||
patched system-filepath
|
||||
patched optparse-applicative
|
||||
patched wai-app-static
|
||||
patched shakespeare
|
||||
patched shakespeare-css
|
||||
patched shakespeare-js
|
||||
patched yesod-routes
|
||||
patched shakespeare
|
||||
patched yesod-core
|
||||
patched yesod-persistent
|
||||
patched yesod-form
|
||||
|
@ -114,27 +107,28 @@ EOF
|
|||
patched clock
|
||||
patched yesod-auth
|
||||
patched yesod
|
||||
patched shakespeare-text
|
||||
patched process-conduit
|
||||
patched DAV
|
||||
patched yesod-static
|
||||
patched uuid
|
||||
patched dns
|
||||
patched gnutls
|
||||
patched unbounded-delays
|
||||
patched gnuidn
|
||||
patched network-protocol-xmpp
|
||||
patched uuid
|
||||
|
||||
cd ..
|
||||
|
||||
installgitannexdeps -fAndroid -f-Pairing
|
||||
}
|
||||
|
||||
# native cabal needs its own update
|
||||
cabal update
|
||||
|
||||
PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
|
||||
setupcabal
|
||||
cabal update
|
||||
|
||||
# Install packages for host ghc.
|
||||
installgitannexdeps
|
||||
|
||||
# Install packages for cross ghc, with patches as necessary.
|
||||
PATH=$HOME/.ghc/$(cat abiversion)/bin:$HOME/.ghc/$(cat abiversion)/arm-linux-androideabi/bin:$PATH
|
||||
cabal update
|
||||
install_pkgs
|
||||
|
|
|
@ -1,366 +0,0 @@
|
|||
From 657fa7135bbcf3d5adb3cc0032e09887dd80a2a7 Mon Sep 17 00:00:00 2001
|
||||
From: dummy <dummy@example.com>
|
||||
Date: Thu, 16 Oct 2014 02:05:14 +0000
|
||||
Subject: [PATCH] hack TH
|
||||
|
||||
---
|
||||
Text/Cassius.hs | 23 --------
|
||||
Text/Css.hs | 151 --------------------------------------------------
|
||||
Text/CssCommon.hs | 4 --
|
||||
Text/Lucius.hs | 46 +--------------
|
||||
shakespeare-css.cabal | 2 +-
|
||||
5 files changed, 3 insertions(+), 223 deletions(-)
|
||||
|
||||
diff --git a/Text/Cassius.hs b/Text/Cassius.hs
|
||||
index 91fc90f..c515807 100644
|
||||
--- a/Text/Cassius.hs
|
||||
+++ b/Text/Cassius.hs
|
||||
@@ -13,10 +13,6 @@ module Text.Cassius
|
||||
, renderCss
|
||||
, renderCssUrl
|
||||
-- * Parsing
|
||||
- , cassius
|
||||
- , cassiusFile
|
||||
- , cassiusFileDebug
|
||||
- , cassiusFileReload
|
||||
-- * ToCss instances
|
||||
-- ** Color
|
||||
, Color (..)
|
||||
@@ -27,11 +23,8 @@ module Text.Cassius
|
||||
, AbsoluteUnit (..)
|
||||
, AbsoluteSize (..)
|
||||
, absoluteSize
|
||||
- , EmSize (..)
|
||||
- , ExSize (..)
|
||||
, PercentageSize (..)
|
||||
, percentageSize
|
||||
- , PixelSize (..)
|
||||
-- * Internal
|
||||
, cassiusUsedIdentifiers
|
||||
) where
|
||||
@@ -43,25 +36,9 @@ import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
import Language.Haskell.TH.Syntax
|
||||
import qualified Data.Text.Lazy as TL
|
||||
import Text.CssCommon
|
||||
-import Text.Lucius (lucius)
|
||||
import qualified Text.Lucius
|
||||
import Text.IndentToBrace (i2b)
|
||||
|
||||
-cassius :: QuasiQuoter
|
||||
-cassius = QuasiQuoter { quoteExp = quoteExp lucius . i2b }
|
||||
-
|
||||
-cassiusFile :: FilePath -> Q Exp
|
||||
-cassiusFile fp = do
|
||||
-#ifdef GHC_7_4
|
||||
- qAddDependentFile fp
|
||||
-#endif
|
||||
- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp
|
||||
- quoteExp cassius contents
|
||||
-
|
||||
-cassiusFileDebug, cassiusFileReload :: FilePath -> Q Exp
|
||||
-cassiusFileDebug = cssFileDebug True [|Text.Lucius.parseTopLevels|] Text.Lucius.parseTopLevels
|
||||
-cassiusFileReload = cassiusFileDebug
|
||||
-
|
||||
-- | Determine which identifiers are used by the given template, useful for
|
||||
-- creating systems like yesod devel.
|
||||
cassiusUsedIdentifiers :: String -> [(Deref, VarType)]
|
||||
diff --git a/Text/Css.hs b/Text/Css.hs
|
||||
index 75dc549..20c206c 100644
|
||||
--- a/Text/Css.hs
|
||||
+++ b/Text/Css.hs
|
||||
@@ -166,22 +166,6 @@ cssUsedIdentifiers toi2b parseBlocks s' =
|
||||
(scope, rest') = go rest
|
||||
go' (Attr k v) = k ++ v
|
||||
|
||||
-cssFileDebug :: Bool -- ^ perform the indent-to-brace conversion
|
||||
- -> Q Exp
|
||||
- -> Parser [TopLevel Unresolved]
|
||||
- -> FilePath
|
||||
- -> Q Exp
|
||||
-cssFileDebug toi2b parseBlocks' parseBlocks fp = do
|
||||
- s <- fmap TL.unpack $ qRunIO $ readUtf8File fp
|
||||
-#ifdef GHC_7_4
|
||||
- qAddDependentFile fp
|
||||
-#endif
|
||||
- let vs = cssUsedIdentifiers toi2b parseBlocks s
|
||||
- c <- mapM vtToExp vs
|
||||
- cr <- [|cssRuntime toi2b|]
|
||||
- parseBlocks'' <- parseBlocks'
|
||||
- return $ cr `AppE` parseBlocks'' `AppE` (LitE $ StringL fp) `AppE` ListE c
|
||||
-
|
||||
combineSelectors :: HasLeadingSpace
|
||||
-> [Contents]
|
||||
-> [Contents]
|
||||
@@ -287,18 +271,6 @@ cssRuntime toi2b parseBlocks fp cd render' = unsafePerformIO $ do
|
||||
|
||||
addScope scope = map (DerefIdent . Ident *** CDPlain . fromString) scope ++ cd
|
||||
|
||||
-vtToExp :: (Deref, VarType) -> Q Exp
|
||||
-vtToExp (d, vt) = do
|
||||
- d' <- lift d
|
||||
- c' <- c vt
|
||||
- return $ TupE [d', c' `AppE` derefToExp [] d]
|
||||
- where
|
||||
- c :: VarType -> Q Exp
|
||||
- c VTPlain = [|CDPlain . toCss|]
|
||||
- c VTUrl = [|CDUrl|]
|
||||
- c VTUrlParam = [|CDUrlParam|]
|
||||
- c VTMixin = [|CDMixin|]
|
||||
-
|
||||
getVars :: Monad m => [(String, String)] -> Content -> m [(Deref, VarType)]
|
||||
getVars _ ContentRaw{} = return []
|
||||
getVars scope (ContentVar d) =
|
||||
@@ -342,111 +314,8 @@ compressBlock (Block x y blocks mixins) =
|
||||
cc (ContentRaw a:ContentRaw b:c) = cc $ ContentRaw (a ++ b) : c
|
||||
cc (a:b) = a : cc b
|
||||
|
||||
-blockToMixin :: Name
|
||||
- -> Scope
|
||||
- -> Block Unresolved
|
||||
- -> Q Exp
|
||||
-blockToMixin r scope (Block _sel props subblocks mixins) =
|
||||
- [|Mixin
|
||||
- { mixinAttrs = concat
|
||||
- $ $(listE $ map go props)
|
||||
- : map mixinAttrs $mixinsE
|
||||
- -- FIXME too many complications to implement sublocks for now...
|
||||
- , mixinBlocks = [] -- foldr (.) id $(listE $ map subGo subblocks) []
|
||||
- }|]
|
||||
- {-
|
||||
- . foldr (.) id $(listE $ map subGo subblocks)
|
||||
- . (concatMap mixinBlocks $mixinsE ++)
|
||||
- |]
|
||||
- -}
|
||||
- where
|
||||
- mixinsE = return $ ListE $ map (derefToExp []) mixins
|
||||
- go (Attr x y) = conE 'Attr
|
||||
- `appE` (contentsToBuilder r scope x)
|
||||
- `appE` (contentsToBuilder r scope y)
|
||||
- subGo (Block sel' b c d) = blockToCss r scope $ Block sel' b c d
|
||||
-
|
||||
-blockToCss :: Name
|
||||
- -> Scope
|
||||
- -> Block Unresolved
|
||||
- -> Q Exp
|
||||
-blockToCss r scope (Block sel props subblocks mixins) =
|
||||
- [|((Block
|
||||
- { blockSelector = $(selectorToBuilder r scope sel)
|
||||
- , blockAttrs = concat
|
||||
- $ $(listE $ map go props)
|
||||
- : map mixinAttrs $mixinsE
|
||||
- , blockBlocks = ()
|
||||
- , blockMixins = ()
|
||||
- } :: Block Resolved):)
|
||||
- . foldr (.) id $(listE $ map subGo subblocks)
|
||||
- . (concatMap mixinBlocks $mixinsE ++)
|
||||
- |]
|
||||
- where
|
||||
- mixinsE = return $ ListE $ map (derefToExp []) mixins
|
||||
- go (Attr x y) = conE 'Attr
|
||||
- `appE` (contentsToBuilder r scope x)
|
||||
- `appE` (contentsToBuilder r scope y)
|
||||
- subGo (hls, Block sel' b c d) =
|
||||
- blockToCss r scope $ Block sel'' b c d
|
||||
- where
|
||||
- sel'' = combineSelectors hls sel sel'
|
||||
-
|
||||
-selectorToBuilder :: Name -> Scope -> [Contents] -> Q Exp
|
||||
-selectorToBuilder r scope sels =
|
||||
- contentsToBuilder r scope $ intercalate [ContentRaw ","] sels
|
||||
-
|
||||
-contentsToBuilder :: Name -> Scope -> [Content] -> Q Exp
|
||||
-contentsToBuilder r scope contents =
|
||||
- appE [|mconcat|] $ listE $ map (contentToBuilder r scope) contents
|
||||
-
|
||||
-contentToBuilder :: Name -> Scope -> Content -> Q Exp
|
||||
-contentToBuilder _ _ (ContentRaw x) =
|
||||
- [|fromText . pack|] `appE` litE (StringL x)
|
||||
-contentToBuilder _ scope (ContentVar d) =
|
||||
- case d of
|
||||
- DerefIdent (Ident s)
|
||||
- | Just val <- lookup s scope -> [|fromText . pack|] `appE` litE (StringL val)
|
||||
- _ -> [|toCss|] `appE` return (derefToExp [] d)
|
||||
-contentToBuilder r _ (ContentUrl u) =
|
||||
- [|fromText|] `appE`
|
||||
- (varE r `appE` return (derefToExp [] u) `appE` listE [])
|
||||
-contentToBuilder r _ (ContentUrlParam u) =
|
||||
- [|fromText|] `appE`
|
||||
- ([|uncurry|] `appE` varE r `appE` return (derefToExp [] u))
|
||||
-contentToBuilder _ _ ContentMixin{} = error "contentToBuilder on ContentMixin"
|
||||
-
|
||||
type Scope = [(String, String)]
|
||||
|
||||
-topLevelsToCassius :: [TopLevel Unresolved]
|
||||
- -> Q Exp
|
||||
-topLevelsToCassius a = do
|
||||
- r <- newName "_render"
|
||||
- lamE [varP r] $ appE [|CssNoWhitespace . foldr ($) []|] $ fmap ListE $ go r [] a
|
||||
- where
|
||||
- go _ _ [] = return []
|
||||
- go r scope (TopBlock b:rest) = do
|
||||
- e <- [|(++) $ map TopBlock ($(blockToCss r scope b) [])|]
|
||||
- es <- go r scope rest
|
||||
- return $ e : es
|
||||
- go r scope (TopAtBlock name s b:rest) = do
|
||||
- let s' = contentsToBuilder r scope s
|
||||
- e <- [|(:) $ TopAtBlock $(lift name) $(s') $(blocksToCassius r scope b)|]
|
||||
- es <- go r scope rest
|
||||
- return $ e : es
|
||||
- go r scope (TopAtDecl dec cs:rest) = do
|
||||
- e <- [|(:) $ TopAtDecl $(lift dec) $(contentsToBuilder r scope cs)|]
|
||||
- es <- go r scope rest
|
||||
- return $ e : es
|
||||
- go r scope (TopVar k v:rest) = go r ((k, v) : scope) rest
|
||||
-
|
||||
-blocksToCassius :: Name
|
||||
- -> Scope
|
||||
- -> [Block Unresolved]
|
||||
- -> Q Exp
|
||||
-blocksToCassius r scope a = do
|
||||
- appE [|foldr ($) []|] $ listE $ map (blockToCss r scope) a
|
||||
-
|
||||
renderCss :: Css -> TL.Text
|
||||
renderCss css =
|
||||
toLazyText $ mconcat $ map go tops
|
||||
@@ -515,23 +384,3 @@ renderBlock haveWhiteSpace indent (Block sel attrs () ())
|
||||
| haveWhiteSpace = fromString ";\n"
|
||||
| otherwise = singleton ';'
|
||||
|
||||
-instance Lift Mixin where
|
||||
- lift (Mixin a b) = [|Mixin a b|]
|
||||
-instance Lift (Attr Unresolved) where
|
||||
- lift (Attr k v) = [|Attr k v :: Attr Unresolved |]
|
||||
-instance Lift (Attr Resolved) where
|
||||
- lift (Attr k v) = [|Attr $(liftBuilder k) $(liftBuilder v) :: Attr Resolved |]
|
||||
-
|
||||
-liftBuilder :: Builder -> Q Exp
|
||||
-liftBuilder b = [|fromText $ pack $(lift $ TL.unpack $ toLazyText b)|]
|
||||
-
|
||||
-instance Lift Content where
|
||||
- lift (ContentRaw s) = [|ContentRaw s|]
|
||||
- lift (ContentVar d) = [|ContentVar d|]
|
||||
- lift (ContentUrl d) = [|ContentUrl d|]
|
||||
- lift (ContentUrlParam d) = [|ContentUrlParam d|]
|
||||
- lift (ContentMixin m) = [|ContentMixin m|]
|
||||
-instance Lift (Block Unresolved) where
|
||||
- lift (Block a b c d) = [|Block a b c d|]
|
||||
-instance Lift (Block Resolved) where
|
||||
- lift (Block a b () ()) = [|Block $(liftBuilder a) b () ()|]
|
||||
diff --git a/Text/CssCommon.hs b/Text/CssCommon.hs
|
||||
index 719e0a8..8c40e8c 100644
|
||||
--- a/Text/CssCommon.hs
|
||||
+++ b/Text/CssCommon.hs
|
||||
@@ -1,4 +1,3 @@
|
||||
-{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
@@ -156,6 +155,3 @@ showSize :: Rational -> String -> String
|
||||
showSize value' unit = printf "%f" value ++ unit
|
||||
where value = fromRational value' :: Double
|
||||
|
||||
-mkSizeType "EmSize" "em"
|
||||
-mkSizeType "ExSize" "ex"
|
||||
-mkSizeType "PixelSize" "px"
|
||||
diff --git a/Text/Lucius.hs b/Text/Lucius.hs
|
||||
index 346883d..f38492b 100644
|
||||
--- a/Text/Lucius.hs
|
||||
+++ b/Text/Lucius.hs
|
||||
@@ -8,13 +8,9 @@
|
||||
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
|
||||
module Text.Lucius
|
||||
( -- * Parsing
|
||||
- lucius
|
||||
- , luciusFile
|
||||
- , luciusFileDebug
|
||||
- , luciusFileReload
|
||||
-- ** Mixins
|
||||
- , luciusMixin
|
||||
- , Mixin
|
||||
+ -- luciusMixin
|
||||
+ Mixin
|
||||
-- ** Runtime
|
||||
, luciusRT
|
||||
, luciusRT'
|
||||
@@ -40,11 +36,8 @@ module Text.Lucius
|
||||
, AbsoluteUnit (..)
|
||||
, AbsoluteSize (..)
|
||||
, absoluteSize
|
||||
- , EmSize (..)
|
||||
- , ExSize (..)
|
||||
, PercentageSize (..)
|
||||
, percentageSize
|
||||
- , PixelSize (..)
|
||||
-- * Internal
|
||||
, parseTopLevels
|
||||
, luciusUsedIdentifiers
|
||||
@@ -67,18 +60,6 @@ import Data.List (isSuffixOf)
|
||||
import Control.Arrow (second)
|
||||
import Text.Shakespeare (VarType)
|
||||
|
||||
--- |
|
||||
---
|
||||
--- >>> renderCss ([lucius|foo{bar:baz}|] undefined)
|
||||
--- "foo{bar:baz}"
|
||||
-lucius :: QuasiQuoter
|
||||
-lucius = QuasiQuoter { quoteExp = luciusFromString }
|
||||
-
|
||||
-luciusFromString :: String -> Q Exp
|
||||
-luciusFromString s =
|
||||
- topLevelsToCassius
|
||||
- $ either (error . show) id $ parse parseTopLevels s s
|
||||
-
|
||||
whiteSpace :: Parser ()
|
||||
whiteSpace = many whiteSpace1 >> return ()
|
||||
|
||||
@@ -218,17 +199,6 @@ parseComment = do
|
||||
_ <- manyTill anyChar $ try $ string "*/"
|
||||
return $ ContentRaw ""
|
||||
|
||||
-luciusFile :: FilePath -> Q Exp
|
||||
-luciusFile fp = do
|
||||
-#ifdef GHC_7_4
|
||||
- qAddDependentFile fp
|
||||
-#endif
|
||||
- contents <- fmap TL.unpack $ qRunIO $ readUtf8File fp
|
||||
- luciusFromString contents
|
||||
-
|
||||
-luciusFileDebug, luciusFileReload :: FilePath -> Q Exp
|
||||
-luciusFileDebug = cssFileDebug False [|parseTopLevels|] parseTopLevels
|
||||
-luciusFileReload = luciusFileDebug
|
||||
|
||||
parseTopLevels :: Parser [TopLevel Unresolved]
|
||||
parseTopLevels =
|
||||
@@ -377,15 +347,3 @@ luciusRTMinified tl scope = either Left (Right . renderCss . CssNoWhitespace) $
|
||||
-- creating systems like yesod devel.
|
||||
luciusUsedIdentifiers :: String -> [(Deref, VarType)]
|
||||
luciusUsedIdentifiers = cssUsedIdentifiers False parseTopLevels
|
||||
-
|
||||
-luciusMixin :: QuasiQuoter
|
||||
-luciusMixin = QuasiQuoter { quoteExp = luciusMixinFromString }
|
||||
-
|
||||
-luciusMixinFromString :: String -> Q Exp
|
||||
-luciusMixinFromString s' = do
|
||||
- r <- newName "_render"
|
||||
- case fmap compressBlock $ parse parseBlock s s of
|
||||
- Left e -> error $ show e
|
||||
- Right block -> blockToMixin r [] block
|
||||
- where
|
||||
- s = concat ["mixin{", s', "}"]
|
||||
diff --git a/shakespeare-css.cabal b/shakespeare-css.cabal
|
||||
index 2d3b25a..cc0553c 100644
|
||||
--- a/shakespeare-css.cabal
|
||||
+++ b/shakespeare-css.cabal
|
||||
@@ -35,8 +35,8 @@ library
|
||||
|
||||
exposed-modules: Text.Cassius
|
||||
Text.Lucius
|
||||
- other-modules: Text.MkSizeType
|
||||
Text.Css
|
||||
+ other-modules: Text.MkSizeType
|
||||
Text.IndentToBrace
|
||||
Text.CssCommon
|
||||
ghc-options: -Wall
|
||||
--
|
||||
2.1.1
|
||||
|
|
@ -1,316 +0,0 @@
|
|||
From 26f7328b0123d3ffa66873b91189ba3bdae3356c Mon Sep 17 00:00:00 2001
|
||||
From: dummy <dummy@example.com>
|
||||
Date: Thu, 16 Oct 2014 02:07:32 +0000
|
||||
Subject: [PATCH] hack TH
|
||||
|
||||
---
|
||||
Text/Coffee.hs | 56 ++++-----------------------------------------
|
||||
Text/Julius.hs | 67 +++++++++---------------------------------------------
|
||||
Text/Roy.hs | 51 ++++-------------------------------------
|
||||
Text/TypeScript.hs | 51 ++++-------------------------------------
|
||||
4 files changed, 24 insertions(+), 201 deletions(-)
|
||||
|
||||
diff --git a/Text/Coffee.hs b/Text/Coffee.hs
|
||||
index 488c81b..61db85b 100644
|
||||
--- a/Text/Coffee.hs
|
||||
+++ b/Text/Coffee.hs
|
||||
@@ -51,13 +51,13 @@ module Text.Coffee
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- coffee
|
||||
- , coffeeFile
|
||||
- , coffeeFileReload
|
||||
- , coffeeFileDebug
|
||||
+ -- coffee
|
||||
+ --, coffeeFile
|
||||
+ --, coffeeFileReload
|
||||
+ --, coffeeFileDebug
|
||||
|
||||
#ifdef TEST_EXPORT
|
||||
- , coffeeSettings
|
||||
+ --, coffeeSettings
|
||||
#endif
|
||||
) where
|
||||
|
||||
@@ -65,49 +65,3 @@ import Language.Haskell.TH.Quote (QuasiQuoter (..))
|
||||
import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
-
|
||||
-coffeeSettings :: Q ShakespeareSettings
|
||||
-coffeeSettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '%'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "coffee" ["-spb"]
|
||||
- , preEscapeIgnoreBalanced = "'\"`" -- don't insert backtacks for variable already inside strings or backticks.
|
||||
- , preEscapeIgnoreLine = "#" -- ignore commented lines
|
||||
- , wrapInsertion = Just WrapInsertion {
|
||||
- wrapInsertionIndent = Just " "
|
||||
- , wrapInsertionStartBegin = "("
|
||||
- , wrapInsertionSeparator = ", "
|
||||
- , wrapInsertionStartClose = ") =>"
|
||||
- , wrapInsertionEnd = ""
|
||||
- , wrapInsertionAddParens = False
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted CoffeeScript.
|
||||
-coffee :: QuasiQuoter
|
||||
-coffee = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- coffeeSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a CoffeeScript template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-coffeeFile :: FilePath -> Q Exp
|
||||
-coffeeFile fp = do
|
||||
- rs <- coffeeSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a CoffeeScript template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-coffeeFileReload :: FilePath -> Q Exp
|
||||
-coffeeFileReload fp = do
|
||||
- rs <- coffeeSettings
|
||||
- shakespeareFileReload rs fp
|
||||
-
|
||||
--- | Deprecated synonym for 'coffeeFileReload'
|
||||
-coffeeFileDebug :: FilePath -> Q Exp
|
||||
-coffeeFileDebug = coffeeFileReload
|
||||
-{-# DEPRECATED coffeeFileDebug "Please use coffeeFileReload instead." #-}
|
||||
diff --git a/Text/Julius.hs b/Text/Julius.hs
|
||||
index ec30690..5b5a075 100644
|
||||
--- a/Text/Julius.hs
|
||||
+++ b/Text/Julius.hs
|
||||
@@ -14,17 +14,17 @@ module Text.Julius
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- js
|
||||
- , julius
|
||||
- , juliusFile
|
||||
- , jsFile
|
||||
- , juliusFileDebug
|
||||
- , jsFileDebug
|
||||
- , juliusFileReload
|
||||
- , jsFileReload
|
||||
+ -- js
|
||||
+ -- julius
|
||||
+ -- juliusFile
|
||||
+ -- jsFile
|
||||
+ --, juliusFileDebug
|
||||
+ --, jsFileDebug
|
||||
+ --, juliusFileReload
|
||||
+ --, jsFileReload
|
||||
|
||||
-- * Datatypes
|
||||
- , JavascriptUrl
|
||||
+ JavascriptUrl
|
||||
, Javascript (..)
|
||||
, RawJavascript (..)
|
||||
|
||||
@@ -37,9 +37,9 @@ module Text.Julius
|
||||
, renderJavascriptUrl
|
||||
|
||||
-- ** internal, used by 'Text.Coffee'
|
||||
- , javascriptSettings
|
||||
+ --, javascriptSettings
|
||||
-- ** internal
|
||||
- , juliusUsedIdentifiers
|
||||
+ --, juliusUsedIdentifiers
|
||||
, asJavascriptUrl
|
||||
) where
|
||||
|
||||
@@ -102,48 +102,3 @@ instance RawJS TL.Text where rawJS = RawJavascript . fromLazyText
|
||||
instance RawJS Builder where rawJS = RawJavascript
|
||||
instance RawJS Bool where rawJS = RawJavascript . unJavascript . toJavascript
|
||||
|
||||
-javascriptSettings :: Q ShakespeareSettings
|
||||
-javascriptSettings = do
|
||||
- toJExp <- [|toJavascript|]
|
||||
- wrapExp <- [|Javascript|]
|
||||
- unWrapExp <- [|unJavascript|]
|
||||
- asJavascriptUrl' <- [|asJavascriptUrl|]
|
||||
- return $ defaultShakespeareSettings { toBuilder = toJExp
|
||||
- , wrap = wrapExp
|
||||
- , unwrap = unWrapExp
|
||||
- , modifyFinalValue = Just asJavascriptUrl'
|
||||
- }
|
||||
-
|
||||
-js, julius :: QuasiQuoter
|
||||
-js = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- javascriptSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
-julius = js
|
||||
-
|
||||
-jsFile, juliusFile :: FilePath -> Q Exp
|
||||
-jsFile fp = do
|
||||
- rs <- javascriptSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
-juliusFile = jsFile
|
||||
-
|
||||
-
|
||||
-jsFileReload, juliusFileReload :: FilePath -> Q Exp
|
||||
-jsFileReload fp = do
|
||||
- rs <- javascriptSettings
|
||||
- shakespeareFileReload rs fp
|
||||
-
|
||||
-juliusFileReload = jsFileReload
|
||||
-
|
||||
-jsFileDebug, juliusFileDebug :: FilePath -> Q Exp
|
||||
-juliusFileDebug = jsFileReload
|
||||
-{-# DEPRECATED juliusFileDebug "Please use juliusFileReload instead." #-}
|
||||
-jsFileDebug = jsFileReload
|
||||
-{-# DEPRECATED jsFileDebug "Please use jsFileReload instead." #-}
|
||||
-
|
||||
--- | Determine which identifiers are used by the given template, useful for
|
||||
--- creating systems like yesod devel.
|
||||
-juliusUsedIdentifiers :: String -> [(Deref, VarType)]
|
||||
-juliusUsedIdentifiers = shakespeareUsedIdentifiers defaultShakespeareSettings
|
||||
diff --git a/Text/Roy.hs b/Text/Roy.hs
|
||||
index 6e5e246..9ab0dbc 100644
|
||||
--- a/Text/Roy.hs
|
||||
+++ b/Text/Roy.hs
|
||||
@@ -39,12 +39,12 @@ module Text.Roy
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- roy
|
||||
- , royFile
|
||||
- , royFileReload
|
||||
+ -- roy
|
||||
+ --, royFile
|
||||
+ --, royFileReload
|
||||
|
||||
#ifdef TEST_EXPORT
|
||||
- , roySettings
|
||||
+ --, roySettings
|
||||
#endif
|
||||
) where
|
||||
|
||||
@@ -53,46 +53,3 @@ import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
|
||||
--- | The Roy language compiles down to Javascript.
|
||||
--- We do this compilation once at compile time to avoid needing to do it during the request.
|
||||
--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call.
|
||||
-roySettings :: Q ShakespeareSettings
|
||||
-roySettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '#'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "roy" ["--stdio", "--browser"]
|
||||
- , preEscapeIgnoreBalanced = "'\""
|
||||
- , preEscapeIgnoreLine = "//"
|
||||
- , wrapInsertion = Just WrapInsertion {
|
||||
- wrapInsertionIndent = Just " "
|
||||
- , wrapInsertionStartBegin = "(\\"
|
||||
- , wrapInsertionSeparator = " "
|
||||
- , wrapInsertionStartClose = " ->\n"
|
||||
- , wrapInsertionEnd = ")"
|
||||
- , wrapInsertionAddParens = True
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted Roy.
|
||||
-roy :: QuasiQuoter
|
||||
-roy = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- roySettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a Roy template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-royFile :: FilePath -> Q Exp
|
||||
-royFile fp = do
|
||||
- rs <- roySettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a Roy template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-royFileReload :: FilePath -> Q Exp
|
||||
-royFileReload fp = do
|
||||
- rs <- roySettings
|
||||
- shakespeareFileReload rs fp
|
||||
diff --git a/Text/TypeScript.hs b/Text/TypeScript.hs
|
||||
index 70c8820..5be994a 100644
|
||||
--- a/Text/TypeScript.hs
|
||||
+++ b/Text/TypeScript.hs
|
||||
@@ -57,12 +57,12 @@ module Text.TypeScript
|
||||
-- ** Template-Reading Functions
|
||||
-- | These QuasiQuoter and Template Haskell methods return values of
|
||||
-- type @'JavascriptUrl' url@. See the Yesod book for details.
|
||||
- tsc
|
||||
- , typeScriptFile
|
||||
- , typeScriptFileReload
|
||||
+ -- tsc
|
||||
+ --, typeScriptFile
|
||||
+ --, typeScriptFileReload
|
||||
|
||||
#ifdef TEST_EXPORT
|
||||
- , typeScriptSettings
|
||||
+ --, typeScriptSettings
|
||||
#endif
|
||||
) where
|
||||
|
||||
@@ -71,46 +71,3 @@ import Language.Haskell.TH.Syntax
|
||||
import Text.Shakespeare
|
||||
import Text.Julius
|
||||
|
||||
--- | The TypeScript language compiles down to Javascript.
|
||||
--- We do this compilation once at compile time to avoid needing to do it during the request.
|
||||
--- We call this a preConversion because other shakespeare modules like Lucius use Haskell to compile during the request instead rather than a system call.
|
||||
-typeScriptSettings :: Q ShakespeareSettings
|
||||
-typeScriptSettings = do
|
||||
- jsettings <- javascriptSettings
|
||||
- return $ jsettings { varChar = '#'
|
||||
- , preConversion = Just PreConvert {
|
||||
- preConvert = ReadProcess "sh" ["-c", "TMP_IN=$(mktemp XXXXXXXXXX.ts); TMP_OUT=$(mktemp XXXXXXXXXX.js); cat /dev/stdin > ${TMP_IN} && tsc --out ${TMP_OUT} ${TMP_IN} && cat ${TMP_OUT}; rm ${TMP_IN} && rm ${TMP_OUT}"]
|
||||
- , preEscapeIgnoreBalanced = "'\""
|
||||
- , preEscapeIgnoreLine = "//"
|
||||
- , wrapInsertion = Just WrapInsertion {
|
||||
- wrapInsertionIndent = Nothing
|
||||
- , wrapInsertionStartBegin = ";(function("
|
||||
- , wrapInsertionSeparator = ", "
|
||||
- , wrapInsertionStartClose = "){"
|
||||
- , wrapInsertionEnd = "})"
|
||||
- , wrapInsertionAddParens = False
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
--- | Read inline, quasiquoted TypeScript
|
||||
-tsc :: QuasiQuoter
|
||||
-tsc = QuasiQuoter { quoteExp = \s -> do
|
||||
- rs <- typeScriptSettings
|
||||
- quoteExp (shakespeare rs) s
|
||||
- }
|
||||
-
|
||||
--- | Read in a TypeScript template file. This function reads the file once, at
|
||||
--- compile time.
|
||||
-typeScriptFile :: FilePath -> Q Exp
|
||||
-typeScriptFile fp = do
|
||||
- rs <- typeScriptSettings
|
||||
- shakespeareFile rs fp
|
||||
-
|
||||
--- | Read in a Roy template file. This impure function uses
|
||||
--- unsafePerformIO to re-read the file on every call, allowing for rapid
|
||||
--- iteration.
|
||||
-typeScriptFileReload :: FilePath -> Q Exp
|
||||
-typeScriptFileReload fp = do
|
||||
- rs <- typeScriptSettings
|
||||
- shakespeareFileReload rs fp
|
||||
--
|
||||
2.1.1
|
||||
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue