@@ -43,11 +43,18 @@ local refs_div = pandoc.Div({}, pandoc.Attr('refs'))
4343local refs_div_with_properties
4444
4545--- Run citeproc on a pandoc document
46- local citeproc
47- if utils .citeproc then
48- -- Built-in Lua function
49- citeproc = utils .citeproc
50- else
46+ --
47+ -- Falls back to the external `pandoc-citeproc` filter if the built-in
48+ -- citeproc processor is not available. Tries to silence all citeproc
49+ -- warnings, which isn't possible in some versions.
50+ local citeproc = utils .citeproc
51+ if pcall (require , ' pandoc.log' ) and citeproc then
52+ -- silence all warnings if possible
53+ local log = require ' pandoc.log'
54+ citeproc = function (...)
55+ return select (2 , log .silence (utils .citeproc , ... ))
56+ end
57+ elseif not citeproc then
5158 -- Use pandoc as a citeproc processor
5259 citeproc = function (doc )
5360 local opts = {' --from=json' , ' --to=json' , ' --citeproc' , ' --quiet' }
5663end
5764
5865--- Resolve citations in the document by combining all bibliographies
59- -- before running pandoc- citeproc on the full document.
66+ -- before running citeproc on the full document.
6067local function resolve_doc_citations (doc )
6168 -- combine all bibliographies
6269 local meta = doc .meta
0 commit comments