mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
docs: load custom lexer with plain Python import
The next commit will load another of our Python extensions from a separate file. That extension will contain more than just a Pygments lexer, so instead of using a function that can only load a lexer, just import from the module to keep things consistent.
This commit is contained in:
parent
89e85e05e0
commit
1c21e26d08
1 changed files with 5 additions and 16 deletions
|
@ -8,8 +8,8 @@
|
|||
|
||||
import glob
|
||||
import os.path
|
||||
import pygments
|
||||
import subprocess
|
||||
import sys
|
||||
from sphinx.errors import SphinxWarning
|
||||
from docutils import nodes
|
||||
|
||||
|
@ -41,10 +41,10 @@ def setup(app):
|
|||
from sphinx.highlighting import lexers
|
||||
|
||||
this_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
fish_indent_lexer = pygments.lexers.load_lexer_from_file(
|
||||
os.path.join(this_dir, "fish_indent_lexer.py"), lexername="FishIndentLexer"
|
||||
)
|
||||
lexers["fish-docs-samples"] = fish_indent_lexer
|
||||
sys.path.insert(0, this_dir)
|
||||
from fish_indent_lexer import FishIndentLexer
|
||||
|
||||
lexers["fish-docs-samples"] = FishIndentLexer()
|
||||
|
||||
app.add_config_value("issue_url", default=None, rebuild="html")
|
||||
app.add_role("issue", issue_role)
|
||||
|
@ -53,17 +53,6 @@ def setup(app):
|
|||
# The default language to assume
|
||||
highlight_language = "fish-docs-samples"
|
||||
|
||||
# -- Path setup --------------------------------------------------------------
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = "fish-shell"
|
||||
|
|
Loading…
Reference in a new issue