haskell - Generating template with some logic via HStringTemplate -
here invalid hstringtemplate syntax:
option_a = $options.a$ option_b = $options.b$ $if options.option_c_is_needed$ option_c = $option.c$ $end$ in other words, part of template file should created if specific predicate true. how can achieved via hstringtemplate? if there no way in it, libraries helpful here?
may there analog of erubis mechanism ability use haskell code inside template files?
hammar's comment correct. see below:
*main text.stringtemplate> render $ setattribute "optset" false $ (newstmp "optset: $if(optset)$option set$else$option isn't set$endif$" :: stringtemplate string) "optset: option isn't set" *main text.stringtemplate> render $ setattribute "optset" true $ (newstmp "optset: $if(optset)$option set$else$option isn't set$endif$" :: stringtemplate string) "optset: option set"
Comments
Post a Comment