packages feed

glabrous 2.0.5 → 2.0.6

raw patch · 4 files changed

+20/−11 lines, 4 filesdep ~bytestringdep ~textPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: bytestring, text

API changes (from Hackage documentation)

+ Text.Glabrous.Types: fromJSONString :: (Text, Value) -> (Text, Text)

Files

README.md view
@@ -1,5 +1,6 @@-# Glabrous [![Build Status](https://travis-ci.org/MichelBoucey/glabrous.svg?branch=master)](https://travis-ci.org/MichelBoucey/glabrous)+# Glabrous ![CI](https://github.com/MichelBoucey/glabrous/actions/workflows/haskell-ci.yml/badge.svg)  Glabrous is a minimalistic Mustache-like syntax - using only the simplest Mustache tag: {{name}} -, truly logic-less, HTML agnostic pure Text template DSL library.  Any improvement is welcome.+
glabrous.cabal view
@@ -1,5 +1,5 @@ name:                glabrous-version:             2.0.5+version:             2.0.6 synopsis:            A template DSL library description:         A minimalistic, Mustache-like syntax, truly logic-less,                      pure Text template DSL library@@ -8,13 +8,13 @@ license-file:        LICENSE author:              Michel Boucey maintainer:          michel.boucey@gmail.com-copyright:           (c) 2016-2021 - Michel Boucey+copyright:           (c) 2016-2022 - Michel Boucey category:            Text, Web build-type:          Simple cabal-version:       >=1.10 extra-source-files:  README.md -Tested-With: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.1 || ==8.10.4 || ==9.0.1+Tested-With: GHC ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.1 || ==9.2.1  source-repository head   type:     git@@ -29,11 +29,11 @@                      , aeson-pretty >= 0.7.2 && < 0.9                      , attoparsec >= 0.12.1.6 && < 0.15                      , base >= 4.8.1.0 && < 5-                     , bytestring >= 0.10.6 && < 0.11+                     , bytestring >= 0.10.6 && < 0.12                      , cereal >= 0.4.1.1 && < 0.6                      , cereal-text >= 0.1.0 && < 0.2                      , either >= 4.4.1 && < 5.1-                     , text >= 1.2.1 && < 1.3+                     , text >= 1.2.1 && < 1.3 || == 2.0.*                      , unordered-containers >= 0.2.5.1 && < 0.3    default-language:    Haskell2010@@ -48,7 +48,7 @@                      , either >= 4.4.1 && < 5.1                      , glabrous                      , hspec >= 2.1.10 && < 3-                     , text >= 1.2.1 && < 1.3+                     , text >= 1.2.1 && < 1.3 || == 2.0.*                      , unordered-containers == 0.2.*   default-language:    Haskell2010 
src/Text/Glabrous.hs view
@@ -161,7 +161,11 @@  -- | Build an unset ad hoc 'Context' from the given 'Template'. fromTemplate :: Template -> Context-fromTemplate t = setVariables ((\(Tag e) -> (e,T.empty)) <$> tagsOf t) initContext+fromTemplate t =+  setVariables (toPair <$> tagsOf t) initContext+  where+    toPair (Tag e) = (e,T.empty)+    toPair _       = undefined  -- | Get a 'Context' from a JSON file. readContextFile :: FilePath -> IO (Maybe Context)
src/Text/Glabrous/Types.hs view
@@ -6,7 +6,7 @@  import           Data.Aeson #if MIN_VERSION_aeson(2,0,0)-import qualified Data.Aeson.KeyMap    as KM+import qualified Data.Aeson.KeyMap   as KM #endif import qualified Data.HashMap.Strict as H import qualified Data.Text           as T@@ -45,9 +45,9 @@ instance FromJSON Context where   parseJSON (Object o) = return #if MIN_VERSION_aeson(2,0,0)-    Context { variables = H.fromList ((\(k,String v) -> (k,v)) <$> H.toList (KM.toHashMapText o)) }+    Context { variables = H.fromList (fromJSONString <$> H.toList (KM.toHashMapText o)) } #else-    Context { variables = H.fromList ((\(k,String v) -> (k,v)) <$> H.toList o) }+    Context { variables = H.fromList (fromJSONString <$> H.toList o) } #endif   parseJSON _          = fail "expected an object" @@ -55,4 +55,8 @@   = Final !T.Text   | Partial { template :: !Template, context :: !Context }   deriving (Eq, Show)++fromJSONString :: (T.Text,Value) -> (T.Text,T.Text)+fromJSONString (k,String v) = (k,v)+fromJSONString (_,_)        = undefined