123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- import sys
- from os.path import abspath, dirname, join
- from sphinx import version_info as sphinx_version
- sys.setrecursionlimit(2000)
- sys.path.insert(1, dirname(dirname(abspath(__file__))))
- sys.path.append(abspath(join(dirname(__file__), "_ext")))
- import github_links
- needs_sphinx = "4.5.0"
- extensions = [
- "djangodocs",
- "sphinx.ext.extlinks",
- "sphinx.ext.intersphinx",
- "sphinx.ext.autosectionlabel",
- "sphinx.ext.linkcode",
- ]
- autosectionlabel_prefix_document = True
- autosectionlabel_maxdepth = 2
- linkcheck_ignore = [
-
- r"^https?://(?:127\.0\.0\.1|\[::1\])(?::\d+)?/",
- r"^https?://(?:[^/.]+\.)*example\.(?:com|net|org)(?::\d+)?/",
- r"^https?://(?:[^/.]+\.)*(?:example|invalid|localhost|test)(?::\d+)?/",
-
- r"^https://github\.com/[^/]+/[^/]+/fork",
- r"^https://code\.djangoproject\.com/github/login",
- r"^https://code\.djangoproject\.com/newticket",
- r"^https://(?:code|www)\.djangoproject\.com/admin/",
- r"^https://www\.djangoproject\.com/community/add/blogs/",
- r"^https://www\.google\.com/webmasters/tools/ping",
- r"^https://search\.google\.com/search-console/welcome",
-
- r"^https://web\.libera\.chat/#",
- r"^https://github\.com/[^#]+#L\d+-L\d+$",
- r"^https://help\.apple\.com/itc/podcasts_connect/#/itc",
-
- r"^https://tools\.ietf\.org/html/rfc1123\.html#section-",
- ]
- if "spelling" in sys.argv:
- extensions.append("sphinxcontrib.spelling")
- spelling_lang = "en_US"
- spelling_word_list_filename = "spelling_wordlist"
- spelling_warning = True
- source_suffix = {".txt": "restructuredtext"}
- root_doc = "contents"
- toc_object_entries = False
- project = "Django"
- copyright = "Django Software Foundation and contributors"
- version = "6.0"
- try:
- from django import VERSION, get_version
- except ImportError:
- release = version
- else:
- def django_release():
- pep440ver = get_version()
- if VERSION[3:5] == ("alpha", 0) and "dev" not in pep440ver:
- return pep440ver + ".dev"
- return pep440ver
- release = django_release()
- django_next_version = "6.0"
- extlinks = {
- "bpo": ("https://bugs.python.org/issue?@action=redirect&bpo=%s", "bpo-%s"),
- "commit": ("https://github.com/django/django/commit/%s", "%s"),
- "pypi": ("https://pypi.org/project/%s/", "%s"),
-
- "source": ("https://github.com/django/django/blob/main/%s", "%s"),
- "ticket": ("https://code.djangoproject.com/ticket/%s", "#%s"),
- }
- if sphinx_version < (8, 1):
- extlinks["cve"] = ("https://www.cve.org/CVERecord?id=CVE-%s", "CVE-%s")
- locale_dirs = ["locale/"]
- today_fmt = "%B %d, %Y"
- exclude_patterns = ["_build", "_theme", "requirements.txt"]
- default_role = "default-role-error"
- add_function_parentheses = True
- add_module_names = False
- show_authors = False
- pygments_style = "trac"
- intersphinx_mapping = {
- "python": ("https://docs.python.org/3", None),
- "sphinx": ("https://www.sphinx-doc.org/en/master", None),
- "psycopg": ("https://www.psycopg.org/psycopg3/docs", None),
- }
- intersphinx_cache_limit = 90
- suppress_warnings = ["app.add_directive"]
- html_theme = "djangodocs"
- html_theme_path = ["_theme"]
- html_last_updated_fmt = "%b %d, %Y"
- html_additional_pages = {}
- htmlhelp_basename = "Djangodoc"
- modindex_common_prefix = ["django."]
- rst_epilog = """
- .. |django-users| replace:: :ref:`django-users <django-users-mailing-list>`
- .. |django-developers| replace:: :ref:`django-developers <django-developers-mailing-list>`
- .. |django-announce| replace:: :ref:`django-announce <django-announce-mailing-list>`
- .. |django-updates| replace:: :ref:`django-updates <django-updates-mailing-list>`
- """
- latex_engine = "xelatex"
- latex_use_xindy = False
- latex_elements = {
- "fontpkg": r"""
- \setmainfont{Symbola}
- """,
- "preamble": r"""
- \usepackage[UTF8]{ctex}
- \xeCJKDeclareCharClass{HalfLeft}{"2018, "201C}
- \xeCJKDeclareCharClass{HalfRight}{
- "00B7, "2019, "201D, "2013, "2014, "2025, "2026, "2E3A
- }
- \usepackage{newunicodechar}
- \newunicodechar{π}{\ensuremath{\pi}}
- \newunicodechar{≤}{\ensuremath{\le}}
- \newunicodechar{≥}{\ensuremath{\ge}}
- \newunicodechar{♥}{\ensuremath{\heartsuit}}
- \newunicodechar{…}{\ensuremath{\ldots}}
- """,
- }
- latex_documents = [
- (
- "contents",
- "django.tex",
- "Django Documentation",
- "Django Software Foundation",
- "manual",
- ),
- ]
- man_pages = [
- (
- "ref/django-admin",
- "django-admin",
- "Utility script for the Django web framework",
- ["Django Software Foundation"],
- 1,
- )
- ]
- texinfo_documents = [
- (
- root_doc,
- "django",
- "",
- "",
- "Django",
- "Documentation of the Django framework",
- "Web development",
- False,
- )
- ]
- epub_title = project
- epub_author = "Django Software Foundation"
- epub_publisher = "Django Software Foundation"
- epub_copyright = copyright
- epub_theme = "djangodocs-epub"
- epub_cover = ("", "epub-cover.html")
- def version_github_linkcode_resolve(domain, info):
- return github_links.github_linkcode_resolve(
- domain, info, version=version, next_version=django_next_version
- )
- linkcode_resolve = version_github_linkcode_resolve
|