I'd like to use full html syntax with Slim. I don't want the cryptography they offer. But I think it's impossible. Here's my html code and Slim throws an error.
The target:
I want not to output an additional class of div
element if some condition is met:
<div class="foo bar"></div> # <-- standard
<div class="foo"></div> # <-- no "bar" class if some condition is met
And here is my Slim code:
<body> # <-- 11th line
- (1..5).each do |i| # <-- The dash means a line of Ruby code...
<div class="foo # <-- ...after it an indentation of lines follows
- if(i != 2) # <-- if "i" is not 2
= bar # <-- output "bar" as additional class for the div
= " data-co="#{i}"> # <-- indentation back, I want an output of the rest
</div>
</body> # <-- 17th line
</html> # <-- 19th line, the last element
Logically everything is all right. All indentations and =
and -
are obeyed. But I get error:
!! Unexpected error while processing request: tmpl.slim:16: syntax error, unexpected keyword_end, expecting ')
'
; end; _buf << ("</div>");
^
tmpl.slim:17: syntax error, unexpected keyword_end, expecting ')'
; end; _buf << ("</body>"\
^
tmpl.slim:22: syntax error, unexpected keyword_end, expecting ')'
end;end;end;end
I have two questions:
1) Is it possible to fully use html syntax in Slim?
2) How may I solve my issue?