I'm reading a key/value pair from a table which is denoted as such:
fruit:${my_fruit} in the FOOD column.
In my Freemarker code, I have, say:
<#assign my_fruit = "banana">
I want to wind up with the equivalent of
<#assign fruit = ${my_fruit}> executed.
I've tried many variations of
<#fruit_list = "${FOOD}"!?split(":")>
<#assign fruit_raw = r"<#assign " + "${fruit_list[0]}" + r"='" + "${fruit_list[1]}" + r"'>">
<#assign fruit_int = fruit_raw?interpret>
<@fruit_int?exec/>
Can anyone tell me where I'm going wrong? Many thanks.
This seems to work: