conf.py 5.1 KB

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