conf.py 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. # Configuration file for the Sphinx documentation builder.
  2. #
  3. # This file only contains a selection of the most common options. For a full
  4. # list see the documentation:
  5. # https://www.sphinx-doc.org/en/master/usage/configuration.html
  6. # -- Path setup --------------------------------------------------------------
  7. # Ensure we get the local copy of tornado instead of what's on the standard path
  8. import os
  9. import sys
  10. sys.path.insert(0, os.path.abspath(".."))
  11. sys.path.append(os.path.abspath("./_ext"))
  12. import pywebio
  13. version = release = pywebio.__version__
  14. # -- Project information -----------------------------------------------------
  15. project = 'PyWebIO'
  16. copyright = 'WangWeimin'
  17. author = 'WangWeimin'
  18. # -- General configuration ---------------------------------------------------
  19. # Add any Sphinx extension module names here, as strings. They can be
  20. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  21. # ones.
  22. extensions = [
  23. 'sphinx.ext.autodoc',
  24. # "sphinx.ext.intersphinx",
  25. "sphinx.ext.viewcode",
  26. 'sphinx_tabs.tabs',
  27. 'sphinx.ext.extlinks',
  28. 'codeblock'
  29. ]
  30. primary_domain = "py"
  31. default_role = "py:obj"
  32. # intersphinx_mapping = {"python": ("https://docs.python.org/3.6/", None)}
  33. master_doc = 'index'
  34. autodoc_member_order = 'bysource'
  35. # The language for content autogenerated by Sphinx. Refer to documentation
  36. # for a list of supported languages.
  37. #
  38. # This is also used if you do content translation via gettext catalogs.
  39. # Usually you set "language" from the command line for these cases.
  40. language = 'zh_CN'
  41. # List of patterns, relative to source directory, that match files and
  42. # directories to ignore when looking for source files.
  43. # This pattern also affects html_static_path and html_extra_path.
  44. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  45. # -- Options for HTML output -------------------------------------------------
  46. # The theme to use for HTML and HTML Help pages. See the documentation for
  47. # a list of builtin themes.
  48. #
  49. html_theme = "sphinx_rtd_theme"
  50. # Add any paths that contain custom static files (such as style sheets) here,
  51. # relative to this directory. They are copied after the builtin static files,
  52. # so a file named "default.css" will overwrite the builtin "default.css".
  53. html_static_path = ['static']
  54. def setup(app):
  55. """Configure Sphinx"""
  56. app.add_css_file('pywebio.css')
  57. # -- Extension configuration -------------------------------------------------
  58. from demos import config
  59. extlinks = {
  60. 'demo_host': (config.demo_host + '%s', 'demo_host'),
  61. 'charts_demo_host': (config.charts_demo_host + '%s', 'charts_demo_host')
  62. }
  63. from sphinx.builders.html import StandaloneHTMLBuilder
  64. StandaloneHTMLBuilder.supported_image_types = [
  65. 'image/svg+xml',
  66. 'image/gif',
  67. 'image/png',
  68. 'image/jpeg'
  69. ]