Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Interpose a new line between children
Browse files Browse the repository at this point in the history
Fixes #29
  • Loading branch information
mquandalle committed May 21, 2014
1 parent 0391aba commit c993807
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugin/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ _.extend(Compiler.prototype, {
if (! HTML.isTagEnsured(tagName))
self.throwError("Unknow tag: " + tagName, node);

// Interpose a new line between children
for (var i = content.length - 1; i > 0; i--)
content.splice(i, 0, "\n");

if (! _.isEmpty(attrs))
content.unshift(attrs);

Expand Down
3 changes: 3 additions & 0 deletions tests/match.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

<template name="match-html-justText">Hello world</template>

<template name="match-html-multipleChildren"><p>Hello
world</p></template>


<!-- Template helpers -->

Expand Down
5 changes: 5 additions & 0 deletions tests/match.jade
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ template(name="match-jade-justText-1")
//- template(name="match-jade-justText-3")
//- = 'Hello world'
template(name="match-jade-multipleChildren")
p
| Hello
| world

//- Template helpers
template(name="match-jade-tagHelper")
Expand Down

0 comments on commit c993807

Please sign in to comment.