Skip to content

Commit

Permalink
BUG: Provide a class name to the Sphinx lexer
Browse files Browse the repository at this point in the history
Provide a class name to the `Sphinx` lexer: the `add_lexer` method does
not accept lexer instances as an argument since version 4.0.

Fixes:
```
Exception occurred:
  File ".virtualenvs/tract_querier/lib/python3.10/site-packages/sphinx/highlighting.py", line 159, in get_lexer
    lexer = lexer_classes[lang](**opts)
TypeError: 'WMQLLexer' object is not callable
```

raised in a local build with Python 3.10 and Sphinx 8.1.3.

Documentation:
https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_lexer
  • Loading branch information
jhlegarreta committed Dec 5, 2024
1 parent 00d9412 commit 230ba0c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,5 +259,4 @@ def get_tokens_unprocessed(self, text):
yield index, Keyword.Pseudo, value
else:
yield index, token, value
wmql_lexer = WMQLLexer()
app.add_lexer('wmql', wmql_lexer)
app.add_lexer('wmql', WMQLLexer)

0 comments on commit 230ba0c

Please sign in to comment.