1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
import os
import re
import sys
from pathlib import Path
import sphinx_rtd_theme
os.environ["DJANGO_SETTINGS_MODULE"] = "example.settings"
# import project
sys.path.insert(0, str(Path("../").resolve()))
project = "django-tables2"
with open("../django_tables2/__init__.py", "rb") as f:
release = str(re.search('__version__ = "(.+?)"', f.read().decode()).group(1))
version = release.rpartition(".")[0]
default_role = "py:obj"
# symlink CHANGELOG.md from repo root to the pages dir.
basedir = Path(__file__).parent.parent
filename = "CHANGELOG.md"
target = basedir / "docs" / "pages" / filename
if not target.is_symlink():
target.symlink_to(basedir / filename)
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.doctest",
"sphinxcontrib.jquery",
"sphinxcontrib.spelling",
"myst_parser",
]
intersphinx_mapping = {
"python": ("/usr/share/doc/python3-doc/html", None),
"django": ("/usr/share/doc/python-django-doc/html", None),
}
master_doc = "index"
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_static_path = ["_static"]
# -- Options for Spelling output ------------------------------------------
# String specifying the language, as understood by PyEnchant and enchant.
# Defaults to en_US for US English.
spelling_lang = "en_US"
# String specifying a file containing a list of words known to be spelled
# correctly but that do not appear in the language dictionary selected by
# spelling_lang. The file should contain one word per line.
spelling_word_list_filename = "spelling_wordlist.txt"
# Boolean controlling whether suggestions for misspelled words are printed.
# Defaults to False.
spelling_show_suggestions = True
myst_heading_anchors = 3
|