Haml语法:将一条线分成几行 [英] Haml syntax: split a line to a couple of rows

查看:47
本文介绍了Haml语法:将一条线分成几行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的HTML模板的Rails项目中使用HAML. 我想弄清楚是否可以将很长的线划分成两行:

I use HAML in my rails project for my html templates. I would like to figure out if its possible to divide a very long line and make it a couple of rows:

%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和一些数据属性的锚点,并且使其成为一行不是一个漂亮的代码. 但是当我像上面那样做时,我得到一个错误:不平衡的括号."

As you can see, I just want to have an anchor with href and some data-attributes, and making it one-line won't be a pretty code. But when I do it like above I get an error: "Unbalanced brackets."

有什么帮助吗?

推荐答案

根据

New lines can be placed after commas, according to the Haml documentation. So, perhaps something like the following would work:

%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} }

这篇关于Haml语法:将一条线分成几行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆