2020-02-25 16:03:11 +00:00
|
|
|
import io
|
|
|
|
import os
|
2018-12-03 18:59:09 +00:00
|
|
|
|
2020-02-25 16:03:11 +00:00
|
|
|
import docutils
|
|
|
|
import docutils.parsers.rst
|
2018-12-03 18:59:09 +00:00
|
|
|
|
|
|
|
# -- Project information -----------------------------------------------------
|
|
|
|
|
2020-02-25 16:03:11 +00:00
|
|
|
project = "Tutor"
|
2019-10-17 15:20:22 +00:00
|
|
|
copyright = ""
|
2020-02-25 16:03:11 +00:00
|
|
|
author = "Overhang.io"
|
2018-12-03 18:59:09 +00:00
|
|
|
|
|
|
|
# The short X.Y version
|
2020-02-25 16:03:11 +00:00
|
|
|
version = ""
|
2018-12-03 18:59:09 +00:00
|
|
|
# The full version, including alpha/beta/rc tags
|
2020-02-25 16:03:11 +00:00
|
|
|
release = ""
|
2018-12-03 18:59:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
# -- General configuration ---------------------------------------------------
|
2020-02-25 16:03:11 +00:00
|
|
|
extensions = []
|
|
|
|
templates_path = ["_templates"]
|
|
|
|
source_suffix = ".rst"
|
|
|
|
master_doc = "index"
|
2018-12-03 18:59:09 +00:00
|
|
|
language = None
|
2020-02-25 16:03:11 +00:00
|
|
|
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
2018-12-03 18:59:09 +00:00
|
|
|
pygments_style = None
|
|
|
|
|
|
|
|
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
2020-02-25 16:03:11 +00:00
|
|
|
html_theme = "sphinx_rtd_theme"
|
2019-10-17 15:20:22 +00:00
|
|
|
html_theme_options = {
|
2020-02-25 16:03:11 +00:00
|
|
|
"logo_only": True,
|
2019-10-17 15:20:22 +00:00
|
|
|
"style_nav_header_background": "#EFEFEF",
|
|
|
|
}
|
|
|
|
html_context = {
|
2020-02-25 16:03:11 +00:00
|
|
|
"display_github": True,
|
|
|
|
"github_user": "overhangio",
|
|
|
|
"github_repo": "tutor",
|
|
|
|
"github_version": "master",
|
|
|
|
"conf_py_path": "/docs/",
|
2019-10-17 15:20:22 +00:00
|
|
|
}
|
2020-02-25 16:03:11 +00:00
|
|
|
html_static_path = ["img"]
|
2018-12-03 18:59:09 +00:00
|
|
|
|
2019-10-17 15:20:22 +00:00
|
|
|
# Custom settings
|
|
|
|
html_logo = "./img/tutor-logo.png"
|
2019-10-25 08:53:59 +00:00
|
|
|
html_favicon = "./img/favicon.png"
|
2019-10-17 15:20:22 +00:00
|
|
|
html_show_sourcelink = False
|
|
|
|
html_display_github = True
|
|
|
|
html_show_sphinx = False
|
|
|
|
html_github_user = "overhangio"
|
|
|
|
html_github_repo = "tutor"
|
|
|
|
# Images do not link to themselves
|
|
|
|
html_scaled_image_link = False
|
|
|
|
html_show_copyright = False
|
2018-12-03 18:59:09 +00:00
|
|
|
|
2019-04-22 11:29:53 +00:00
|
|
|
# Custom variables
|
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
about = {}
|
2020-02-25 16:02:39 +00:00
|
|
|
with io.open(
|
|
|
|
os.path.join(here, "..", "tutor", "__about__.py"), "rt", encoding="utf-8"
|
|
|
|
) as f:
|
2019-04-22 11:29:53 +00:00
|
|
|
exec(f.read(), about)
|
|
|
|
rst_prolog = """
|
|
|
|
.. |tutor_version| replace:: {}
|
|
|
|
""".format(
|
2020-02-25 16:02:39 +00:00
|
|
|
about["__version__"],
|
2019-04-22 11:29:53 +00:00
|
|
|
)
|
2020-02-25 16:02:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Custom directives
|
|
|
|
def youtube(
|
|
|
|
_name,
|
|
|
|
_args,
|
|
|
|
_options,
|
|
|
|
content,
|
|
|
|
_lineno,
|
|
|
|
_contentOffset,
|
|
|
|
_blockText,
|
|
|
|
_state,
|
|
|
|
_stateMachine,
|
|
|
|
):
|
|
|
|
""" Restructured text extension for inserting youtube embedded videos """
|
|
|
|
if not content:
|
|
|
|
return []
|
|
|
|
video_id = content[0]
|
|
|
|
return [
|
|
|
|
docutils.nodes.raw(
|
|
|
|
"",
|
|
|
|
"""
|
|
|
|
<iframe width="560" height="315"
|
|
|
|
src="https://www.youtube-nocookie.com/embed/{video_id}"
|
|
|
|
frameborder="0"
|
|
|
|
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>
|
|
|
|
</iframe>""".format(
|
|
|
|
video_id=video_id
|
|
|
|
),
|
|
|
|
format="html",
|
|
|
|
)
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
youtube.content = True
|
|
|
|
docutils.parsers.rst.directives.register_directive("youtube", youtube)
|