9
9
from github import Github
10
10
import pyvista
11
11
import requests
12
- import sphinx
12
+ from sphinx .addnodes import document as doctree
13
+ from sphinx .application import Sphinx as App
13
14
from sphinx .builders .latex import LaTeXBuilder
14
15
15
16
from ansys_sphinx_theme import (
27
28
EXAMPLE_PATH = (THIS_PATH / "examples" / "sphinx_examples" ).resolve ()
28
29
29
30
# To allow using 'helper' python file as a module
30
- sys .path .append (Path (__file__ ).parent )
31
+ sys .path .append (str ( Path (__file__ ).parent ) )
31
32
32
33
# Project information
33
34
project = "ansys_sphinx_theme"
@@ -273,11 +274,11 @@ def download_and_process_files(example_links: List[str]) -> List[str]:
273
274
274
275
275
276
def remove_edit_this_page_if_directive (
276
- app : sphinx . app ,
277
+ app : App ,
277
278
pagename : str ,
278
279
templatename : str ,
279
- context : sphinx . context ,
280
- doctree : sphinx . doctree ,
280
+ context : dict ,
281
+ doctree : doctree ,
281
282
page_vars : dict ,
282
283
):
283
284
"""Remove 'edit this page' button.
@@ -287,15 +288,15 @@ def remove_edit_this_page_if_directive(
287
288
288
289
Parameters
289
290
----------
290
- app : sphinx.app
291
+ app : sphinx.application.Sphinx
291
292
Sphinx app
292
293
pagename : str
293
294
Page name
294
295
templatename : str
295
296
Template name
296
- context : sphinx.context
297
+ context : dict
297
298
Page context
298
- doctree : sphinx.doctree
299
+ doctree : sphinx.addnodes.document
299
300
Page doctree
300
301
page_vars : dict
301
302
Page variables
@@ -308,11 +309,11 @@ def remove_edit_this_page_if_directive(
308
309
309
310
310
311
def remove_show_source_if_directive (
311
- app : sphinx . app ,
312
+ app : App ,
312
313
pagename : str ,
313
314
templatename : str ,
314
- context : sphinx . context ,
315
- doctree : sphinx . doctree ,
315
+ context : dict ,
316
+ doctree : doctree ,
316
317
page_vars : dict ,
317
318
):
318
319
"""Remove the 'show_source' link.
@@ -322,15 +323,15 @@ def remove_show_source_if_directive(
322
323
323
324
Parameters
324
325
----------
325
- app : sphinx.app
326
+ app : sphinx.application.Sphinx
326
327
Sphinx app
327
328
pagename : str
328
329
Page name
329
330
templatename : str
330
331
Template name
331
- context : sphinx.context
332
+ context : dict
332
333
Page context
333
- doctree : sphinx.doctree
334
+ doctree : sphinx.addnodes.document
334
335
Page doctree
335
336
page_vars : dict
336
337
Page variables
@@ -342,27 +343,27 @@ def remove_show_source_if_directive(
342
343
343
344
344
345
def pre_build_page_html (
345
- app : sphinx . app ,
346
+ app : App ,
346
347
pagename : str ,
347
348
templatename : str ,
348
- context : sphinx . context ,
349
- doctree : sphinx . doctree ,
349
+ context : dict ,
350
+ doctree : doctree ,
350
351
):
351
352
"""Apply hooks before building HTML.
352
353
353
354
Apply the hooks as functions before building the HTML files.
354
355
355
356
Parameters
356
357
----------
357
- app : sphinx.app
358
+ app : sphinx.application.Sphinx
358
359
Sphinx app
359
360
pagename : str
360
361
Page name
361
362
templatename : str
362
363
Template name
363
- context : sphinx.context
364
+ context : dict
364
365
Page context
365
- doctree : sphinx.doctree
366
+ doctree : sphinx.addnodes.document
366
367
Page doctree
367
368
"""
368
369
from helpers import get_page_vars
@@ -375,12 +376,12 @@ def pre_build_page_html(
375
376
remove_show_source_if_directive (app , pagename , templatename , context , doctree , page_vars )
376
377
377
378
378
- def setup (app : sphinx ):
379
+ def setup (app : App ):
379
380
"""Add custom configuration to sphinx app.
380
381
381
382
Parameters
382
383
----------
383
- app : sphinx.application.sphinx
384
+ app : sphinx.application.Sphinxlication. sphinx
384
385
The Sphinx application.
385
386
"""
386
387
from helpers import SetPageVariableDirective , add_custom_variables_to_context
0 commit comments