|
98 | 98 | 'Zoltán Vörös', 'manual'),
|
99 | 99 | ]
|
100 | 100 |
|
101 |
| -# sphinx-autoapi |
102 |
| -extensions.append('autoapi.extension') |
103 |
| -autoapi_type = 'python' |
104 |
| -autoapi_keep_files = True |
105 |
| -autoapi_dirs = ["ulab"] |
106 |
| -autoapi_add_toctree_entry = False |
107 |
| -autoapi_options = ['members', 'undoc-members', 'private-members', 'show-inheritance', 'special-members'] |
108 |
| -autoapi_template_dir = '../autoapi/templates' |
109 |
| -autoapi_python_class_content = "both" |
110 |
| -autoapi_python_use_implicit_namespaces = True |
111 |
| -autoapi_root = "." |
112 |
| - |
113 |
| - |
114 | 101 | # Read the docs theme
|
115 | 102 | on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
|
116 | 103 | if not on_rtd:
|
|
123 | 110 | html_theme_path = ['.']
|
124 | 111 | else:
|
125 | 112 | html_theme_path = ['.']
|
126 |
| - |
127 |
| - |
128 |
| -class UlabTransform(SphinxTransform): |
129 |
| - default_priority = 870 |
130 |
| - |
131 |
| - def _convert_first_paragraph_into_title(self): |
132 |
| - title = self.document.next_node(nodes.title) |
133 |
| - paragraph = self.document.next_node(nodes.paragraph) |
134 |
| - if not title or not paragraph: |
135 |
| - return |
136 |
| - if isinstance(paragraph[0], nodes.paragraph): |
137 |
| - paragraph = paragraph[0] |
138 |
| - if all(isinstance(child, nodes.Text) for child in paragraph.children): |
139 |
| - for child in paragraph.children: |
140 |
| - title.append(nodes.Text(" \u2013 ")) |
141 |
| - title.append(child) |
142 |
| - paragraph.parent.remove(paragraph) |
143 |
| - |
144 |
| - def _enable_linking_to_nonclass_targets(self): |
145 |
| - for desc in self.document.traverse(addnodes.desc): |
146 |
| - for xref in desc.traverse(addnodes.pending_xref): |
147 |
| - if xref.attributes.get("reftype") == "class": |
148 |
| - xref.attributes.pop("refspecific", None) |
149 |
| - |
150 |
| - def apply(self, **kwargs): |
151 |
| - docname = self.env.docname |
152 |
| - if docname.startswith("ulab/"): |
153 |
| - self._convert_first_paragraph_into_title() |
154 |
| - self._enable_linking_to_nonclass_targets() |
155 |
| - |
156 |
| - |
157 |
| -def setup(app): |
158 |
| - app.add_transform(UlabTransform) |
0 commit comments