2013-06-28 31 views
5

在haml中,我想显示5/174。分子,前锋斜线,分母。显示haml中的正斜杠?

= @numerator 
/
= denominator 

我的解决方法:

= @numerator 
- slash = "/" 
= slash 
= denominator 

回答

6

我只想用interpolation with #{}这样的事情:

#{@numerator}/#{denominator} 

(注意,您在一开始就不需要=)。

如果你真的想用/字符(或任何其他特殊字符)在Haml开始一行,你可以用escape it with \

= @numerator 
\/ 
= denominator 
+0

\ /很好!谢谢! – sanemat