由于我在上一个问题中使用了过时的软件包,因此我再次尝试使用正确的软件包。
我加载数据库、使用\cite
它并定义\cite
默认样式:
\startbuffer[main]
@Article {Foo2016, author = "Foo", title = "Text 1", year = "2016"}
@Article {Bar2017, author = "Bar", title = "Text 2", year = "2017"}
@Article {Baz2018, author = "Baz", title = "Text 3", year = "2018"}
\stopbuffer
\usebtxdataset[main][main.buffer]
\setupbtx[dataset=main] % make cite use this db by default
\setupbtx[default:cite][alternative=authoryear]
\starttext
Let’s cite a thing for the references at the end \cite[Bar2017].
现在我尝试使用 Lua 创建一个publist
包含一些条目副本的新数据库,然后呈现所有条目:
\startsection[title={Manual DB}]
\startluacode
local current = publications.datasets.main
local mine = {"Foo2016", "Bar2017"}
local pub = publications.new("Publications")
for _, tag in ipairs(mine) do
local entry = table.copy(current.luadata[tag])
entry.index = publications.getindex(current, current.luadata, tag)
pub.luadata[tag] = entry
end
print(table.serialize(pub.luadata))
publications.datasets["publist"] = pub
\stopluacode
\definebtxrendering[publist][apa][dataset=publist, numbering=yes]
\placebtxrendering[publist][method=database]
\stopsection
但令我惊讶的是,尽管该print
行打印的内容与我预期的完全一致,但该部分仍为空。为什么?
数据库main
呈现良好:
Another citation which should show up below \cite[Baz2018].
\startsection[title={Traditional DB}]
\definebtxrendering[main][apa][dataset=main, sorttype=authoryear, numbering=no]
\placebtxrendering[main][method=global]
\stopsection
\stoptext
下图显示“手动数据库”部分保持空白,而“传统数据库”部分看起来符合预期