packages feed

stache 0.1.4 → 0.1.5

raw patch · 4 files changed

+25/−12 lines, 4 filesdep ~aesondep ~hspec-megaparsecdep ~stache

Dependency ranges changed: aeson, hspec-megaparsec, stache

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+## Stache 0.1.5++* When section's key is a number or non-empty string, it's accessible as `.`+  in the section body.++* Allow Aeson 1.0.+ ## Stache 0.1.4  * Numbers are now treated as “true” values.
Text/Mustache/Render.hs view
@@ -85,13 +85,11 @@   enterSection k $     unless (isBlank val) $       case val of-        Object _ ->-          addToLocalContext val (renderMany renderNode ns)         Array xs ->           forM_ (V.toList xs) $ \x ->             addToLocalContext x (renderMany renderNode ns)         _ ->-          renderMany renderNode ns+          addToLocalContext val (renderMany renderNode ns) renderNode (InvertedSection k ns) = do   val <- lookupKey k   when (isBlank val) $
stache.cabal view
@@ -31,7 +31,7 @@ -- POSSIBILITY OF SUCH DAMAGE.  name:                 stache-version:              0.1.4+version:              0.1.5 cabal-version:        >= 1.10 license:              BSD3 license-file:         LICENSE.md@@ -59,7 +59,7 @@   default:            False  library-  build-depends:      aeson            >= 0.11 && < 0.12+  build-depends:      aeson            >= 0.11 && < 1.1                     , base             >= 4.7  && < 5.0                     , bytestring       >= 0.10 && < 0.11                     , containers       >= 0.5  && < 0.6@@ -91,13 +91,13 @@   main-is:            Spec.hs   hs-source-dirs:     tests   type:               exitcode-stdio-1.0-  build-depends:      aeson            >= 0.11 && < 0.12+  build-depends:      aeson            >= 0.11 && < 1.1                     , base             >= 4.7  && < 5.0                     , containers       >= 0.5  && < 0.6                     , hspec            >= 2.0  && < 3.0                     , hspec-megaparsec >= 0.2  && < 0.3                     , megaparsec       >= 5.0  && < 6.0-                    , stache           >= 0.1.4+                    , stache           >= 0.1.5                     , text             >= 1.2  && < 1.3   other-modules:      Text.Mustache.Compile.THSpec                     , Text.Mustache.ParserSpec@@ -115,14 +115,14 @@   main-is:            Spec.hs   hs-source-dirs:     mustache-spec   type:               exitcode-stdio-1.0-  build-depends:      aeson            >= 0.11 && < 0.12+  build-depends:      aeson            >= 0.11 && < 1.1                     , base             >= 4.7  && < 5.0                     , bytestring       >= 0.10 && < 0.11                     , containers       >= 0.5  && < 0.6                     , file-embed                     , hspec            >= 2.0  && < 3.0                     , megaparsec       >= 5.0  && < 6.0-                    , stache           >= 0.1.4+                    , stache           >= 0.1.5                     , text             >= 1.2  && < 1.3                     , yaml             >= 0.8  && < 0.9   if flag(dev)@@ -140,7 +140,7 @@                     , criterion        >= 0.6.2.1 && < 1.2                     , deepseq          >= 1.4  && < 1.5                     , megaparsec       >= 5.0  && < 6.0-                    , stache           >= 0.1.4+                    , stache           >= 0.1.5                     , text             >= 1.2  && < 1.3   if flag(dev)     ghc-options:      -Wall -Werror
tests/Text/Mustache/RenderSpec.hs view
@@ -76,16 +76,24 @@         it "renders the section many times changing context" $           r nodes (object ["foo" .= [object ["bar" .= x] | x <- [1..4] :: [Int]]])             `shouldBe` "1*2*3*4*"-      context "when the key is a number" $+      context "when the key is a number" $ do         it "renders the section" $           r [Section (key "foo") [TextBlock "brr"]]             (object ["foo" .= (5 :: Int)])             `shouldBe` "brr"-      context "when the key is a non-empty string" $+        it "uses the key as context" $+          r [Section (key "foo") [EscapedVar (Key [])]]+            (object ["foo" .= (5 :: Int)])+            `shouldBe` "5"+      context "when the key is a non-empty string" $ do         it "renders the section" $           r [Section (key "foo") [TextBlock "brr"]]             (object ["foo" .= ("x" :: Text)])             `shouldBe` "brr"+        it "uses the key as context" $+          r [Section (key "foo") [EscapedVar (Key [])]]+            (object ["foo" .= ("x" :: Text)])+            `shouldBe` "x"   context "when rendering an inverted section" $ do     let nodes = [InvertedSection (key "foo") [TextBlock "Here!"]]     context "when the key is not present" $