1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
-----------------------------------------------------------------------------
-- |
-- Module : Text.StringTemplate
-- Copyright : (c) Sterling Clover 2008
-- License : BSD 3 Clause
-- Maintainer : s.clover@gmail.com
-- Stability : experimental
-- Portability : portable
--
-- A StringTemplate is a String with \"holes\" in it.
-- This is a port of the Java StringTemplate library written by Terrence Parr.
-- (<http://www.stringtemplate.org>). User-contributed documentation available at
-- <http://www.haskell.org/haskellwiki/HStringTemplate>.
--
-- This library implements the basic 3.1 grammar, lacking group files
-- (though not groups themselves), Regions, and Interfaces.
-- The goal is not to blindly copy the StringTemplate API, but rather to
-- take its central ideas and implement them in a Haskellish manner.
-- Indentation and wrapping, for example, are implemented through the
-- HughesPJ Pretty Printing library. Calling toPPDoc on a StringTemplate
-- yields a Doc with appropriate paragraph-fill wrapping that can be
-- rendered in the usual fashion.
--
-- Basic instances are provided of the StringTemplateShows and ToSElem class.
-- Any type deriving ToSElem can be passed automatically as a StringTemplate
-- attribute. This package can be installed with syb-with-class bindings
-- that provide a ToSElem instance for anything deriving
-- 'Data.Generics.SYB.WithClass.Basics.Data'. When defining an instance of
-- ToSElem that can take a format parameter, you should first define an
-- instance of StringTemplateShows, and then define an instance of ToSElem
-- where @ toSElem = stShowsToSE@.
-----------------------------------------------------------------------------
module Text.StringTemplate (
-- * Types
StringTemplate, STGroup,
-- * Classes
ToSElem(..), StringTemplateShows(..), stShowsToSE, Stringable(..), SEType(..),
-- * Creation
newSTMP, newAngleSTMP, getStringTemplate, getStringTemplate',
-- * Display
toString, toPPDoc, render, dumpAttribs, checkTemplate, checkTemplateDeep,
-- * Modification
setAttribute, (|=), setManyAttrib,
setNativeAttribute, setManyNativeAttrib,
withContext,
optInsertTmpl, optInsertGroup,
setEncoder, setEncoderGroup,
-- * Groups
groupStringTemplates, addSuperGroup, addSubGroup,
mergeSTGroups, directoryGroup, directoryGroupExt,
unsafeVolatileDirectoryGroup,
directoryGroupRecursive, directoryGroupRecursiveLazy,
directoryGroupRecursiveExt, directoryGroupRecursiveLazyExt,
directoryGroupLazy, directoryGroupLazyExt, nullGroup
) where
import Text.StringTemplate.Base
import Text.StringTemplate.Group
import Text.StringTemplate.Renderf
import Text.StringTemplate.Instances()
|