breuleux / earl-grey

Programming language compiling to JavaScript
http://breuleux.github.io/earl-grey/
MIT License
464 stars 6 forks source link

% operator behavior does not match documentation #34

Closed TamsynUlthara closed 8 years ago

TamsynUlthara commented 8 years ago

The % operator's behavior doesn't match the documentation.

The docs give this example:

node =
   div#main %
      "Some text"
      strong % 1234
      a.large.red %
         href = "http://example.com"
         "stuff"

require: /html
html(node)

... which should result in this HTML:

<div id="main">
  Some text
  <strong>1234</strong>
  <a class="large blue" href="http://example.com">stuff</a>
</div>

Instead, it results in this HTML:

<main id="">
  Some text
  <strong>1234</strong>
  <a href="http://example.com" class="large red">stuff</a>
</main>

(Edited to add: Just to be clear, the chief problem here is that the % operator is fumbling div#main syntax. The blue/red difference is just a doc error, not a code error.)

breuleux commented 8 years ago

Yeah, I know, I've been lazy about fixing this. In the meantime, it'll work if you do div[#main].