2012-08-07 20 views
0

试图找出原因:液体模板 - 使用更换滤芯打印出</em><em>

{{ page.excerpt | prepend:'<em>' | append:'</em>' | replace: ',' ,'</em> <em>' }} 

变成这样:

hashtag.1, hashtag.2, hashtag.3 

到这一点:

<em>#LetsMove <em> #newark <em> #JJLA2012</em> 

..

somehow the </em> is not passing through. 

html标签似乎关闭自己,排序非统一,所以我们继续结束了 w /一个怪异的半嵌套标记混乱。

+0

请张贴您正在显示的摘录和周围标记的确切声明。您的代码迄今为止适用于我。 – manatwork 2012-08-08 06:31:40

回答

0

我认为这是因为你的主题标签是一个数组,而不是一个字符串。

替换不会发生,而是预先添加到每个hashitem。

故障排除使用此:

{{ page.excerpt | replace: ',','foobar' }} 

看看是否foobar的打印出来的。你确定你在page.excerpt中的hashitems?

输出过滤器从左到右,因此在您的示例中:prepend,append,replace。或者,在这个例子中

{{ output | filterA | filterB | filterC }} 

的顺序将是

  1. filterA
  2. filterB
  3. filterC
0

试试这个:

{{ page.excerpt | array_to_sentence_string | prepend:'<em>' | append:'</em>' | replace: ',' ,'</em> <em>' }}