我正在制作一个 TiddlyWiki,其中一些提琴手包含以下字段:age
year
month
date
对应于虚构宇宙中提琴手的日期(因此我不能使用现有的日期字段,日历不同)。
age
我有这段代码可以创建一个列表,并按顺序或多或少正确地对提琴手year
进行month
排序date
:
<$list filter="[tag[history]] [tag[progress]] +[!sort[date]!sort[month]!sort[year]!sort[age]]">
<$link>{{!!title}}</$link> | <span style="font-weight: bold;">Age:</span> {{!!age}} <span style="font-weight: bold;">Year:</span> {{!!year}} <span style="font-weight: bold;">Month:</span> {{!!month}} <span style="font-weight: bold;">Date:</span> {{!!date}}<br>
</$list>
但是,当我有一个字段说它在前后month:11
进行排序时,因为它正在被评估和排序为文本。month:1
month:2
所以我的问题归结为如何强制sort[]
将其参数视为整数,或者如何告诉 TiddlyWiki 我在自定义字段中存储了什么样的数据?
解决方案
使用nsort[]
代替sort[]