conf.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 = ['gdscript', 'sphinx_tabs.tabs', 'sphinx.ext.imgmath']
  11. templates_path = ['_templates']
  12. # You can specify multiple suffix as a list of string: ['.rst', '.md']
  13. source_suffix = '.rst'
  14. source_encoding = 'utf-8-sig'
  15. # The master toctree document
  16. master_doc = 'index'
  17. # General information about the project
  18. project = 'Godot Engine'
  19. copyright = '2014-2019, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)'
  20. author = 'Juan Linietsky, Ariel Manzur and the Godot community'
  21. # Version info for the project, acts as replacement for |version| and |release|
  22. # The short X.Y version
  23. version = 'latest'
  24. # The full version, including alpha/beta/rc tags
  25. release = 'latest'
  26. # Parse Sphinx tags passed from RTD via environment
  27. env_tags = os.getenv('SPHINX_TAGS')
  28. if env_tags != None:
  29. for tag in env_tags.split(','):
  30. print("Adding Sphinx tag: %s" % tag.strip())
  31. tags.add(tag.strip())
  32. # Language / i18n
  33. language = os.getenv('READTHEDOCS_LANGUAGE', 'en')
  34. is_i18n = tags.has('i18n')
  35. exclude_patterns = ['_build']
  36. # GDScript syntax highlighting
  37. from gdscript import GDScriptLexer
  38. from sphinx.highlighting import lexers
  39. lexers['gdscript'] = GDScriptLexer()
  40. # Pygments (syntax highlighting) style to use
  41. pygments_style = 'sphinx'
  42. highlight_language = 'gdscript'
  43. # -- Options for HTML output ----------------------------------------------
  44. # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
  45. on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
  46. import sphinx_rtd_theme
  47. html_theme = 'sphinx_rtd_theme'
  48. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  49. if on_rtd:
  50. using_rtd_theme = True
  51. # Theme options
  52. html_theme_options = {
  53. # 'typekit_id': 'hiw1hhg',
  54. # 'analytics_id': '',
  55. # 'sticky_navigation': True # Set to False to disable the sticky nav while scrolling.
  56. 'logo_only': True, # if we have a html_logo below, this shows /only/ the logo with no title text
  57. 'collapse_navigation': False, # Collapse navigation (False makes it tree-like)
  58. # 'display_version': True, # Display the docs version
  59. # 'navigation_depth': 4, # Depth of the headers shown in the navigation bar
  60. }
  61. # VCS options: https://docs.readthedocs.io/en/latest/vcs.html#github
  62. html_context = {
  63. "display_github": not is_i18n, # Integrate GitHub
  64. "github_user": "godotengine", # Username
  65. "github_repo": "godot-docs", # Repo name
  66. "github_version": "master", # Version
  67. "conf_py_path": "/", # Path in the checkout to the docs root
  68. }
  69. html_logo = 'img/docs_logo.png'
  70. # Output file base name for HTML help builder
  71. htmlhelp_basename = 'GodotEnginedoc'
  72. # -- Options for reStructuredText parser ----------------------------------
  73. # Enable directives that insert the contents of external files
  74. file_insertion_enabled = False
  75. # -- Options for LaTeX output ---------------------------------------------
  76. # Grouping the document tree into LaTeX files. List of tuples
  77. # (source start file, target name, title,
  78. # author, documentclass [howto, manual, or own class]).
  79. latex_documents = [
  80. (master_doc, 'GodotEngine.tex', 'Godot Engine Documentation',
  81. 'Juan Linietsky, Ariel Manzur and the Godot community', 'manual'),
  82. ]
  83. # -- Options for linkcheck builder ----------------------------------------
  84. # disable checking urls with about.html#this_part_of_page anchors
  85. linkcheck_anchors = False
  86. linkcheck_timeout = 10
  87. # -- I18n settings --------------------------------------------------------
  88. locale_dirs = ['../sphinx/po/']
  89. gettext_compact = False
  90. # Exclude class reference when marked with tag i18n.
  91. if is_i18n:
  92. exclude_patterns = ['classes']
  93. # Couldn't find a way to retrieve variables nor do advanced string
  94. # concat from reST, so had to hardcode this in the "epilog" added to
  95. # all pages. This is used in index.rst to display the Weblate badge.
  96. rst_epilog = """
  97. .. |weblate_widget| image:: https://hosted.weblate.org/widgets/godot-engine/{weblate_locale}/godot-docs/287x66-white.png
  98. :alt: Translation status
  99. :target: https://hosted.weblate.org/engage/godot-engine/{weblate_locale}/?utm_source=widget
  100. """.format(weblate_locale = language)