【问题标题】:Haml: How to remove whitespace around textHaml:如何删除文本周围的空格
【发布时间】:2017-11-17 22:45:55
【问题描述】:

我想删除名称后的空格并使用 HAML 完成最终的 HTML: 约翰,首席执行官

%p.about_title_bx
  = truncate about.name,length:100
  , #{truncate about.position,length:100}

【问题讨论】:

    标签: haml


    【解决方案1】:

    您可以添加< 以删除空格:

    %p.about_title_bx<
      = truncate about.name,length:100
      , #{truncate about.position,length:100}
    

    Whitespace Removal: > and <

    另外,请记住,HAML 应该有助于结构,而不是内容。使用辅助方法或内联该内容可能是更好的解决方案。

    【讨论】:

      猜你喜欢
      • 2010-11-21
      • 2018-08-03
      • 2012-11-24
      • 2011-04-28
      • 2014-07-26
      • 2018-11-27
      • 2011-07-05
      • 1970-01-01
      • 2021-06-19
      相关资源
      最近更新 更多