mustache 2.2.3 → 2.3.0
raw patch · 4 files changed
+128/−117 lines, 4 filesdep ~aesondep ~basedep ~either
Dependency ranges changed: aeson, base, either, text, unordered-containers
Files
- CHANGELOG.md +5/−0
- mustache.cabal +117/−110
- src/Text/Mustache.hs +1/−1
- src/Text/Mustache/Compile.hs +5/−6
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Mustache library changelog +## v2.3.0++- Changed `EitherT` to `ExceptT` (deprecation)+- removed `getFile` from public API+ ## v2.2.3 - Quick fix to prevent catchSubstitute from reporting substitutions to the renderer.
mustache.cabal view
@@ -1,121 +1,128 @@-name: mustache-version: 2.2.3-synopsis: A mustache template parser library.-description:- Allows parsing and rendering template files with mustache markup. See the- mustache <http://mustache.github.io/mustache.5.html language reference>.- .- Implements the mustache spec version 1.1.3.- .- /Note/: Versions including and beyond 0.4 are compatible with ghc 7.8 again.-license: BSD3-license-file: LICENSE-author: Justus Adam-maintainer: dev@justus.science-homepage: https://github.com/JustusAdam/mustache-bug-reports: https://github.com/JustusAdam/mustache/issues-copyright: (c) 2015, 2016 Justus Adam-category: Development-build-type: Simple-extra-source-files: README.md- , CHANGELOG.md- , test/unit/examples/*.txt.mustache- , test/unit/examples/partials/*.txt.mustache-cabal-version: >=1.10-tested-with: GHC >=7.8 && <= 7.10.2+-- This file has been generated from package.yaml by hpack version 0.17.1.+--+-- see: https://github.com/sol/hpack +name: mustache+version: 2.3.0+synopsis: A mustache template parser library.+description: Allows parsing and rendering template files with mustache markup. See the+ mustache <http://mustache.github.io/mustache.5.html language reference>.+ .+ Implements the mustache spec version 1.1.3.+ .+ /Note/: Versions including and beyond 0.4 are compatible with ghc 7.8 again.+category: Development+homepage: https://github.com/JustusAdam/mustache+bug-reports: https://github.com/JustusAdam/mustache/issues+author: Justus Adam+maintainer: dev@justus.science+copyright: (c) 2015,+ 2016 Justus Adam+license: BSD3+license-file: LICENSE+tested-with: GHC>=7.8 && <=7.10.2+build-type: Simple+cabal-version: >= 1.10 +extra-source-files:+ CHANGELOG.md+ README.md+ test/unit/examples/partials/test-partial.txt.mustache+ test/unit/examples/test-template-partials.txt.mustache+ test/unit/examples/test-template.txt.mustache+ source-repository head- type: git+ type: git location: git://github.com/JustusAdam/mustache.git - library- exposed-modules: Text.Mustache- , Text.Mustache.Types- , Text.Mustache.Parser- , Text.Mustache.Compile- , Text.Mustache.Render- other-modules: Text.Mustache.Internal- , Text.Mustache.Internal.Types- other-extensions: NamedFieldPuns- , OverloadedStrings- , LambdaCase- , TupleSections- , TemplateHaskell- , QuasiQuotes- build-depends: base >=4.7 && <5- , text- , parsec- , mtl >= 2.2.1- , either- , aeson- , unordered-containers- , vector- , bytestring- , directory- , filepath- , scientific- , containers- , template-haskell- , th-lift- hs-source-dirs: src- default-language: Haskell2010- ghc-options:- -Wall- default-extensions: LambdaCase- , TupleSections-+ hs-source-dirs:+ src+ default-extensions: LambdaCase TupleSections+ other-extensions: NamedFieldPuns OverloadedStrings LambdaCase TupleSections TemplateHaskell QuasiQuotes+ ghc-options: -Wall+ build-depends:+ base >=4.7 && <5+ , text+ , aeson+ , bytestring+ , filepath+ , parsec+ , mtl >=2.2.1+ , either+ , unordered-containers+ , vector+ , directory+ , scientific+ , containers+ , template-haskell+ , th-lift+ exposed-modules:+ Text.Mustache+ Text.Mustache.Types+ Text.Mustache.Parser+ Text.Mustache.Compile+ Text.Mustache.Render+ other-modules:+ Text.Mustache.Internal+ Text.Mustache.Internal.Types+ Paths_mustache+ default-language: Haskell2010 executable haskell-mustache- main-is: Main.hs- build-depends: base >=4.7 && <5- , mustache- , bytestring- , yaml- , aeson- , cmdargs- , text- , filepath- default-language: Haskell2010- ghc-options: -threaded -Wall- hs-source-dirs: app+ main-is: Main.hs+ hs-source-dirs:+ app+ ghc-options: -threaded -Wall+ build-depends:+ base >=4.7 && <5+ , text+ , aeson+ , bytestring+ , filepath+ , mustache+ , yaml+ , cmdargs+ default-language: Haskell2010 +test-suite language-specifications+ type: exitcode-stdio-1.0+ main-is: Language.hs+ hs-source-dirs:+ test/integration+ build-depends:+ base >=4.7 && <5+ , text+ , aeson+ , bytestring+ , filepath+ , hspec+ , mustache+ , unordered-containers+ , yaml+ , base-unicode-symbols+ , wreq+ , zlib+ , tar+ , lens+ default-language: Haskell2010 test-suite unit-tests- main-is: Spec.hs- type: exitcode-stdio-1.0- build-depends: base >=4.7 && <5- , hspec- , text- , mustache- , aeson- , unordered-containers- , yaml- , filepath- , process- , temporary- , directory- hs-source-dirs: test/unit- default-language: Haskell2010---test-suite language-specifications- main-is: Language.hs- type: exitcode-stdio-1.0- build-depends: base >=4.7 && <5- , hspec- , text- , mustache- , aeson- , unordered-containers- , yaml- , filepath- , base-unicode-symbols- , wreq- , zlib- , tar- , lens- , bytestring- hs-source-dirs: test/integration- default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs:+ test/unit+ build-depends:+ base >=4.7 && <5+ , text+ , aeson+ , bytestring+ , filepath+ , hspec+ , mustache+ , unordered-containers+ , yaml+ , process+ , temporary+ , directory+ default-language: Haskell2010
src/Text/Mustache.hs view
@@ -131,7 +131,7 @@ Subsequenty the 'STree' of the template is scanned for included partials, any present 'TemplateCache' is queried for the partial ('compileTemplateWithCache'),-if not found it will be searched for in the @searchSpache@, compiled and+if not found it will be searched for in the @searchSpace@, compiled and inserted into the template's own cache as well as the global cache for the compilation process.
src/Text/Mustache/Compile.hs view
@@ -12,7 +12,7 @@ {-# LANGUAGE TemplateHaskell #-} module Text.Mustache.Compile ( automaticCompile, localAutomaticCompile, TemplateCache, compileTemplateWithCache- , compileTemplate, cacheFromList, getPartials, getFile, mustache, embedTemplate, embedSingleTemplate+ , compileTemplate, cacheFromList, getPartials, mustache, embedTemplate, embedSingleTemplate ) where @@ -20,7 +20,6 @@ import Control.Monad import Control.Monad.Except import Control.Monad.State-import Control.Monad.Trans.Either import Data.Bool import Data.HashMap.Strict as HM import Data.Text hiding (concat, find, map, uncons)@@ -67,12 +66,12 @@ -> FilePath -> IO (Either ParseError Template) compileTemplateWithCache searchSpace templates initName =- runEitherT $ evalStateT (compile' initName) $ flattenPartials templates+ runExceptT $ evalStateT (compile' initName) $ flattenPartials templates where compile' :: FilePath -> StateT (HM.HashMap String Template)- (EitherT ParseError IO)+ (ExceptT ParseError IO) Template compile' name' = do templates' <- get@@ -81,7 +80,7 @@ Nothing -> do rawSource <- lift $ getFile searchSpace name' compiled@(Template { ast = mSTree }) <-- lift $ hoistEither $ compileTemplate name' rawSource+ lift $ ExceptT . pure $ compileTemplate name' rawSource foldM (\st@(Template { partials = p }) partialName -> do@@ -135,7 +134,7 @@ This trows 'ParseError's to be compatible with the internal Either Monad of 'compileTemplateWithCache'. -}-getFile :: [FilePath] -> FilePath -> EitherT ParseError IO Text+getFile :: [FilePath] -> FilePath -> ExceptT ParseError IO Text getFile [] fp = throwError $ fileNotFound fp getFile (templateDir : xs) fp = lift (doesFileExist filePath) >>=