New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle ifs in HAML interpolation better #1035

Merged
merged 1 commit into from Apr 21, 2017
Jump to file or symbol
Failed to load files and symbols.
+11 −0
Diff settings

Always

Just for now

@@ -170,6 +170,14 @@ def get_pushed_value exp, default = :output
exp
when :block, :rlist, :dstr
exp.map! { |e| get_pushed_value e }
when :if
clauses = [get_pushed_value(exp.then_clause), get_pushed_value(exp.else_clause)].compact
if clauses.length > 1
s(:or, *clauses)
else
clauses.first
end
else
if call? exp and exp.target == HAML_HELPERS and exp.method == :html_escape
add_escaped_output exp.first_arg
@@ -0,0 +1,3 @@
:javascript
#{j(params[:a])} // Should not warn
#{j(params[:b]) unless params[:c]} // Should not warn
ProTip! Use n and p to navigate between commits in a pull request.