Striptag 仅部分剥离

发布于 2025-01-16 01:36:15 字数 355 浏览 4 评论 0原文

遇到了 striptags 未剥离所有标签的特殊情况。

{% if field_video|render|striptags %}
<li class="nav-item"><a data-toggle="tab" href="#product-vid">{{ field_video['#title'] }}</a></li>
{% endif %}

上面的工作是根据字段值删除“标题”,但保留边距和背景颜色。如果我使用 |trim 它会删除所有内容,但是如果字段具有“标题”值,它也会删除它。

我尝试过的其他事情: |trim 不为空

我还应该看什么?

Got a particular case of striptags not stripping all tags.

{% if field_video|render|striptags %}
<li class="nav-item"><a data-toggle="tab" href="#product-vid">{{ field_video['#title'] }}</a></li>
{% endif %}

The above works in removing the "title" according to field value, but leaves the margins and background color. If I use |trim it removes everything, however if a field has "title" value it also strips it.

Additional things I have tried:
|trim is not empty

What else should I look at?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文