ruby - 使用 Jekyll 时出现液态语法错误 - 意外字符
问题描述
我正在使用带有大量扩展的 Jekyll。构建工作正常,但是当我调用 Jekyll serve 时,我收到以下警告:
Liquid Warning: Liquid syntax error (line 13): Unexpected character in "{{forloop.index | minus:1 | modulo:4 }}" in .html
Liquid Warning: Liquid syntax error (line 13): Unexpected character in "{{forloop.index | minus:1 | modulo:4 }}" in .html
这是上述文件的代码,
<section class="pt-6 pt-md-8 pb-8 mb-md-8">
<div class="container">
<!-- Example single danger button -->
<center><h2>Please choose a category to view</h2></center>
<hr>
{% assign color = "#DA5988,#FF5A5F,#0082C9,#6772E5" %}
<div class="row">
{% for category in site.categories %}
{% assign idx = forloop.index | minus:1 | modulo:4 %}
{% assign curr_color = color | split:',' | slice:idx %}
<div class="col-4 mt-5">
<!-- Card -->
<div class="card card-border shadow-light-lg lift lift-lg" style="border-top-color: {{ curr_color }};">
<div class="card-body text-center">
<!-- Text -->
<h3 class="text-gray-700 mb-5" style="color:{{ curr_color }}">
{{ category | first | split:"-" | join:" " | upcase }}
</h3>
<!-- Link -->
<a href="/articles/{{ category | first }}" style="color: {{ curr_color }};">Show More</a>
</div>
</div>
</div>
{% endfor %}
</div>
</div> <!-- / .container -->
</section>
您可以在第 13 行看到只有一个空格,我怎样才能摆脱这些警告?
解决方案
也许考虑检查类别名称本身是否有空格,看看这是否是产生错误的原因。
推荐阅读
- c++ - CMake 找不到请求的 Boost 库
- android - 带有 SortedList 的 RecyclerView 显示重复项
- php - PHP 在类的静态方法中调用函数
- jenkins - Windows 中的 Jenkins 工作区设置问题
- java - 比较文本文件中类似字符串的行
- r - r 在安装 lightgbm 期间相应地发生错误 internalsID
- eclipse - 尝试从 Mbed 编译器编译导入的项目时出错
- sql - where 子句中的多个 Case 条件
- angular - 如何从 Angular Guard 的流中返回布尔值?
- jquery - Owl Carousel 使用单个 jQuery 脚本进行 2 个或更多部分