-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move extension entrypoint from ext.py to __init__.py
Then it can be consistency with other sphinxnotes projects.
- Loading branch information
1 parent
c2ba165
commit b042146
Showing
3 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
sphinxnotes.snippet | ||
~~~~~~~~~~~~~~~~~~~ | ||
Sphinx extension entrypoint. | ||
:copyright: Copyright 2024 Shengyu Zhang | ||
:license: BSD, see LICENSE for details. | ||
""" | ||
|
||
|
||
def setup(app): | ||
# **WARNING**: We don't import these packages globally, because the current | ||
# package (sphinxnotes.snippet) is always resloved when importing | ||
# sphinxnotes.snippet.*. If we import packages here, eventually we will | ||
# load a lot of packages from the Sphinx. It will seriously **SLOW DOWN** | ||
# the startup time of our CLI tool (sphinxnotes.snippet.cli). | ||
# | ||
# .. seealso:: https://github.com/sphinx-notes/snippet/pull/31 | ||
from .ext import ( | ||
SnippetBuilder, | ||
on_config_inited, | ||
on_env_get_outdated, | ||
on_doctree_resolved, | ||
on_builder_finished, | ||
) | ||
|
||
app.add_builder(SnippetBuilder) | ||
|
||
app.add_config_value('snippet_config', {}, '') | ||
app.add_config_value('snippet_patterns', {'*': ['.*']}, '') | ||
|
||
app.connect('config-inited', on_config_inited) | ||
app.connect('env-get-outdated', on_env_get_outdated) | ||
app.connect('doctree-resolved', on_doctree_resolved) | ||
app.connect('build-finished', on_builder_finished) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters