123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- # -*- coding: utf-8 -*-
- #
- # Godot Engine documentation build configuration file
- import sphinx_rtd_theme
- import sys
- import os
- # -- General configuration ------------------------------------------------
- needs_sphinx = "1.3"
- # Sphinx extension module names and templates location
- sys.path.append(os.path.abspath("_extensions"))
- extensions = [
- "gdscript",
- "sphinx_search.extension",
- "sphinx_tabs.tabs",
- "sphinx.ext.imgmath",
- ]
- templates_path = ["_templates"]
- # You can specify multiple suffix as a list of string: ['.rst', '.md']
- source_suffix = ".rst"
- source_encoding = "utf-8-sig"
- # The master toctree document
- master_doc = "index"
- # General information about the project
- project = "Godot Engine"
- copyright = (
- "2014-2020, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)"
- )
- author = "Juan Linietsky, Ariel Manzur and the Godot community"
- # Version info for the project, acts as replacement for |version| and |release|
- # The short X.Y version
- version = os.getenv("READTHEDOCS_VERSION", "latest")
- # The full version, including alpha/beta/rc tags
- release = version
- # Parse Sphinx tags passed from RTD via environment
- env_tags = os.getenv("SPHINX_TAGS")
- if env_tags is not None:
- for tag in env_tags.split(","):
- print("Adding Sphinx tag: %s" % tag.strip())
- tags.add(tag.strip()) # noqa: F821
- # Language / i18n
- supported_languages = ['en', 'de', 'es', 'fr', 'fi', 'it', 'ja', 'ko', 'pl', 'pt-br', 'ru', 'uk', 'zh-cn']
- language = os.getenv("READTHEDOCS_LANGUAGE", "en")
- if not language in supported_languages:
- print("Unknown language: " + language)
- print("Supported languages: " + ", ".join(supported_languages))
- print("This is an error or needs to be added to supported_languages in conf.py")
- is_i18n = tags.has("i18n") # noqa: F821
- exclude_patterns = ["_build"]
- # fmt: off
- # These imports should *not* be moved to the start of the file,
- # they depend on the sys.path.append call registering "_extensions".
- # GDScript syntax highlighting
- from gdscript import GDScriptLexer
- from sphinx.highlighting import lexers
- lexers["gdscript"] = GDScriptLexer()
- # fmt: on
- # Pygments (syntax highlighting) style to use
- pygments_style = "sphinx"
- highlight_language = "gdscript"
- # -- Options for HTML output ----------------------------------------------
- # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
- on_rtd = os.environ.get("READTHEDOCS", None) == "True"
- html_theme = "sphinx_rtd_theme"
- html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
- if on_rtd:
- using_rtd_theme = True
- # Theme options
- html_theme_options = {
- # if we have a html_logo below, this shows /only/ the logo with no title text
- "logo_only": True,
- # Collapse navigation (False makes it tree-like)
- "collapse_navigation": False,
- }
- # VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
- html_context = {
- "display_github": not is_i18n, # Integrate GitHub
- "github_user": "godotengine", # Username
- "github_repo": "godot-docs", # Repo name
- "github_version": "master", # Version
- "conf_py_path": "/", # Path in the checkout to the docs root
- "godot_inject_language_links": True,
- "godot_docs_supported_languages": supported_languages,
- "godot_docs_basepath": "https://docs.godotengine.org/",
- "godot_docs_suffix": ".html",
- "godot_default_lang": "en",
- "godot_canonical_version": "stable",
- }
- html_logo = "img/docs_logo.png"
- # These folders are copied to the documentation's HTML output
- html_static_path = ["_static"]
- html_extra_path = ["robots.txt"]
- # These paths are either relative to html_static_path
- # or fully qualified paths (eg. https://...)
- html_css_files = [
- "css/custom.css",
- ]
- html_js_files = [
- "js/custom.js",
- ]
- # Output file base name for HTML help builder
- htmlhelp_basename = "GodotEnginedoc"
- # -- Options for reStructuredText parser ----------------------------------
- # Enable directives that insert the contents of external files
- file_insertion_enabled = False
- # -- Options for LaTeX output ---------------------------------------------
- # Grouping the document tree into LaTeX files. List of tuples
- # (source start file, target name, title,
- # author, documentclass [howto, manual, or own class]).
- latex_documents = [
- (
- master_doc,
- "GodotEngine.tex",
- "Godot Engine Documentation",
- "Juan Linietsky, Ariel Manzur and the Godot community",
- "manual",
- ),
- ]
- # -- Options for linkcheck builder ----------------------------------------
- # disable checking urls with about.html#this_part_of_page anchors
- linkcheck_anchors = False
- linkcheck_timeout = 10
- # -- I18n settings --------------------------------------------------------
- locale_dirs = ["../sphinx/po/"]
- gettext_compact = False
- # Couldn't find a way to retrieve variables nor do advanced string
- # concat from reST, so had to hardcode this in the "epilog" added to
- # all pages. This is used in index.rst to display the Weblate badge.
- # On English pages, the badge points to the language-neutral engage page.
- rst_epilog = """
- .. |weblate_widget| image:: https://hosted.weblate.org/widgets/godot-engine/{image_locale}/godot-docs/287x66-white.png
- :alt: Translation status
- :target: https://hosted.weblate.org/engage/godot-engine{target_locale}/?utm_source=widget
- """.format(
- image_locale="-" if language == "en" else language,
- target_locale="" if language == "en" else "/" + language,
- )
|