Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show forward slash in haml?

Tags:

haml

In haml, I want to display 5 / 174. numerator, foward slash, denominator.

= @numerator
/
= denominator

My workaround:

= @numerator
- slash = "/"
= slash
= denominator
like image 730
Matt - sanemat Avatar asked Jun 28 '13 06:06

Matt - sanemat


1 Answers

I would just use interpolation with #{} for something like this:

#{@numerator} / #{denominator}

(note you don’t need = at the start).

If you really want to start a line in Haml with the / character (or any other special character) you can escape it with \ e.g.

= @numerator
\/
= denominator
like image 87
matt Avatar answered Oct 09 '22 22:10

matt