【问题标题】:How to make a sentence inside a haml file bold?如何使haml文件中的句子加粗?
【发布时间】:2015-05-11 17:53:57
【问题描述】:

这是我的haml文件中的代码:

= render :partial => _paragraph,
         :locals => {:content =>  "It is hot. But something's definitely up."}

如何使最后一句话加粗?

【问题讨论】:

  • 使用正则表达式,检查这个答案stackoverflow.com/questions/21472655/…
  • 似乎与我的问题无关。
  • 这是一种将最后一句话加粗的解决方案,但是,如果你发现更好的东西,对你有好处:) GL
  • 改进标题并编辑代码示例(减少噪音)。

标签: html ruby-on-rails haml


【解决方案1】:

您可以在字符串中添加标签,然后将它们作为原始文本插入段落部分

= render :partial => _paragraph, :locals => {:content =>  "It's one thing to notice an uptick in appetite if you've been training hard at the gym, or if you're pregnant or PMS-ing. <b>But when you always feel like a bottomless pit for no obvious reason, then something's definitely up.</b>"}

在_paragraph

= raw content

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-30
    • 1970-01-01
    • 1970-01-01
    • 2022-11-24
    • 2013-03-26
    • 2023-02-09
    • 1970-01-01
    相关资源
    最近更新 更多