Closed myyong closed 2 years ago
We call Sphinx in main.py
result = build_sphinx(
PATH_SRC_FOLDER,
OUTPUT_PATH,
use_external_toc=use_external_toc,
noconfig=True,
path_config=path_config,
confoverrides=config_overrides,
builder=BUILDER_OPTS[builder],
warningiserror=warningiserror,
keep_going=keep_going,
freshenv=freshenv,
verbosity=verbose,
quiet=quiet > 0,
really_quiet=quiet > 1,
)
This triggers the instantiation of the Sphinx app in sphinx.py
:
app = Sphinx(
srcdir=sourcedir,
confdir=confdir,
outdir=outputdir,
doctreedir=doctreedir,
buildername=builder,
confoverrides=sphinx_config,
status=status,
warning=warning,
freshenv=freshenv,
warningiserror=warningiserror,
tags=tags,
verbosity=verbosity,
parallel=jobs,
keep_going=keep_going,
)
After some stuff, the function build_sphinx
returns a status code which, in main.py
is referred to as result
.
Once we have the Sphinx object we go into builder_specific_actions
back in main.py
We check the config to see that
MY: builder is set to: html MY: cmd_type is set to: book
So we end up in this branch:
elif cmd_type == "book":
path_output_rel = Path(op.relpath(output_path, Path()))
path_index = path_output_rel.joinpath("index.html")
_message_box(
f"""\
Finished generating HTML for {cmd_type}.
Your book's HTML pages are here:
{path_output_rel}{os.sep}
You can look at your book by opening this file in a browser:
{path_index}
Or paste this line directly into your browser bar:
file://{path_index.resolve()}\
"""
)
In
main.py
we enter using the Build Project branch of the if statement: