|
| 1 | +# Configuration file for the Sphinx documentation builder. |
| 2 | +# |
| 3 | +# This file only contains a selection of the most common options. For a full |
| 4 | +# list see the documentation: |
| 5 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html |
| 6 | + |
| 7 | +# -- Path setup -------------------------------------------------------------- |
| 8 | + |
| 9 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 10 | +# add these directories to sys.path here. If the directory is relative to the |
| 11 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 12 | +# |
| 13 | +# import os |
| 14 | +# import sys |
| 15 | +# sys.path.insert(0, os.path.abspath('.')) |
| 16 | + |
| 17 | + |
| 18 | +# -- Project information ----------------------------------------------------- |
| 19 | + |
| 20 | +project = "HIP and SYCL" |
| 21 | +copyright = "2021, Roberto Di Remigio and individual contributors." |
| 22 | +author = "Roberto Di Remigio and individual contributors." |
| 23 | +github_user = "ENCCS" |
| 24 | +github_repo_name = "hip-and-sycl" |
| 25 | +github_version = "main" |
| 26 | +conf_py_path = "/content/" # with leading and trailing slash |
| 27 | + |
| 28 | +# -- General configuration --------------------------------------------------- |
| 29 | + |
| 30 | +# Add any Sphinx extension module names here, as strings. They can be |
| 31 | +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 32 | +# ones. |
| 33 | +extensions = [ |
| 34 | + # githubpages just adds a .nojekyll file |
| 35 | + "sphinx.ext.githubpages", |
| 36 | + "sphinx_lesson", |
| 37 | + # remove once sphinx_rtd_theme updated for contrast and accessibility: |
| 38 | + "sphinx_rtd_theme_ext_color_contrast", |
| 39 | + "sphinx.ext.todo", |
| 40 | +] |
| 41 | + |
| 42 | +# Settings for myst_nb: |
| 43 | +# https://myst-nb.readthedocs.io/en/latest/use/execute.html#triggering-notebook-execution |
| 44 | +# jupyter_execute_notebooks = "off" |
| 45 | +# jupyter_execute_notebooks = "auto" # *only* execute if at least one output is missing. |
| 46 | +# jupyter_execute_notebooks = "force" |
| 47 | +jupyter_execute_notebooks = "cache" |
| 48 | + |
| 49 | +# Add any paths that contain templates here, relative to this directory. |
| 50 | +# templates_path = ['_templates'] |
| 51 | + |
| 52 | +# List of patterns, relative to source directory, that match files and |
| 53 | +# directories to ignore when looking for source files. |
| 54 | +# This pattern also affects html_static_path and html_extra_path. |
| 55 | +exclude_patterns = [ |
| 56 | + "README*", |
| 57 | + "_build", |
| 58 | + "Thumbs.db", |
| 59 | + ".DS_Store", |
| 60 | + "jupyter_execute", |
| 61 | + "*venv*", |
| 62 | +] |
| 63 | + |
| 64 | +# -- Options for HTML output ------------------------------------------------- |
| 65 | + |
| 66 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 67 | +# a list of builtin themes. |
| 68 | +# |
| 69 | +html_theme = "sphinx_rtd_theme" |
| 70 | +html_logo = "img/ENCCS.jpg" |
| 71 | +html_favicon = "img/favicon.ico" |
| 72 | + |
| 73 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 74 | +# relative to this directory. They are copied after the builtin static files, |
| 75 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 76 | +html_static_path = ['_static'] |
| 77 | +html_css_files = ["overrides.css"] |
| 78 | + |
| 79 | +# HTML context: |
| 80 | +from os.path import basename, dirname, realpath |
| 81 | + |
| 82 | +html_context = { |
| 83 | + "display_github": True, |
| 84 | + "github_user": github_user, |
| 85 | + # Auto-detect directory name. This can break, but |
| 86 | + # useful as a default. |
| 87 | + "github_repo": github_repo_name or basename(dirname(realpath(__file__))), |
| 88 | + "github_version": github_version, |
| 89 | + "conf_py_path": conf_py_path, |
| 90 | +} |
| 91 | + |
| 92 | +# Intersphinx mapping. For example, with this you can use |
| 93 | +# :py:mod:`multiprocessing` to link straight to the Python docs of that module. |
| 94 | +# List all available references: |
| 95 | +# python -msphinx.ext.intersphinx https://docs.python.org/3/objects.inv |
| 96 | +# extensions.append('sphinx.ext.intersphinx') |
| 97 | +# intersphinx_mapping = { |
| 98 | +# #'python': ('https://docs.python.org/3', None), |
| 99 | +# #'sphinx': ('https://www.sphinx-doc.org/', None), |
| 100 | +# #'numpy': ('https://numpy.org/doc/stable/', None), |
| 101 | +# #'scipy': ('https://docs.scipy.org/doc/scipy/reference/', None), |
| 102 | +# #'pandas': ('https://pandas.pydata.org/docs/', None), |
| 103 | +# #'matplotlib': ('https://matplotlib.org/', None), |
| 104 | +# 'seaborn': ('https://seaborn.pydata.org/', None), |
| 105 | +# } |
| 106 | + |
| 107 | +# add few new directives |
| 108 | +from sphinx_lesson.directives import _BaseCRDirective |
| 109 | + |
| 110 | + |
| 111 | +class SignatureDirective(_BaseCRDirective): |
| 112 | + extra_classes = ["toggle-shown", "dropdown"] |
| 113 | + |
| 114 | + |
| 115 | +class ParametersDirective(_BaseCRDirective): |
| 116 | + extra_classes = ["dropdown"] |
| 117 | + |
| 118 | + |
| 119 | +class TypealongDirective(_BaseCRDirective): |
| 120 | + extra_classes = ["toggle-shown", "dropdown"] |
| 121 | + |
| 122 | + |
| 123 | +DIRECTIVES = [SignatureDirective, ParametersDirective, TypealongDirective] |
| 124 | + |
| 125 | + |
| 126 | +def setup(app): |
| 127 | + for obj in DIRECTIVES: |
| 128 | + app.add_directive(obj.cssname(), obj) |
0 commit comments