0
我已经成功地以字母顺序显示液体中的.csv文件中的数据,但我使用的代码仅添加了一个在整个列表的开始处为空的<li>
标记。在我看来,“分裂”过滤器负责输出的格式,所以也许有一些东西。使用unorderd列表在液体中按字母顺序排序.csv数据会产生一个空列表元素
这是我在液态代码:
---
layout: default
---
{% capture thelistings %}
{% for listing in site.data.terminology %}
{{ listing.term }}: {{ listing.definition }}
{% endfor %}
{% endcapture %}
{% assign allsortedlistings = thelistings | split:" " | sort %}
<ul>
{% for allterms in allsortedlistings %}
<li>{{ allterms }}</li>
{% endfor %}
</ul>
这里是该.csv数据文件:
term,definition
brother,new explanation for one
aunt,another explanation for two
uncle,"and last one for three, with the use of comma fin"
father,this is it
again,now it is here
utah,this is a state
borrow,something from someone
forbidden,fruit
,这里是输出列表:
- 再次:现在在这里
- 阿姨:另一种解释两
- 贷:从别人的东西
- 兄弟:新解释一个
- 父亲:这是
- 禁:果
- 叔叔:和最后一个三,与使用逗号鳍
- 犹他州的:这是一种状态,我所输出的数据的方式