mustache icon indicating copy to clipboard operation
mustache copied to clipboard

Make tests pass specification

Open alexkappa opened this issue 10 years ago • 1 comments

In order to release this package with a degree of confidence, I would like to make sure that a significant amount (if not all) of specification tests can pass.

Currently most tests fail simply due to the fact that the output contains more newlines as the expectation. The spec states that if a line of text only contains whitespace and a mustache tag such as a comment or a section, this line should be omitted from the output.

alexkappa avatar Dec 07 '14 19:12 alexkappa

I suspect the easiest way to be aware of lines with only a standalone tag, is to improve the lexer to emit new lines as separate tokens and during rendering we could look back and see if the previous nodes until the last line had nodes that affected the output.

E.g. [textToken "\n", sectionToken "foo", textToken "\n"] should not render anything while [textToken "\n", sectionToken "foo", textToken "some text here", textToken "\n"] should render both text and new lines.

alexkappa avatar Dec 10 '14 21:12 alexkappa