conf.py 5.1 KB

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