How do I make EEx output multi-line strings, while being indentation aware?
template = """
<%= multi_line_text_with_indentation %>
<%= multi_line_text_with_indentation %>
<%= multi_line_text_with_indentation %>
"""
text = """
hello
cruel
world
"""
template
|> EEx.eval_string([multi_line_text_with_indentation: text])
|> IO.puts()
The actual output is:
hello
cruel
world
hello
cruel
world
hello
cruel
world
The expected output in this case would be:
hello
cruel
world
hello
cruel
world
hello
cruel
world
There appears to be :indentation
option available to all functions in EEx module (including eval_string
function), yet I find myself failing to employ it to add indentation to strings eval
ed inside a template.
It looks to me I am missing something very obvious here