I haven't yet been able to solve this.
The following interpreted splices render as expected. So, rephrasing my question: ¿How can I reproduce the following behaviour using compiled splices?
getPeople :: Handler b App [(T.Text,Int)]
getPeople = return [("Bob",20), ("Jon",70)]
-- ^suppose these values, here hardcoded, can only be
-- obtained during runtime
listNamesSpliceI :: I.Splice (Handler b App)
listNamesSpliceI = I.mapSplices sp =<< lift getPeople
where sp (name,age) = I.runChildrenWithText
[("name", name), ("age" , T.pack . show $ age)]
greetSpliceI :: Monad m => I.Splice m
greetSpliceI = do
Just who <- X.getAttribute "who" `liftM` getParamNode
return [X.TextNode $ "Hello " <> who <> "!"]
I then add those splices to my `HeistConfig`'s `hcInterpretedSplices` as:
[ ("list-names", listNamesSpliceI), ("greet", greetSpliceI) ]
The template is the same as before:
<ul>
<li><greet who="Hardcoded"/></li>
<list-names>
<li><greet who="Mr. ${name}"/> You are <age/> years old.</li>
</list-names>
</ul>
And the result, as expected:
<ul>
<li>Hello Hardcoded!</li>
<li>Hello Mr. Bob! You are 20 years old.</li>
<li>Hello Mr. Jon! You are 70 years old.</li>
</ul>
I'm using Heist-0.11.1.
Regards,
Renzo.