File tree Expand file tree Collapse file tree
main/java/com/github/jknack/handlebars/internal
java/com/github/jknack/handlebars/issues
resources/com/github/jknack/handlebars Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,6 +136,10 @@ public void enterUnless(final UnlessContext ctx) {
136136 hasTag (true );
137137 }
138138
139+ @ Override public void enterElseBlock (HbsParser .ElseBlockContext ctx ) {
140+ hasTag (true );
141+ }
142+
139143 @ Override
140144 public void exitUnless (final UnlessContext ctx ) {
141145 hasTag (true );
Original file line number Diff line number Diff line change 1+ package com .github .jknack .handlebars .issues ;
2+
3+ import com .github .jknack .handlebars .Handlebars ;
4+ import com .github .jknack .handlebars .v4Test ;
5+ import org .junit .Test ;
6+
7+ import java .io .IOException ;
8+
9+ public class Issue584 extends v4Test {
10+
11+ @ Override protected void configure (Handlebars handlebars ) {
12+ handlebars .setPrettyPrint (true );
13+ }
14+
15+ @ Test
16+ public void shouldRemoveBlankAroundElse ()
17+ throws IOException {
18+ shouldCompileTo ("A\n "
19+ + "{{#if someVariableWhichIsFalse}}\n "
20+ + "B\n "
21+ + "{{else}}\n "
22+ + "C\n "
23+ + "{{/if}}\n "
24+ + "D" , $ , "A\n "
25+ + "C\n "
26+ + "D" );
27+
28+ shouldCompileTo ("A\n "
29+ + "{{#if someVariableWhichIsFalse}}\n "
30+ + "B\n "
31+ + "{{^}}\n "
32+ + "C\n "
33+ + "{{/if}}\n "
34+ + "D" , $ , "A\n "
35+ + "C\n "
36+ + "D" );
37+ }
38+
39+ }
Original file line number Diff line number Diff line change @@ -179,7 +179,6 @@ tests:
179179
180180 expected : |
181181 <div class="entry">
182-
183182 <h1>Unknown Author</h1>
184183 </div>
185184
You can’t perform that action at this time.
0 commit comments