Skip to content

Commit

Permalink
docs: add build env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Revathyvenugopal162 committed Jun 10, 2024
1 parent c47f466 commit a5e4be0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
20 changes: 19 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
"sphinx.ext.extlinks",
"sphinx.ext.intersphinx",
"sphinx_autodoc_typehints",
"sphinx_jinja",
"sphinx_design",
"sphinx_copybutton",
"sphinx_gallery.gen_gallery",
"sphinxemoji.sphinxemoji",
"sphinx.ext.graphviz",
"sphinx_reredirects",
Expand Down Expand Up @@ -187,6 +187,24 @@
"substitutions.rst",
]

BUILD_API = True if os.environ.get("BUILD_API", "true") == "true" else False
if not BUILD_API:
exclude_patterns.extend(["api/**", "mapdl_commands/**", "api.rst"])

BUILD_EXAMPLES = True if os.environ.get("BUILD_EXAMPLES", "true") == "true" else False
if not BUILD_EXAMPLES:
exclude_patterns.extend(["examples/index.rst", "examples/**", "examples/**/**"])
suppress_warnings.append("ref.*")
else:
extensions.append("sphinx_gallery.gen_gallery")

jinja_contexts = {
"main_toctree": {
"build_api": BUILD_API,
"build_examples": BUILD_EXAMPLES,
},
}

# make rst_epilog a variable, so you can add other epilog parts to it
rst_epilog = ""

Expand Down
25 changes: 15 additions & 10 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
.. meta::
:keywords: pymapdl mapdl simulation finite elements python


.. toctree::
:hidden:
:maxdepth: 3

getting_started/index
user_guide/index
mapdl_commands/index
api/index
examples/index
.. jinja:: main_toctree

.. toctree::
:hidden:
:maxdepth: 3

getting_started/index
user_guide/index
{% if build_api %}
mapdl_commands/index
api/index
{% endif %}
{% if build_examples %}
examples/index
{% endif %}


.. image:: ../source/_static/logo_dark.png
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ doc = [
"sphinx-copybutton==0.5.2",
"sphinx-design==0.6.0",
"sphinx-gallery==0.16.0",
"sphinx-jinja==2.0.2",
"sphinx-notfound-page==1.0.2",
"sphinxcontrib-websupport==1.2.7",
"sphinxemoji==0.3.1",
Expand Down

0 comments on commit a5e4be0

Please sign in to comment.