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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Socket.connect doesn't throw exception in Android -

SPSS keyboard combination alters encoding -