# -*- coding: utf-8 -*-
#
# bolt documentation build configuration file, created by
# sphinx-quickstart on Mon Feb 08 19:29:04 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys
import os

import bolt.project as bproj


# 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.
# sys.path.insert(0, os.path.abspath('.'))
root = os.path.join(os.path.dirname(__file__), "..", "..")
source_dir = os.path.join(root, "src")
sys.path.insert(0, os.path.abspath(source_dir))

pyproject_file = os.path.join(root, "pyproject.toml")
pyproject = bproj.load_project(pyproject_file)
about = pyproject.project


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

# If your documentation needs a minimal Sphinx version, state it here.
# needs_sphinx = '1.0'

# 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.intersphinx",
    "sphinx.ext.todo",
    "sphinx.ext.coverage",
    "sphinx.ext.viewcode",
    "m2r2",
]

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

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
# source_suffix = ['.rst', '.md']
source_suffix = [
    ".rst",
    ".md",
]

# The encoding of source files.
# source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = "index"

# General information about the project.
project = about.name
copyright = pyproject.tool.bolt.project.copyright
author = about.authors[0].name

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
tokens = about.version.split(".")
version = '.'.join(tokens[:2])
# The full version, including alpha/beta/rc tags.
release = about.version

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = []

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

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True


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

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
html_theme = "sphinx_rtd_theme"

# 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"]

# If true, links to the reST sources are added to the pages.
html_show_sourcelink = False

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

################################################################################
# EPILOG
#
# Add substitutions or any other markup that should be made available to all
# pages.
#
################################################################################
rst_epilog = """
..  General Links:
..  |python| replace:: Python
..  _python: http://www.python.org
..  |grunt| replace:: Grunt
..  _grunt: http://gruntjs.com/

..  Project Links:
..  |repo| replace:: GitHub repo
..  _repo: https://github.com/abantos/bolt
"""
