# Configuration file for the Sphinx documentation builder.
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from datetime import date

from sphinx_scylladb_theme.utils import multiversion_regex_builder
sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------

project = 'Start9 Docs'
copyright = str(date.today().year) + ",  Start9 Labs, Inc."
author = u"Start9 Contributors"


# -- General configuration ---------------------------------------------------

# Target Sphinx version
needs_sphinx = "1.8"

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.todo",
    "sphinx.ext.viewcode",
    "sphinx.ext.mathjax",
    "sphinx.ext.extlinks",
    "sphinx_scylladb_theme",
    'sphinxcontrib.youtube',
    'sphinx_multiversion',
]

# The suffix(es) of source filenames.
source_suffix = [".rst", ".md"]
autosectionlabel_prefix_document = True

# The master toctree document.
master_doc = "index"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (code syntax highlighting) style to use.
pygments_style = "sphinx"

# List of substitutions
rst_prolog = """
.. |rst| replace:: RestructuredText
"""

# -- Options for not found extension -------------------------------------------
# Template used to render the 404.html generated by this extension.
notfound_template = "404.html"

# -- Options for multiversion extension ----------------------------------

# Whitelist pattern for tags (set to None to ignore all tags)
TAGS = []
smv_tag_whitelist = multiversion_regex_builder(TAGS)
# Whitelist pattern for branches (set to None to ignore all branches)
BRANCHES = ["0.2.x", "0.3.1.x", "0.3.2.x", "master"]
smv_branch_whitelist = multiversion_regex_builder(BRANCHES)
# Defines which version is considered to be the latest stable version.
# Must be listed in smv_tag_whitelist or smv_branch_whitelist.
smv_latest_version = "master"
smv_rename_latest_version = "latest"
# Whitelist pattern for remotes (set to None to use local branches only)
smv_remote_whitelist = r"^origin$"
# Pattern for released versions
smv_released_pattern = r'^tags/.*$'
# Format for versioned output directories inside the build directory
smv_outputdir_format = '{ref.name}'
# Determines whether remote or local git branches/tags are preferred if their output dirs conflict
smv_prefer_remote_refs = False

# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML pages.
html_theme = "sphinx_scylladb_theme"
html_theme_path = ["../../sphinx-scylladb-theme"]

html_theme_options = {
    "conf_py_path": "site/source/",
    "banner_button_text": "Learn more",
    "banner_button_url": "https://start9labs.medium.com/announcing-embassyOS-0-3-0-f3d2d2ea016f",
    "banner_title_text": "embassyOS 0.3.0 is now available 🥳",
    "hide_banner": "true",
    "hide_edit_this_page_button": "false",
    "hide_sidebar_index": "true",
    "hide_version_dropdown": [],
    "github_issues_repository": "Start9Labs/documentation",
    "github_repository": "Start9Labs/documentation",
    "navigation_depth": 3,
    "site_description": "Start9 documentation for sovereign computing with embassyOS",
}

# Last updated format
html_last_updated_fmt = "%d %b %Y"

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# Custom sidebar templates, maps document names to template names.
html_sidebars = {"**": ["side-nav.html"]}

# Output file base name for HTML help builder.
htmlhelp_basename = "Start9Documentation"

# URL which points to the root of the HTML documentation.
html_baseurl = "https://docs.start9.com"

# Dictionary of values to pass into the template engine’s context for all pages
html_context = {"html_baseurl": html_baseurl}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

html_logo = "_static/logo.png"

html_title = "Docs"

html_favicon = "_static/favicon.ico"

html_js_files = ["custom.js"]

# exclude_patterns = ['user-manual/forgot-password.rst']