ede 0.2.4 → 0.2.5
raw patch · 11 files changed
+51/−175 lines, 11 filesdep −conduitdep −conduit-extradep −optparse-applicativedep ~aesondep ~bytestringdep ~directory
Dependencies removed: conduit, conduit-extra, optparse-applicative
Dependency ranges changed: aeson, bytestring, directory, mtl, text
Files
- ede.cabal +41/−67
- src/Main.hs +0/−98
- src/Text/EDE.hs +1/−1
- src/Text/EDE/Filters.hs +1/−1
- src/Text/EDE/Internal/AST.hs +1/−1
- src/Text/EDE/Internal/Eval.hs +2/−2
- src/Text/EDE/Internal/Filters.hs +1/−1
- src/Text/EDE/Internal/Parser.hs +1/−1
- src/Text/EDE/Internal/Quoting.hs +1/−1
- src/Text/EDE/Internal/Syntax.hs +1/−1
- src/Text/EDE/Internal/Types.hs +1/−1
ede.cabal view
@@ -1,12 +1,12 @@ name: ede-version: 0.2.4+version: 0.2.5 synopsis: Templating language with similar syntax and features to Liquid or Jinja2. homepage: http://github.com/brendanhay/ede license: OtherLicense license-file: LICENSE author: Brendan Hay maintainer: Brendan Hay <brendan.g.hay@gmail.com>-copyright: Copyright (c) 2013-2014 Brendan Hay+copyright: Copyright (c) 2013-2015 Brendan Hay stability: Experimental category: Text, Template, Web build-type: Simple@@ -42,73 +42,47 @@ type: git location: git://github.com/brendanhay/ede.git -flag build-executable- description: Whether to build the ede executable.- default: False- manual: True- library default-language: Haskell2010 hs-source-dirs: src exposed-modules:- Text.EDE- , Text.EDE.Filters+ Text.EDE+ , Text.EDE.Filters other-modules:- Text.EDE.Internal.AST- , Text.EDE.Internal.Eval- , Text.EDE.Internal.Parser- , Text.EDE.Internal.Quoting- , Text.EDE.Internal.Filters- , Text.EDE.Internal.Syntax- , Text.EDE.Internal.Types-- , Paths_ede+ Paths_ede+ , Text.EDE.Internal.AST+ , Text.EDE.Internal.Eval+ , Text.EDE.Internal.Filters+ , Text.EDE.Internal.Parser+ , Text.EDE.Internal.Quoting+ , Text.EDE.Internal.Syntax+ , Text.EDE.Internal.Types ghc-options: -Wall build-depends:- aeson >= 0.7- , ansi-wl-pprint >= 0.6.6- , base >= 4.6 && < 5- , bifunctors >= 4- , bytestring >= 0.9- , comonad >= 4.2- , directory >= 1.2- , filepath >= 1.2- , free >= 4.8- , lens >= 4.0- , mtl >= 2.2- , parsers >= 0.12.1.1- , scientific >= 0.3.1- , semigroups >= 0.15- , text >= 1.2 && < 1.3- , text-format >= 0.3- , text-manipulate >= 0.1.2- , trifecta >= 1.5.1- , unordered-containers >= 0.2.3- , vector >= 0.7.1--executable ede- default-language: Haskell2010- main-is: src/Main.hs-- ghc-options: -Wall -rtsopts "-with-rtsopts=-T -I0"-- if !flag(build-executable)- buildable: False- else- build-depends:- aeson- , base >= 4.6 && < 5- , bytestring- , conduit == 1.2.*- , conduit-extra == 1.1.*- , directory- , ede- , optparse-applicative == 0.11.*- , text+ aeson >= 0.7+ , ansi-wl-pprint >= 0.6.6+ , base >= 4.6 && < 5+ , bifunctors >= 4+ , bytestring >= 0.9+ , comonad >= 4.2+ , directory >= 1.2+ , filepath >= 1.2+ , free >= 4.8+ , lens >= 4.0+ , mtl >= 2.1.3.1+ , parsers >= 0.12.1.1+ , scientific >= 0.3.1+ , semigroups >= 0.15+ , text >= 1.2 && < 1.3+ , text-format >= 0.3+ , text-manipulate >= 0.1.2+ , trifecta >= 1.5.1+ , unordered-containers >= 0.2.3+ , vector >= 0.7.1 test-suite golden default-language: Haskell2010@@ -119,12 +93,12 @@ ghc-options: -Wall -threaded build-depends:- aeson- , base >= 4.6 && < 5- , bifunctors- , bytestring- , directory- , ede- , text- , tasty- , tasty-golden+ aeson+ , base >= 4.6 && < 5+ , bifunctors+ , bytestring+ , directory+ , ede+ , text+ , tasty+ , tasty-golden
− src/Main.hs
@@ -1,98 +0,0 @@-{-# LANGUAGE RecordWildCards #-}---- Module : Text.EDE--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>--- License : This Source Code Form is subject to the terms of--- the Mozilla Public License, v. 2.0.--- A copy of the MPL can be found in the LICENSE file or--- you can obtain it at http://mozilla.org/MPL/2.0/.--- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>--- Stability : experimental--- Portability : non-portable (GHC extensions)--module Main (main) where--import Control.Monad-import Data.Aeson-import qualified Data.ByteString.Lazy.Char8 as LBS-import Data.Conduit-import qualified Data.Conduit.Attoparsec as Conduit-import qualified Data.Conduit.Binary as Conduit-import Data.Monoid-import qualified Data.Text.Lazy.IO as Text-import Data.Version (showVersion)-import Options.Applicative-import qualified System.Directory as Dir-import qualified System.IO as IO-import qualified Text.EDE as EDE--data Options = Options- { template :: FilePath- , bindings :: Maybe Object- , alternate :: !Bool- } deriving (Eq, Show)--optionParser :: Parser Options-optionParser = Options- <$> (strOption- ( short 't'- <> long "template"- <> metavar "FILE"- <> help "ED-E template to render."- )- <|> argument str (metavar "FILE"))-- <*> optional (option (eitherReader reader)- ( short 'd'- <> long "data"- <> metavar "JSON"- <> help "Bindings to make available in the environment, as JSON. \- \If not given, standard input is read."- ))-- <*> switch- ( short 'a'- <> long "alternate-syntax"- <> help "Use alternate template syntax."- )--optionInfo :: ParserInfo Options-optionInfo = info (helper <*> optionParser)- ( fullDesc- <> header ("ed-e v" ++ showVersion EDE.version)- <> progDesc "ED-E Template Engine CLI."- )--main :: IO ()-main = execParser optionInfo >>= render- where- render Options{..} = do- t <- parse template alternate- b <- maybe stdin return bindings- EDE.result errRender Text.putStrLn (EDE.render t b)-- parse f alt = do- p <- Dir.getPermissions f- unless (Dir.readable p) (errUnreadable f)-- let syntax | alt = EDE.alternateSyntax- | otherwise = EDE.defaultSyntax-- EDE.parseFileWith syntax f >>=- EDE.result (error . show) return-- stdin = do- IO.hSetBinaryMode IO.stdin True- v <- Conduit.sourceHandle IO.stdin $$ Conduit.sinkParser json'- either (error . show) return (fromValue v)-- errRender = error . mappend "Error rendering template:\n" . show-- errUnreadable = error . (<> " is not readable")--reader :: String -> Either String Object-reader = join . fmap fromValue . eitherDecode . LBS.pack--fromValue :: Value -> Either String Object-fromValue = maybe (Left "Bindings must be given as a JSON object") Right- . EDE.fromValue
src/Text/EDE.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE TupleSections #-} -- Module : Text.EDE--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Filters.hs view
@@ -1,5 +1,5 @@ -- Module : Text.EDE.Filters--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/AST.hs view
@@ -2,7 +2,7 @@ {-# LANGUAGE TupleSections #-} -- Module : Text.EDE.Internal.AST--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/Eval.hs view
@@ -3,7 +3,7 @@ {-# LANGUAGE TupleSections #-} -- Module : Text.EDE.Internal.Eval--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or@@ -25,7 +25,7 @@ import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.List.NonEmpty as NonEmpty import Data.Monoid-import Data.Scientific (isFloating, base10Exponent)+import Data.Scientific (isFloating) import qualified Data.Text as Text import qualified Data.Text.Buildable as Build import Data.Text.Lazy.Builder (Builder)
src/Text/EDE/Internal/Filters.hs view
@@ -7,7 +7,7 @@ {-# OPTIONS_GHC -fno-warn-type-defaults #-} -- Module : Text.EDE.Internal.Filters--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/Parser.hs view
@@ -10,7 +10,7 @@ {-# LANGUAGE TemplateHaskell #-} -- Module : Text.EDE.Internal.Parser--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/Quoting.hs view
@@ -9,7 +9,7 @@ {-# OPTIONS_GHC -fno-warn-type-defaults #-} -- Module : Text.EDE.Internal.Quoting--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/Syntax.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings #-} -- Module : Text.EDE.Internal.Syntax--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or
src/Text/EDE/Internal/Types.hs view
@@ -10,7 +10,7 @@ {-# LANGUAGE TupleSections #-} -- Module : Text.EDE.Internal.Types--- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or