HSmarty alternatives and similar packages
Based on the "Text" category.
Alternatively, view HSmarty alternatives based on common mentions on social networks and blogs.
-
pandoc-citeproc
Library and executable for using citeproc with pandoc -
scholdoc
Fork of Pandoc for the implementation of a ScholarlyMarkdown parser -
skylighting
A Haskell syntax highlighting library with tokenizers derived from KDE syntax highlighting descriptions -
blaze-from-html
A blazingly fast HTML combinator library for Haskell. -
prettyprinter
A modern, extensible and well-documented prettyprinter. -
commonmark
Pure Haskell commonmark parsing library, designed to be flexible and extensible -
regex-genex
Given a list of regexes, generate all possible strings that matches all of them. -
regex-applicative
Regex-based parsing with an applicative interface -
pandoc-csv2table
A Pandoc filter that renders CSV as Pandoc Markdown Tables. -
servant-checked-exceptions
type-level errors for Servant APIs. -
pretty-show
Tools for working with derived Show instances in Haskell. -
double-conversion
A fast Haskell library for converting between double precision floating point numbers and text strings. It is implemented as a binding to the V8-derived C++ double-conversion library. -
text-format
A Haskell text formatting library optimized for ease of use and high performance. -
diagrams-pandoc
A pandoc filter to express diagrams inline using the haskell EDSL diagrams. -
blaze-markup
Core modules for a blazing fast markup combinator library
InfluxDB - Power Real-Time Data Analytics at Scale
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of HSmarty or a related project?
README
HSmarty
Haskell implementation of a subset of the PHP-Smarty template language.
Usage
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Text.HSmarty
import qualified Data.HashMap.Strict as HM
import qualified Data.Text as T
main :: IO ()
main =
renderTemplate "test.tpl" $
HM.fromList [ ( "title", mkParam ("SomeTitle" :: T.Text))
, ( "list", mkParam (["a", "b"] :: [T.Text]))
]
Implemented features
- Basic template parsing (See Basic Syntax)
- Smarty comments
- Basic expressions (eg.
$var
,$var.mapItem
,$var[3]
,$var@property
,3+4
, ..) - Branching (eg.
{if ..}
,{elseif ..}
,{else}
, ..) - Looping with properties (eg.
{foreach $el as $k=>$v}
,{$v@last}
,{foreachelse}
,{/foreach}
) - Including other templates (
{include file='other.tpl'}
) - Defining functions (
{function name='foo'}...{/function}
) - Calling functions (
{foo arg1="bar"}
) - Assigning variables (
{$foo=1+2+3}
) - Capturing output into variables (
{capture name='blabla'}<b>{$some}</b>{/capture}
)
Non-Smarty features
- Explicit scoping blocks (
{scope}{$localFoo=123}{$localFoo}{/scope}{* $localFoo not available here! *}
)
Contributing
All constributions adding features of the "original" PHP-Smarty V3 are welcome. For any other contributions please discuss in an issue first. Note that by sending a PR you agree that all your code can be released under the BSD3 license as part of this project or otherwise.
*Note that all licence references and agreements mentioned in the HSmarty README section above
are relevant to that project's source code only.