@@ -43,11 +43,18 @@ local refs_div = pandoc.Div({}, pandoc.Attr('refs'))
43
43
local refs_div_with_properties
44
44
45
45
--- 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
51
58
-- Use pandoc as a citeproc processor
52
59
citeproc = function (doc )
53
60
local opts = {' --from=json' , ' --to=json' , ' --citeproc' , ' --quiet' }
56
63
end
57
64
58
65
--- 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.
60
67
local function resolve_doc_citations (doc )
61
68
-- combine all bibliographies
62
69
local meta = doc .meta
0 commit comments