Open daig opened 7 years ago
Hi @daig the short answer is that this is tricky to implement.
The detailed answer follows:
I'm currently using htmlparser2 to parse the Elmx (as HTML) into an AST and then from there generate the Elm code. The pro of this approach is that it keeps the elmx
code small, the trade-off is that invalid HTML might break the parser and yield the wrong results (like in your example above).
Of course, this a sub-optimal implementation since not every Elmx needs to be a valid HTML, but it was a pragmatic decision (that we can review provided we find a better parser or an alternative approach).
For the time being, you can overcome this limitation by rewriting this:
<ul>{:notes |> List.map (\ note -> <li>{view note}</li>)}</ul>
like this:
let
items = notes |> List.map (\ note -> <li>{view note}</li>)
in
<ul>{:items}</ul>
Cheers!
Hi, great library! Sometimes I'd like to nest Elmx syntax, for example when mapping over children:
but this doesn't get the right result. Is there a fundamental barrier to nesting, or is it just extra tricky to implement?