2
0

conf.py 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. #
  2. # Wagtail documentation build configuration file, created by
  3. # sphinx-quickstart on Tue Jan 14 17:38:55 2014.
  4. #
  5. # This file is execfile()d with the current directory set to its
  6. # containing dir.
  7. #
  8. # Note that not all possible configuration values are present in this
  9. # autogenerated file.
  10. #
  11. # All configuration values have a default; values that are commented out
  12. # serve to show the default.
  13. import os
  14. import sys
  15. from datetime import datetime
  16. import django
  17. import sphinx_wagtail_theme
  18. from sphinx.builders.html import StandaloneHTMLBuilder
  19. from wagtail import VERSION, __version__
  20. # use png images as fallback, required to build pdf
  21. StandaloneHTMLBuilder.supported_image_types = ["image/gif", "image/png"]
  22. # on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org
  23. on_rtd = os.environ.get("READTHEDOCS", None) == "True"
  24. html_theme = "sphinx_wagtail_theme"
  25. html_theme_path = [sphinx_wagtail_theme.get_html_theme_path()]
  26. html_theme_options = {
  27. "project_name": "Wagtail Documentation",
  28. "github_url": "https://github.com/wagtail/wagtail/blob/main/docs/",
  29. }
  30. # If extensions (or modules to document with autodoc) are in another directory,
  31. # add these directories to sys.path here. If the directory is relative to the
  32. # documentation root, use os.path.abspath to make it absolute, like shown here.
  33. sys.path.insert(0, os.path.abspath(".."))
  34. # Autodoc may need to import some models modules which require django settings
  35. # be configured
  36. os.environ["DJANGO_SETTINGS_MODULE"] = "wagtail.test.settings"
  37. django.setup()
  38. # Use SQLite3 database engine so it doesn't attempt to use psycopg2 on RTD
  39. os.environ["DATABASE_ENGINE"] = "django.db.backends.sqlite3"
  40. # -- General configuration ------------------------------------------------
  41. # If your documentation needs a minimal Sphinx version, state it here.
  42. # needs_sphinx = '1.0'
  43. # Add any Sphinx extension module names here, as strings. They can be
  44. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  45. # ones.
  46. extensions = [
  47. "sphinx.ext.autodoc",
  48. "sphinx.ext.intersphinx",
  49. "sphinx_copybutton",
  50. "myst_parser",
  51. "sphinx_wagtail_theme",
  52. ]
  53. autodoc_type_aliases = {
  54. "File": "django.core.files.File",
  55. }
  56. # Silence warnings that are not due to missing references:
  57. nitpick_ignore = [
  58. # Sphinx currently cannot resolve type hint names, warns "target not found":
  59. ("py:class", "wagtail.images.models.Filter"),
  60. ("py:class", "HttpRequest"),
  61. ("py:class", "RouteResult"),
  62. ("py:class", "wagtail.blocks.base.Block"),
  63. ("py:class", "wagtail.blocks.field_block.BaseChoiceBlock"),
  64. ("py:class", "wagtail.blocks.field_block.ChooserBlock"),
  65. # Warnings due factors other than type hints:
  66. ("py:class", "wagtail.documents.views.chooser.BaseDocumentChooserBlock"),
  67. ("py:class", "wagtail.blocks.struct_block.BaseStructBlock"),
  68. ("py:class", "wagtail.blocks.stream_block.BaseStreamBlock"),
  69. ]
  70. # We have .txt and .ico files in the static directory that trigger unknown mime
  71. # type warnings when building the epub and are ignored by the builder. For the
  72. # table markup files, they are already rendered in the output. Other files are
  73. # not relevant to the epub. Suppress the warnings so we don't have to explicitly
  74. # list the files in `epub_exclude_files`.
  75. suppress_warnings = [
  76. "epub.unknown_project_files",
  77. ]
  78. if not on_rtd:
  79. extensions.append("sphinxcontrib.spelling")
  80. # Add any paths that contain templates here, relative to this directory.
  81. templates_path = ["_templates"]
  82. # The suffix of source filenames.
  83. source_suffix = ".rst"
  84. # The encoding of source files.
  85. # source_encoding = 'utf-8-sig'
  86. # The master toctree document.
  87. master_doc = "index"
  88. # General information about the project.
  89. project = "Wagtail Documentation"
  90. copyright = f"{datetime.now().year}, Wagtail core team and contributors. BSD license"
  91. # The version info for the project you're documenting, acts as replacement for
  92. # |version| and |release|, also used in various other places throughout the
  93. # built documents.
  94. # The short X.Y version.
  95. version = f"{VERSION[0]}.{VERSION[1]}"
  96. # The full version, including alpha/beta/rc tags.
  97. release = __version__
  98. # The language for content autogenerated by Sphinx. Refer to documentation
  99. # for a list of supported languages.
  100. # language = None
  101. # There are two options for replacing |today|: either, you set today to some
  102. # non-false value, then it is used:
  103. # today = ''
  104. # Else, today_fmt is used as the format for a strftime call.
  105. # today_fmt = '%B %d, %Y'
  106. # List of patterns, relative to source directory, that match files and
  107. # directories to ignore when looking for source files.
  108. exclude_patterns = ["_build", "README.md"]
  109. # The reST default role (used for this markup: `text`) to use for all
  110. # documents.
  111. # default_role = None
  112. # If true, '()' will be appended to :func: etc. cross-reference text.
  113. # add_function_parentheses = True
  114. # If true, the current module name will be prepended to all description
  115. # unit titles (such as .. function::).
  116. # add_module_names = True
  117. # If true, sectionauthor and moduleauthor directives will be shown in the
  118. # output. They are ignored by default.
  119. # show_authors = False
  120. # The name of the Pygments (syntax highlighting) style to use.
  121. pygments_style = None
  122. # A list of ignored prefixes for module index sorting.
  123. # modindex_common_prefix = []
  124. # If true, keep warnings as "system message" paragraphs in the built documents.
  125. # keep_warnings = False
  126. # splhinxcontrib.spelling settings
  127. spelling_lang = "en_GB"
  128. spelling_word_list_filename = "spelling_wordlist.txt"
  129. # sphinx.ext.intersphinx settings
  130. intersphinx_mapping = {
  131. "django": (
  132. "https://docs.djangoproject.com/en/stable/",
  133. "https://docs.djangoproject.com/en/stable/_objects/",
  134. )
  135. }
  136. myst_url_schemes = {
  137. "https": None,
  138. "http": None,
  139. "mailto": None,
  140. }
  141. # -- Options for HTML output ----------------------------------------------
  142. # Theme options are theme-specific and customise the look and feel of a theme
  143. # further. For a list of options available for each theme, see the
  144. # documentation.
  145. # html_theme_options = {}
  146. # The name for this set of Sphinx documents. If None, it defaults to
  147. # "<project> v<release> documentation".
  148. # html_title = None
  149. # A shorter title for the navigation bar. Default is the same as html_title.
  150. # html_short_title = None
  151. # The name of an image file (relative to this directory) to place at the top
  152. # of the sidebar.
  153. # html_logo = 'logo.png'
  154. # The name of an image file (within the static path) to use as favicon of the
  155. # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
  156. # pixels large.
  157. html_favicon = "favicon.ico"
  158. # Add any paths that contain custom static files (such as style sheets) here,
  159. # relative to this directory. They are copied after the builtin static files,
  160. # so a file named "default.css" will overwrite the builtin "default.css".
  161. html_static_path = ["_static"]
  162. # Add any extra paths that contain custom files (such as robots.txt or
  163. # .htaccess) here, relative to this directory. These files are copied
  164. # directly to the root of the documentation.
  165. html_extra_path = ["public"]
  166. # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
  167. # using the given strftime format.
  168. # html_last_updated_fmt = '%b %d, %Y'
  169. # If true, SmartyPants will be used to convert quotes and dashes to
  170. # typographically correct entities.
  171. # html_use_smartypants = True
  172. # Custom sidebar templates, maps document names to template names.
  173. # html_sidebars = {}
  174. # Additional templates that should be rendered to pages, maps page names to
  175. # template names.
  176. # html_additional_pages = {}
  177. # If false, no module index is generated.
  178. # html_domain_indices = True
  179. # If false, no index is generated.
  180. # Since we are implementing search with Algolia DocSearch, we do not need Sphinx to
  181. # generate its own index. It might not hurt to keep the Sphinx index, but it
  182. # could potentially speed up the build process.
  183. html_use_index = False
  184. # If true, the index is split into individual pages for each letter.
  185. # html_split_index = False
  186. # If true, links to the reST sources are added to the pages.
  187. # html_show_sourcelink = True
  188. # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
  189. # html_show_sphinx = True
  190. # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
  191. # html_show_copyright = True
  192. # If true, an OpenSearch description file will be output, and all pages will
  193. # contain a <link> tag referring to it. The value of this option must be the
  194. # base URL from which the finished HTML is served.
  195. # html_use_opensearch = ''
  196. # This is the file name suffix for HTML files (for example ".xhtml").
  197. # html_file_suffix = None
  198. # Output file base name for HTML help builder.
  199. htmlhelp_basename = "Wagtaildoc"
  200. # -- Options for LaTeX output ---------------------------------------------
  201. # Xelatex engine is required to include unicode characters in the doc
  202. latex_engine = "xelatex"
  203. latex_elements = {
  204. # The paper size ('letterpaper' or 'a4paper').
  205. # 'papersize': 'letterpaper',
  206. # The font size ('10pt', '11pt' or '12pt').
  207. # 'pointsize': '10pt',
  208. # Additional stuff for the LaTeX preamble.
  209. # 'preamble': '',
  210. }
  211. # Grouping the document tree into LaTeX files. List of tuples
  212. # (source start file, target name, title,
  213. # author, documentclass [howto, manual, or own class]).
  214. latex_documents = [
  215. (
  216. "index",
  217. "Wagtail.tex",
  218. "Wagtail Documentation",
  219. "Wagtail core team and contributors",
  220. "manual",
  221. ),
  222. ]
  223. # The name of an image file (relative to this directory) to place at the top of
  224. # the title page.
  225. # latex_logo = None
  226. # For "manual" documents, if this is true, then toplevel headings are parts,
  227. # not chapters.
  228. # latex_use_parts = False
  229. # If true, show page references after internal links.
  230. # latex_show_pagerefs = False
  231. # If true, show URL addresses after external links.
  232. # latex_show_urls = False
  233. # Documents to append as an appendix to all manuals.
  234. # latex_appendices = []
  235. # If false, no module index is generated.
  236. # latex_domain_indices = True
  237. # -- Options for manual page output ---------------------------------------
  238. # One entry per manual page. List of tuples
  239. # (source start file, name, description, authors, manual section).
  240. man_pages = [
  241. (
  242. "index",
  243. "wagtail",
  244. "Wagtail Documentation",
  245. ["Wagtail core team and contributors"],
  246. 1,
  247. )
  248. ]
  249. # If true, show URL addresses after external links.
  250. # man_show_urls = False
  251. # -- Options for Texinfo output -------------------------------------------
  252. # Grouping the document tree into Texinfo files. List of tuples
  253. # (source start file, target name, title, author,
  254. # dir menu entry, description, category)
  255. texinfo_documents = [
  256. (
  257. "index",
  258. "Wagtail",
  259. "Wagtail Documentation",
  260. "Wagtail core team and contributors",
  261. "Wagtail",
  262. "An open source content management system built on Django.",
  263. "Miscellaneous",
  264. ),
  265. ]
  266. # Documents to append as an appendix to all manuals.
  267. # texinfo_appendices = []
  268. # If false, no module index is generated.
  269. # texinfo_domain_indices = True
  270. # How to display URL addresses: 'footnote', 'no', or 'inline'.
  271. # texinfo_show_urls = 'footnote'
  272. # If true, do not generate a @detailmenu in the "Top" node's menu.
  273. # texinfo_no_detailmenu = False
  274. # -- Options for Epub output ---------------------------------------------------
  275. # Bibliographic Dublin Core info.
  276. epub_title = project
  277. epub_author = "Wagtail core team and contributors"
  278. epub_publisher = "Wagtail"
  279. epub_copyright = copyright
  280. def setup(app):
  281. app.add_js_file("js/banner.js")