文本和 ruby 使用 SLIM 在一行中
Text and ruby on one line using SLIM
我一直在写这样的标记:
span.label.label-default
span <
span= (@today - 1.day).strftime("%e %B, %Y")
应该看起来像:< 2 May, 2015
。我想我可以写
span.label.label-default= "< #{(@today - 1.day).strftime('%e %B, %Y')}"
是否有更好的方式将文本和 ruby 包含在同一个 html 标签中?
为什么不是这个:
span.label.label-default= (@today - 1.day).strftime("< %e %B, %Y")
我一直在写这样的标记:
span.label.label-default
span <
span= (@today - 1.day).strftime("%e %B, %Y")
应该看起来像:< 2 May, 2015
。我想我可以写
span.label.label-default= "< #{(@today - 1.day).strftime('%e %B, %Y')}"
是否有更好的方式将文本和 ruby 包含在同一个 html 标签中?
为什么不是这个:
span.label.label-default= (@today - 1.day).strftime("< %e %B, %Y")