conf.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Godot Engine documentation build configuration file
  4. import sys
  5. import os
  6. # -- General configuration ------------------------------------------------
  7. needs_sphinx = "1.3"
  8. # Sphinx extension module names and templates location
  9. sys.path.append(os.path.abspath("_extensions"))
  10. extensions = [
  11. "gdscript",
  12. "godot_descriptions",
  13. "sphinx_tabs.tabs",
  14. "sphinx.ext.imgmath",
  15. ]
  16. templates_path = ["_templates"]
  17. # You can specify multiple suffix as a list of string: ['.rst', '.md']
  18. source_suffix = ".rst"
  19. source_encoding = "utf-8-sig"
  20. # The master toctree document
  21. master_doc = "index"
  22. # General information about the project
  23. project = "Godot Engine"
  24. copyright = (
  25. "2014-2018, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)"
  26. )
  27. author = "Juan Linietsky, Ariel Manzur and the Godot community"
  28. # Version info for the project, acts as replacement for |version| and |release|
  29. # The short X.Y version
  30. version = os.getenv("READTHEDOCS_VERSION", "3.0")
  31. # The full version, including alpha/beta/rc tags
  32. release = version
  33. # Language / i18n
  34. supported_languages = {
  35. "en": "Godot Engine (%s) documentation in English",
  36. "de": "Godot Engine (%s) Dokumentation auf Deutsch",
  37. "es": "Documentación de Godot Engine (%s) en español",
  38. "fr": "Documentation de Godot Engine (%s) en français",
  39. "fi": "Godot Engine (%s) dokumentaatio suomeksi",
  40. "it": "Godot Engine (%s) documentazione in italiano",
  41. "ja": "Godot Engine (%s)の日本語のドキュメント",
  42. "ko": "Godot Engine (%s) 문서 (한국어)",
  43. "pl": "Dokumentacja Godot Engine (%s) w języku polskim",
  44. "pt_BR": "Documentação da Godot Engine (%s) em Português Brasileiro",
  45. "ru": "Документация Godot Engine (%s) на русском языке",
  46. "uk": "Документація до Godot Engine (%s) українською мовою",
  47. "zh_CN": "Godot Engine (%s) 简体中文文档",
  48. }
  49. language = os.getenv("READTHEDOCS_LANGUAGE", "en")
  50. if not language in supported_languages.keys():
  51. print("Unknown language: " + language)
  52. print("Supported languages: " + ", ".join(supported_languages.keys()))
  53. print(
  54. "The configured language is either wrong, or it should be added to supported_languages in conf.py. Falling back to 'en'."
  55. )
  56. language = "en"
  57. exclude_patterns = ["_build"]
  58. # fmt: off
  59. # These imports should *not* be moved to the start of the file,
  60. # they depend on the sys.path.append call registering "extensions".
  61. from gdscript import GDScriptLexer
  62. from sphinx.highlighting import lexers
  63. lexers["gdscript"] = GDScriptLexer()
  64. # fmt: on
  65. # Pygments (syntax highlighting) style to use
  66. pygments_style = "sphinx"
  67. highlight_language = "gdscript"
  68. # -- Options for HTML output ----------------------------------------------
  69. # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
  70. on_rtd = os.environ.get("READTHEDOCS", None) == "True"
  71. import sphinx_rtd_theme
  72. html_theme = "sphinx_rtd_theme"
  73. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  74. if on_rtd:
  75. using_rtd_theme = True
  76. # Theme options
  77. html_theme_options = {
  78. # 'typekit_id': 'hiw1hhg',
  79. # 'analytics_id': '',
  80. # 'sticky_navigation': True # Set to False to disable the sticky nav while scrolling.
  81. "logo_only": True, # if we have a html_logo below, this shows /only/ the logo with no title text
  82. "collapse_navigation": False, # Collapse navigation (False makes it tree-like)
  83. # 'display_version': True, # Display the docs version
  84. # 'navigation_depth': 4, # Depth of the headers shown in the navigation bar
  85. }
  86. html_title = supported_languages[language] % version
  87. # VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
  88. html_context = {
  89. "display_github": True, # Integrate GitHub
  90. "github_user": "godotengine", # Username
  91. "github_repo": "godot-docs", # Repo name
  92. "github_version": "master", # Version
  93. "conf_py_path": "/", # Path in the checkout to the docs root
  94. "godot_inject_language_links": True,
  95. "godot_docs_supported_languages": list(supported_languages.keys()),
  96. "godot_docs_basepath": "https://docs.godotengine.org/",
  97. "godot_docs_suffix": ".html",
  98. "godot_default_lang": "en",
  99. "godot_canonical_version": "stable",
  100. # Distinguish local development website from production website.
  101. # This prevents people from looking for changes on the production website after making local changes :)
  102. "godot_title_prefix": "" if on_rtd else "(DEV) ",
  103. }
  104. html_logo = "img/docs_logo.png"
  105. # Output file base name for HTML help builder
  106. htmlhelp_basename = "GodotEnginedoc"
  107. # -- Options for reStructuredText parser ----------------------------------
  108. # Enable directives that insert the contents of external files
  109. file_insertion_enabled = False
  110. # -- Options for LaTeX output ---------------------------------------------
  111. # Grouping the document tree into LaTeX files. List of tuples
  112. # (source start file, target name, title,
  113. # author, documentclass [howto, manual, or own class]).
  114. latex_documents = [
  115. (
  116. master_doc,
  117. "GodotEngine.tex",
  118. "Godot Engine Documentation",
  119. "Juan Linietsky, Ariel Manzur and the Godot community",
  120. "manual",
  121. ),
  122. ]
  123. # -- Options for linkcheck builder ----------------------------------------
  124. # disable checking urls with about.html#this_part_of_page anchors
  125. linkcheck_anchors = False
  126. linkcheck_timeout = 10
  127. # -- I18n settings --------------------------------------------------------
  128. locale_dirs = ["../sphinx/po/"]
  129. gettext_compact = False