arnaud-lb / MtHaml

Multi target HAML (HAML for PHP, Twig, <your language here>)
Other
359 stars 54 forks source link

First stab at improving whitespace handling. #54

Open chrisrichard opened 10 years ago

chrisrichard commented 10 years ago

These rules are helping in my case but still leave something to be desired. Unclear about the possibility of accessing rendered content of a previous sibling if statement, for eg.

arnaud-lb commented 10 years ago

Great!

The "Printer" NodeVisitor may helper understanding how different nodes are used, depending on the input (see test/MtHaml/Tests/fixtures/parser/*.test for examples).

Also wondering about the feasibility of detecting whether a particular node is really the first child when there are conditional/loop statements as siblings. I assume this isn't easily/possible?

I can't figure a way of doing that reliably at compile time, sadly. This is possible at runtime, though. E.g. by using a filter to trim leading/trailing whitespaces, or outputing code that conditionally displays the leading linebreak.

arnaud-lb commented 10 years ago

Related: #53