blob: e9468889c05dcc68761384e4b558a46aeda7872e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import gleam/list
import gleam/string
pub fn render(
template: String,
substitutions: List(#(String, String)),
) -> String {
substitutions
|> list.fold(
template,
fn(template, substitution) {
let #(name, value) = substitution
template
|> string.replace("{{ " <> name <> " }}", value)
},
)
|> string.trim <> "\n"
}
|