Skip to content

Lua highlight throwing errors #2836

@myk002

Description

@myk002

Our CI runs started throwing errors today for documentation that hasn't changed, erroring out on code blocks like this:

https://pygments.org/demo/?lexer=lua&style=bw&formatter=html&code=local+json+%3D+require%28%27json%27%29%0Alocal+scriptmanager+%3D+require%28%27script-manager%27%29%0Alocal+path+%3D+scriptmanager.getModStatePath%28%27mymodname%27%29%0Aconfig+%3D+config+or+json.open%28path+..+%27settings.json%27%29%0A%0A--+modify+state+in+the+config.data+table+and+persist+it+when+it+changes+with%0A--+config%3Awrite%28%29

Example failed CI run: https://github.com/DFHack/dfhack/actions/runs/12625582123/job/35177450503

[1/3] Building documentation with Sphinx
FAILED: /home/runner/work/dfhack/dfhack/docs/html/.buildinfo 
cd /home/runner/work/dfhack/dfhack/build && /usr/bin/python3.10 /home/runner/work/dfhack/dfhack/docs/build.py html text --sphinx="/home/runner/.local/bin/sphinx-build" -- -q -W
/home/runner/work/dfhack/dfhack/docs/dev/Lua API.rst:3732: WARNING: Lexing literal_block 'local json = require("json")\nlocal scriptmanager = require("script-manager")\nlocal path = scriptmanager.getModStatePath("my_awesome_mod")\nconfig = config or json.open(path .. "settings.json")' as "lua" resulted in an error at token: '"'. Retrying in relaxed mode. [misc.highlighting_failure]
/home/runner/work/dfhack/dfhack/docs/guides/modding-guide.rst:249: WARNING: Lexing literal_block "local json = require('json')\nlocal scriptmanager = require('script-manager')\nlocal path = scriptmanager.getModStatePath('mymodname')\nconfig = config or json.open(path .. 'settings.json')\n\n-- modify state in the config.data table and persist it when it changes with\n-- config:write()" as "lua" resulted in an error at token: "'". Retrying in relaxed mode. [misc.highlighting_failure]
Traceback (most recent call last):
  File "/home/runner/work/dfhack/dfhack/docs/build.py", line 99, in <module>
    subprocess.run(command, check=True, env=sphinx_env)
  File "/usr/lib/python3.10/subprocess.py", line 52[6](https://github.com/DFHack/dfhack/actions/runs/12625582123/job/35177450503#step:13:7), in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/runner/.local/bin/sphinx-build', '-b', 'html', '.', 'docs/html', '-d', 'build/docs/html', '-w', 'build/docs/html/sphinx-warnings.txt', '-j', 'auto', '-q', '-W']' returned non-zero exit status 1.

PR that fixed the errors on our side (by removing highlighting for the erroring code blocks): https://github.com/DFHack/dfhack/pull/5169/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lexingarea: changes to individual lexers

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions