Skip to content

Commit

Permalink
Merge pull request #68 from aisbergg/feat-unless-else
Browse files Browse the repository at this point in the history
Allow unless to have an else clause
  • Loading branch information
danog authored Aug 23, 2023
2 parents 66a8e52 + 1930c96 commit 919a6d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions tags/control_flow_tags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var cfTagTests = []struct{ in, expected string }{
// unless
{`{% unless true %}false{% endunless %}`, ""},
{`{% unless false %}true{% endunless %}`, "true"},
{`{% unless true %}true{% else %}false{% endunless %}`, "false"},
}

var cfTagCompilationErrorTests = []struct{ in, expected string }{
Expand Down
2 changes: 1 addition & 1 deletion tags/standard_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func AddStandardTags(c render.Config) {
c.AddBlock("if").Clause("else").Clause("elsif").Compiler(ifTagCompiler(true))
c.AddBlock("raw")
c.AddBlock("tablerow").Compiler(loopTagCompiler)
c.AddBlock("unless").Compiler(ifTagCompiler(false))
c.AddBlock("unless").Clause("else").Compiler(ifTagCompiler(false))
}

func assignTag(source string) (func(io.Writer, render.Context) error, error) {
Expand Down

0 comments on commit 919a6d6

Please sign in to comment.