Popularity
7.6
Growing
Activity
0.0
Stable
15
5
11
Monthly Downloads: 28
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Latest version: v0.2
template alternatives and similar packages
Based on the "Template" category.
Alternatively, view template alternatives based on common mentions on social networks and blogs.
-
ede
Templating language with similar syntax and features to Liquid or Jinja2. -
template-hsml
Haskell's Simple Markup Language (http://palmik.net/2012/08/introducing-hsml/)
Clean code begins in your IDE with SonarLint
Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.
Promo
www.sonarlint.org
Do you think we are missing an alternative of template or a related project?
README
Template strings
Simple string substitution library that supports \"$\"-based
substitution. Meant to be used when Text.Printf
or string
concatenation would lead to code that is hard to read but when a full
blown templating system is overkill.
Usage example:
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.ByteString.Lazy as S
import qualified Data.Text as T
import qualified Data.Text.Lazy.Encoding as E
import Data.Text.Template
-- | Create 'Context' from association list.
context :: [(T.Text, T.Text)] -> Context
context assocs x = maybe err id . lookup x $ assocs
where err = error $ "Could not find key: " ++ T.unpack x
main :: IO ()
main = S.putStr $ E.encodeUtf8 $ substitute helloTemplate helloContext
where
helloTemplate = "Hello, $name!\n"
helloContext = context [("name", "Joe")]