我在我的 html 模板的 rails 项目中使用 HAML。
我想弄清楚是否可以将一条很长的线分成几行:
%a.open-service{href: '#', data: {
service_name: service.description,
balance_type: "coinsurance",
total: service.a_total_billed - service.a_rejected - service.a_not_covered,
discount: service} }
正如你所看到的,我只想有一个带有 href 和一些数据属性的 anchor ,让它成为一行代码并不是一个很好的代码。
但是当我像上面那样做时,我得到一个错误:“不平衡的括号。”
有什么帮助吗?
最佳答案
根据 Haml documentation,可以在逗号后放置新行.所以,也许像下面这样的东西会起作用:
%a.open-service{href: '#',
data: { service_name: service.description,
balance_type: "coinsurance",
total: service.a_total_billed - service.a_rejected - service.a_not_covered,
discount: service} }
关于ruby-on-rails - Haml 语法 : split a line to a couple of rows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13930603/