-
-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support passing hash to partials fix #357
- Loading branch information
Showing
4 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,7 +116,7 @@ delimiters | |
|
||
partial | ||
: | ||
START_PARTIAL PATH QID? END | ||
START_PARTIAL PATH QID? hash* END | ||
; | ||
|
||
param | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
handlebars/src/test/java/com/github/jknack/handlebars/i350/Issue350.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.github.jknack.handlebars.i350; | ||
|
||
import java.io.IOException; | ||
|
||
import org.junit.Test; | ||
|
||
import com.github.jknack.handlebars.AbstractTest; | ||
import com.github.jknack.handlebars.Handlebars; | ||
|
||
public class Issue350 extends AbstractTest { | ||
|
||
@Override | ||
protected void configure(final Handlebars handlebars) { | ||
handlebars.prettyPrint(true); | ||
} | ||
|
||
@Test | ||
public void partialWithParameters() throws IOException { | ||
shouldCompileToWithPartials( | ||
"<ul>\n" + | ||
"{{#each dudes}}\n" + | ||
" {{> dude title=../title class=\"list-item\"}}\n" + | ||
"{{/each}}\n" + | ||
"</ul>", | ||
$("title", | ||
"profile", | ||
"dudes", | ||
new Object[]{$("name", "Yehuda", "url", "http://yehuda"), | ||
$("name", "Alan", "url", "http://alan") }), | ||
$("dude", "<li class=\"{{class}}\">\n" + | ||
" {{title}}: <a href=\"{{url}}\">{{name}}</a>\n" + | ||
"</li>\n"), | ||
"<ul>\n" + | ||
" <li class=\"list-item\">\n" + | ||
" profile: <a href=\"http://yehuda\">Yehuda</a>\n" + | ||
" </li>\n" + | ||
" <li class=\"list-item\">\n" + | ||
" profile: <a href=\"http://alan\">Alan</a>\n" + | ||
" </li>\n" + | ||
"</ul>"); | ||
} | ||
} |
1fa4bf5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍