summaryrefslogtreecommitdiff
path: root/biblio/citation-style-language/citeproc-util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'biblio/citation-style-language/citeproc-util.lua')
-rw-r--r--biblio/citation-style-language/citeproc-util.lua22
1 files changed, 18 insertions, 4 deletions
diff --git a/biblio/citation-style-language/citeproc-util.lua b/biblio/citation-style-language/citeproc-util.lua
index 38de3b5751..71221e6bec 100644
--- a/biblio/citation-style-language/citeproc-util.lua
+++ b/biblio/citation-style-language/citeproc-util.lua
@@ -72,7 +72,14 @@ end
function util.error(message)
if luatexbase then
- luatexbase.module_error("citeproc", message)
+ -- The luatexbase.module_error() prints the traceback, which causes panic
+ -- luatexbase.module_error("citeproc", message)
+
+ texio.write_nl("term", "\n")
+ tex.error("Module citeproc Error: " .. message)
+
+ -- tex.print(string.format("\\PackageError{citation-style-language}{%s}{}", message))
+
else
error(message, 2)
end
@@ -82,9 +89,13 @@ util.warning_enabled = true
function util.warning(message)
if luatexbase then
+ texio.write_nl("term", "\n")
luatexbase.module_warning("citeproc", message)
+
+ -- tex.print(string.format("\\PackageWarning{citation-style-language}{%s}{}", message))
+
elseif util.warning_enabled then
- io.stderr:write(message, "\n")
+ io.stderr:write("Warning: " .. message, "\n")
end
end
@@ -158,7 +169,7 @@ function util.split_multiple(str, seps, include_sep)
end
if #seps > 1 then
- table.sort(splits, function(a, b) return a[1] < b[1] end)
+ table.sort(splits, function (a, b) return a[1] < b[1] end)
end
local res = {}
@@ -972,7 +983,10 @@ function util.read_file(path)
print(debug.traceback())
end
local file = io.open(path, "r")
- if not file then return nil end
+ if not file then
+ -- util.error(string.format('Cannot read file "%s".', path))
+ return nil
+ end
local content = file:read("*a")
file:close()
return content