# pylint: skip-file
# mypy: ignore-errors

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

import sys
from os.path import abspath, dirname, join

import tomli

sys.path.insert(0, abspath(join(dirname(__file__), "..")))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "pytest-csv-params"
copyright = "2022, Jürgen Edelbluth"
author = "Jürgen Edelbluth"
# release = "0.0.0"

with open(abspath(join(dirname(__file__), "..", "pyproject.toml")), "rt", encoding="utf-8") as pyproject_toml:
    toml_data = tomli.loads(pyproject_toml.read())
release = toml_data["tool"]["poetry"]["version"]

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    "sphinx.ext.intersphinx",
    "sphinx.ext.duration",
    "sphinx.ext.doctest",
    "sphinx.ext.autodoc",
    "sphinx.ext.autosummary",
    "sphinx.ext.napoleon",
    "sphinx_autodoc_typehints",
    "myst_parser",
]

intersphinx_mapping = {
    "python": ("https://docs.python.org/3", (None, "python-inv.txt")),
    "pytest": ("https://docs.pytest.org/en/7.1.x/", (None, "pytest-inv.txt")),
}

templates_path = ["_templates"]
exclude_patterns = []

source_suffix = {
    ".rst": "restructuredtext",
    ".txt": "markdown",
    ".md": "markdown",
}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "sphinx_material"
html_static_path = ["_static"]

html_title = "pytest-csv-params Documentation"
html_short_title = "pytest-csv-params"

html_logo = "icon/pytest-csv-params.png"

pygments_style = "emacs"

# Material theme options (see theme.conf for more information)
html_theme_options = {
    # Set the name of the project to appear in the navigation.
    "nav_title": "Pytest CSV Params Plugin",
    # Set you GA account ID to enable tracking
    "google_analytics_account": None,
    # Specify a base_url used to generate sitemap.xml. If not
    # specified, then no sitemap will be built.
    "base_url": None,
    # Set the color and the accent color
    "color_primary": "teal",
    "color_accent": "deep-orange",
    "repo_url": "https://git.codebau.dev/pytest-plugins/pytest-csv-params",
    "repo_name": "git.codebau.dev",
    "repo_type": None,
    # Visible levels of the global TOC; -1 means unlimited
    "globaltoc_depth": 1,
    # If False, expand all TOC entries
    "globaltoc_collapse": True,
    # If True, show hidden TOC entries
    "globaltoc_includehidden": False,
    "css_minify": True,
    "html_minify": True,
    "master_doc": True,
    "theme_color": "#008080",
}

myst_enable_extensions = [
    "colon_fence",
]

html_sidebars = {
    "**": [
        "logo-text.html",
        "globaltoc.html",
        "localtoc.html",
        "searchbox.html",
    ]
}

autodoc_typehints_format = "fully-qualified"
autodoc_preserve_defaults = True
