Diff options
Diffstat (limited to 'custom/extensions/syntax-highlight.lua')
| -rw-r--r-- | custom/extensions/syntax-highlight.lua | 9 |
1 file changed, 7 insertions, 2 deletions
diff --git a/custom/extensions/syntax-highlight.lua b/custom/extensions/syntax-highlight.lua index 7414b63..2928250 100644 --- a/custom/extensions/syntax-highlight.lua +++ b/custom/extensions/syntax-highlight.lua @@ -4,8 +4,8 @@ -- Scintillua lexers and reach the page wrapped in span elements carrying the -- hl- classes that assets/cgit.css styles. Whenever a piece is missing or -- will not load, from lpeg down to a single lexer, the filter falls back to --- plain escaped text instead of failing. It runs on Lua 5.1 through 5.5 and --- LuaJIT. +-- plain escaped text instead of failing, and a missing lpeg or Scintillua is +-- noted in the error log. It runs on Lua 5.1 through 5.5 and LuaJIT. -- -- source-filter=lua:/usr/local/lib/cgit/filters/syntax-highlight.lua @@ -140,6 +140,7 @@ end local function load_scintillua() local dir = scintillua_path() if not dir then + io.stderr:write("[cgit] Unable to find the Scintillua lexers, so source is shown uncoloured\n") return nil end package.path = dir .. "/?.lua;" .. package.path @@ -149,6 +150,10 @@ local function load_scintillua() if ok and type(mod) == "table" and type(mod.load) == "function" then return mod end + if not ok then + local reason = tostring(mod):match("[^\n]*") + io.stderr:write("[cgit] Unable to load the Scintillua lexers: " .. reason .. "\n") + end return nil end |
