Haml: Control whitespace around text

前端 未结 13 2151
时光说笑
时光说笑 2020-11-30 16:38

In my Rails template, I\'d like to accomplish final HTML to this effect using HAML:

I will first link somewhere         


        
13条回答
  •  死守一世寂寞
    2020-11-30 17:15

    Once approach I've taken to this sort of thing is to use string interpolation:

    I will first #{link_to 'Link somewhere'}#{', then render this half of the sentence if a condition is met' if condition}
    

    I don't like the look of the literal string in the interpolation, but I've used it with previously declared strings or dynamically generated strings before.

提交回复
热议问题