Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Add parameter callback_begin when generating the documentation (#358)
Browse files Browse the repository at this point in the history
* Add parameter callback_begin
  • Loading branch information
xadupre committed Dec 7, 2021
1 parent 5869b82 commit 39303c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion _doc/sphinxdoc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@
sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0])))
from pyquickhelper.helpgen.default_conf import set_sphinx_variables


def callback_begin():
print("[sphinx.conf.py] documentation started.")


set_sphinx_variables(__file__, "pyquickhelper", "Xavier Dupré", 2021,
"alabaster", alabaster.get_path(),
locals(),
github_repo="https://github.com/sdpython/pyquickhelper.git",
extlinks=dict(issue=(
'https://github.com/sdpython/pyquickhelper/issues/%s',
'issue ')),
link_resolve="http://www.xavierdupre.fr/app/")
link_resolve="http://www.xavierdupre.fr/app/",
callback_begin=callback_begin)

# there is an issue with this attribute on Anaconda math_number_all
assert math_number_all or not math_number_all
Expand Down
6 changes: 4 additions & 2 deletions src/pyquickhelper/helpgen/default_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def set_sphinx_variables(fileconf, module_name, author, year, theme, theme_path,
sharepost="facebook-linkedin-twitter-20-body", custom_style=None,
extlinks=None, github_user=None, github_repo=None, title=None,
book=True, link_resolve=None, nblayout='classic', doc_version=None,
branch='master'):
branch='master', callback_begin=None):
"""
Defines variables for :epkg:`Sphinx`.
Expand Down Expand Up @@ -58,6 +58,7 @@ def set_sphinx_variables(fileconf, module_name, author, year, theme, theme_path,
the notebook gallery
@param doc_version if not None, overwrites the current version
@param branch default branch (`'master'` by default)
@param callback_begin function to call when the documentation is generated
If the parameter *custom_style* is not None, it will call ``app.add_css_file(custom_style)``
in the setup.
Expand Down Expand Up @@ -486,7 +487,6 @@ def set_sphinx_variables(fileconf, module_name, author, year, theme, theme_path,
pygments_style = 'monokai'
elif html_theme == "pydata_sphinx_theme": # pragma: no cover
import pydata_sphinx_theme # pylint: disable=E0401
pydata_sphinx_theme
html_theme_options = {
"github_user": github_user,
"github_repo": github_repo,
Expand Down Expand Up @@ -623,6 +623,8 @@ def modify_commit_function(nbch, date, author, comment):
def this_setup(app): # pragma: no cover
if custom_style is not None:
app.add_css_file(custom_style)
if callback_begin is not None:
callback_begin()
return custom_setup(app, author)

ext_locals["setup"] = this_setup
Expand Down

0 comments on commit 39303c5

Please sign in to comment.