summaryrefslogtreecommitdiff
path: root/biblio/citation-style-language/citeproc-latex-core.lua
diff options
context:
space:
mode:
Diffstat (limited to 'biblio/citation-style-language/citeproc-latex-core.lua')
-rw-r--r--biblio/citation-style-language/citeproc-latex-core.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/biblio/citation-style-language/citeproc-latex-core.lua b/biblio/citation-style-language/citeproc-latex-core.lua
index 42beb07735..5a795ca060 100644
--- a/biblio/citation-style-language/citeproc-latex-core.lua
+++ b/biblio/citation-style-language/citeproc-latex-core.lua
@@ -129,7 +129,7 @@ local function read_data_files(data_files)
if format == "json" then
local ok, res = pcall(json_decode, contents)
- if ok then
+ if ok and res then
---@cast res CslData
csl_items = res
else
@@ -138,7 +138,13 @@ local function read_data_files(data_files)
elseif format == "yaml" then
yaml = yaml or require("citeproc-yaml")
- csl_items = yaml.parse(contents)
+ local ok, res = pcall(yaml.parse, contents)
+ if ok and res then
+ ---@cast res CslData
+ csl_items = res
+ else
+ util.error(string.format('YAML decode error in file "%s".', file))
+ end
elseif format == "bibtex" then
local bib_data, exceptions = bibtex_parser.parse(contents, bibtex_strings)