|
12 | 12 |
|
13 | 13 | # -- Project information ----------------------------------------------------- |
14 | 14 |
|
15 | | -project = 'setuptools-rust' |
16 | | -copyright = '2021, The PyO3 Contributors' |
17 | | -author = 'The PyO3 Contributors' |
| 15 | +project = "setuptools-rust" |
| 16 | +copyright = "2021, The PyO3 Contributors" |
| 17 | +author = "The PyO3 Contributors" |
18 | 18 |
|
19 | 19 |
|
20 | 20 | # -- General configuration --------------------------------------------------- |
|
31 | 31 | ] |
32 | 32 |
|
33 | 33 | # Add any paths that contain templates here, relative to this directory. |
34 | | -templates_path = ['_templates'] |
| 34 | +templates_path = ["_templates"] |
35 | 35 |
|
36 | 36 | # List of patterns, relative to source directory, that match files and |
37 | 37 | # directories to ignore when looking for source files. |
38 | 38 | # This pattern also affects html_static_path and html_extra_path. |
39 | | -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 39 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
40 | 40 |
|
41 | 41 |
|
42 | 42 | # -- Options for HTML output ------------------------------------------------- |
43 | 43 |
|
44 | 44 | # The theme to use for HTML and HTML Help pages. See the documentation for |
45 | 45 | # a list of builtin themes. |
46 | 46 | # |
47 | | -html_theme = 'sphinx_rtd_theme' |
| 47 | +html_theme = "sphinx_rtd_theme" |
48 | 48 |
|
49 | 49 | # Add any paths that contain custom static files (such as style sheets) here, |
50 | 50 | # relative to this directory. They are copied after the builtin static files, |
51 | 51 | # so a file named "default.css" will overwrite the builtin "default.css". |
52 | | -html_static_path = ['_static'] |
| 52 | +html_static_path = ["_static"] |
53 | 53 |
|
54 | 54 | html_theme_options = { |
55 | | - 'prev_next_buttons_location': None, |
| 55 | + "prev_next_buttons_location": None, |
56 | 56 | } |
57 | 57 |
|
58 | 58 | # -- Custom HTML link transformation to make documentation links relative -- |
|
62 | 62 |
|
63 | 63 | from sphinx.transforms import SphinxTransform |
64 | 64 |
|
65 | | -DOCS_URL = 'https://setuptools-rust.readthedocs.io/en/latest/' |
| 65 | +DOCS_URL = "https://setuptools-rust.readthedocs.io/en/latest/" |
| 66 | + |
66 | 67 |
|
67 | 68 | class RelativeDocLinks(SphinxTransform): |
68 | 69 |
|
69 | 70 | default_priority = 750 |
70 | 71 |
|
71 | 72 | def apply(self): |
72 | 73 | from docutils.nodes import reference, Text |
| 74 | + |
73 | 75 | baseref = lambda o: ( |
74 | | - isinstance(o, reference) and |
75 | | - o.get('refuri', '').startswith(DOCS_URL)) |
76 | | - basetext = lambda o: ( |
77 | | - isinstance(o, Text) and o.startswith(DOCS_URL)) |
| 76 | + isinstance(o, reference) and o.get("refuri", "").startswith(DOCS_URL) |
| 77 | + ) |
| 78 | + basetext = lambda o: (isinstance(o, Text) and o.startswith(DOCS_URL)) |
78 | 79 | for node in self.document.traverse(baseref): |
79 | | - target = node['refuri'].replace(DOCS_URL, "", 1) |
80 | | - node.replace_attr('refuri', target) |
| 80 | + target = node["refuri"].replace(DOCS_URL, "", 1) |
| 81 | + node.replace_attr("refuri", target) |
81 | 82 | for t in node.traverse(basetext): |
82 | 83 | t1 = Text(t.replace(DOCS_URL, "", 1), t.rawsource) |
83 | 84 | t.parent.replace(t, t1) |
84 | 85 | return |
85 | 86 |
|
| 87 | + |
86 | 88 | # end of class |
87 | 89 |
|
| 90 | + |
88 | 91 | def setup(app): |
89 | 92 | app.add_transform(RelativeDocLinks) |
90 | 93 | return |
0 commit comments