【发布时间】:2018-09-14 02:20:33
【问题描述】:
我在 Windows 10 上运行 bundle exec jekyll serve --trace。我收到以下控制台消息:
D:\MyPorfolio\perrot.github.io>bundle exec jekyll serve
Configuration file: D:/MyPorfolio/perrot.github.io/_config.yml
Source: D:/MyPorfolio/perrot.github.io
Destination: D:/MyPorfolio/perrot.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Liquid Exception: Liquid syntax error (line 8): Syntax Error in 'for loop' - Valid syntax: for [item] in [collection] in 2018-09-14-Rendering a python dict in jinja2.markdown
杰基尔 3.7.3 |错误:Liquid 语法错误(第 8 行):“for 循环”中的语法错误 - 有效语法:for [item] in [collection]
有谁知道如何解决这个问题?提前致谢。
文件2018-09-14-Rendering a python dict in jinja2.markdown内容为:
---
layout: post
title: "Rendering a python dict in jinja2"
date: 2018-09-14 00:01:57 +0800
categories: python jinja2
---
```python
url_list = [{'target': 'http://10.58.48.103:5000/', 'clicks': '1'},
{'target': 'http://slash.org', 'clicks': '4'},
{'target': 'http://10.58.48.58:5000/', 'clicks': '1'},
{'target': 'http://de.com/a', 'clicks': '0'}]
#Python 2.7
{% for key, value in url_list.iteritems() %}
<li>{{ value["target"] }}</li>
{% endfor %}
#Python 3
{% for key, value in url_list.items() %}
<li>{{ value["target"] }}</li>
{% endfor %}
```
【问题讨论】:
-
您与上一个工作版本相比有何变化?任何代码发布?文件
2018-09-14-...或其使用的布局似乎有问题。 -
@marcanuy 感谢您的快速回复。我修改了我的帖子,并在 jinja2.markdown 中附加了 2018-09-14-Rendering a python dict 的内容。