|
1 | | -"""config file for sphinx""" |
| 1 | +from sphinx.highlighting import lexers |
| 2 | +from pygments.lexers.web import PhpLexer |
2 | 3 |
|
3 | | -import os |
4 | | -import yaml |
| 4 | +lexers['php'] = PhpLexer(startinline=True, linenos=1) |
| 5 | +lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) |
5 | 6 |
|
6 | 7 | # Configuration file for the Sphinx documentation builder. |
7 | 8 | # |
|
11 | 12 | # -- Project information ----------------------------------------------------- |
12 | 13 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
13 | 14 |
|
14 | | -project = "JWT-Auth" |
15 | | -copyright = "2024, James Read" |
16 | | -author = "James Read" |
| 15 | +project = 'jwt-auth' |
| 16 | +copyright = '2025, James Read' |
| 17 | +author = 'James Read' |
| 18 | +release = '1.1.0' |
17 | 19 |
|
18 | 20 | # -- General configuration --------------------------------------------------- |
19 | 21 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
20 | 22 |
|
21 | 23 | extensions = [ |
22 | | - "sphinx.ext.githubpages", |
23 | | - "sphinx_multiversion", |
| 24 | + 'sphinx.ext.autodoc', |
| 25 | + 'sphinx.ext.doctest', |
| 26 | + 'sphinx.ext.todo', |
| 27 | + 'sphinx.ext.coverage', |
| 28 | + 'sphinx.ext.imgmath', |
| 29 | + 'sphinx.ext.viewcode', |
| 30 | + 'sphinx.ext.githubpages', |
| 31 | + 'sphinx.ext.napoleon', |
| 32 | + 'sphinx_rtd_theme', |
| 33 | + 'sphinx_multiversion', |
24 | 34 | ] |
25 | | -templates_path = ["_templates"] |
26 | | -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "bin", "lib", "lib64"] |
27 | 35 |
|
28 | | -# -- Options for HTML output ------------------------------------------------- |
29 | | -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
30 | | - |
31 | | -html_theme = "sphinx_rtd_theme" |
32 | | -html_static_path = [] |
33 | | -html_baseurl = os.environ.get("pages_root") |
34 | | -html_sidebars = { |
35 | | - "**": ["versions.html"], |
36 | | -} |
37 | | - |
38 | | -locale_dirs = ["locale/"] # path is example but recommended. |
39 | | -gettext_compact = False # optional. |
40 | | - |
41 | | -language = os.environ.get("current_language") |
42 | | -version = os.environ.get("current_version") |
43 | | - |
44 | | -build_all_docs = os.environ.get("build_all_docs") |
45 | | -pages_root = os.environ.get("pages_root", "/") |
| 36 | +templates_path = ['_templates'] |
| 37 | +exclude_patterns = ['.venv', 'bin', 'build', 'include', 'lib','lib64'] |
46 | 38 |
|
47 | | -html_context = { |
48 | | - "current_language": language, |
49 | | - "languages": [ |
50 | | - {"name": language, "url": f"/{version}/{language}"}, |
51 | | - ], |
52 | | - "current_version": {"name": version}, |
53 | | - "versions": {"tags": [], "branches": [{"name": "main", "url": pages_root}]}, |
54 | | -} |
| 39 | +root_doc = 'index' |
55 | 40 |
|
56 | | - |
57 | | -def meta(current_language: str) -> None: |
58 | | - """ |
59 | | - adds meta data to html_context versions |
60 | | - """ |
61 | | - with open("versions.yaml", "r", encoding="UTF-8") as yaml_file: |
62 | | - docs = yaml.safe_load(yaml_file) |
63 | | - for lang in docs[version].get("languages", []): |
64 | | - found = next( |
65 | | - (item for item in html_context["languages"] if item["name"] == lang), |
66 | | - None, |
67 | | - ) |
68 | | - if found is None: |
69 | | - html_context["languages"].append( |
70 | | - { |
71 | | - "name": lang, |
72 | | - "url": f"/{version}/{lang}", |
73 | | - } |
74 | | - ) |
75 | | - |
76 | | - for label, details in docs.items(): |
77 | | - html_context["versions"]["tags"].append( |
78 | | - { |
79 | | - "name": details.get("tag"), |
80 | | - "url": f"/jwt-auth/{label}/{current_language}", |
81 | | - } |
82 | | - ) |
83 | | - |
84 | | - |
85 | | -meta(language) |
| 41 | +# -- Options for HTML output ------------------------------------------------- |
| 42 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 43 | +html_theme = 'sphinx_rtd_theme' |
| 44 | +highlight_language = "php" |
| 45 | + |
| 46 | +smv_tag_whitelist = r'^.*$' |
| 47 | +smv_branch_whitelist = r'^(\d\.x|main)$' |
| 48 | +smv_remote_whitelist = r'^origin$' |
| 49 | +smv_released_pattern = r'^tags/.*$' |
| 50 | +smv_outputdir_format = '{ref.name}' |
| 51 | +smv_prefer_remote_refs = False |
0 commit comments