My question is regarding the temple dsl.
The typical way to render a template is like so -
temple do
div class: "px-4 my-4", id: "holder", "data-a1": "something" do
p do: "Hello World!"
end
end
Now the way temple works is each node (div, p) etc take a keyword list as a parameter.
My requirement is that I want to create the list of attributes dynamically and then pass it to the div macro.
For ex
attrs = ["class": "px-4 my-4", "id": "holder", "data-a1": "something", "data-a2": "something else"]
and then pass it to the div like so
temple do
div attrs do
p do: "Hello World!"
end
end
But the above gives a runtime error. List cannot be converted into string.
Please advice what I am doing wrong and how to correct it.
Thank you so much!