|
12 | 12 | import sys |
13 | 13 | import warnings |
14 | 14 | from pathlib import Path |
| 15 | +from types import NoneType |
15 | 16 | from typing import TYPE_CHECKING |
16 | 17 | from urllib.parse import quote |
17 | 18 |
|
@@ -1439,60 +1440,77 @@ def setup(app: Sphinx) -> ExtensionMetadata: |
1439 | 1440 | app.add_builder(StandaloneHTMLBuilder) |
1440 | 1441 |
|
1441 | 1442 | # config values |
1442 | | - app.add_config_value('html_theme', 'alabaster', 'html') |
1443 | | - app.add_config_value('html_theme_path', [], 'html') |
1444 | | - app.add_config_value('html_theme_options', {}, 'html') |
| 1443 | + app.add_config_value('html_theme', 'alabaster', 'html', types=frozenset({str})) |
| 1444 | + app.add_config_value('html_theme_path', [], 'html', types=frozenset({list, tuple})) |
| 1445 | + app.add_config_value('html_theme_options', {}, 'html', types=frozenset({dict})) |
1445 | 1446 | app.add_config_value( |
1446 | 1447 | 'html_title', |
1447 | 1448 | lambda c: _('%s %s documentation') % (c.project, c.release), |
1448 | 1449 | 'html', |
1449 | 1450 | types=frozenset({str}), |
1450 | 1451 | ) |
1451 | | - app.add_config_value('html_short_title', lambda self: self.html_title, 'html') |
1452 | | - app.add_config_value('html_style', None, 'html', types=frozenset({list, str})) |
| 1452 | + app.add_config_value( |
| 1453 | + 'html_short_title', lambda self: self.html_title, 'html', types=frozenset({str}) |
| 1454 | + ) |
| 1455 | + app.add_config_value( |
| 1456 | + 'html_style', None, 'html', types=frozenset({list, str, tuple}) |
| 1457 | + ) |
1453 | 1458 | app.add_config_value('html_logo', None, 'html', types=frozenset({str})) |
1454 | 1459 | app.add_config_value('html_favicon', None, 'html', types=frozenset({str})) |
1455 | | - app.add_config_value('html_css_files', [], 'html') |
1456 | | - app.add_config_value('html_js_files', [], 'html') |
1457 | | - app.add_config_value('html_static_path', [], 'html') |
1458 | | - app.add_config_value('html_extra_path', [], 'html') |
| 1460 | + app.add_config_value('html_css_files', [], 'html', types=frozenset({list, tuple})) |
| 1461 | + app.add_config_value('html_js_files', [], 'html', types=frozenset({list, tuple})) |
| 1462 | + app.add_config_value('html_static_path', [], 'html', types=frozenset({list, tuple})) |
| 1463 | + app.add_config_value('html_extra_path', [], 'html', types=frozenset({list, tuple})) |
1459 | 1464 | app.add_config_value('html_last_updated_fmt', None, 'html', types=frozenset({str})) |
1460 | 1465 | app.add_config_value( |
1461 | 1466 | 'html_last_updated_use_utc', False, 'html', types=frozenset({bool}) |
1462 | 1467 | ) |
1463 | | - app.add_config_value('html_sidebars', {}, 'html') |
1464 | | - app.add_config_value('html_additional_pages', {}, 'html') |
| 1468 | + app.add_config_value('html_sidebars', {}, 'html', types=frozenset({dict})) |
| 1469 | + app.add_config_value('html_additional_pages', {}, 'html', types=frozenset({dict})) |
1465 | 1470 | app.add_config_value( |
1466 | | - 'html_domain_indices', True, 'html', types=frozenset({set, list}) |
| 1471 | + 'html_domain_indices', |
| 1472 | + True, |
| 1473 | + 'html', |
| 1474 | + types=frozenset({frozenset, list, set, tuple}), |
| 1475 | + ) |
| 1476 | + app.add_config_value('html_permalinks', True, 'html', types=frozenset({bool})) |
| 1477 | + app.add_config_value('html_permalinks_icon', '¶', 'html', types=frozenset({str})) |
| 1478 | + app.add_config_value('html_use_index', True, 'html', types=frozenset({bool})) |
| 1479 | + app.add_config_value('html_split_index', False, 'html', types=frozenset({bool})) |
| 1480 | + app.add_config_value('html_copy_source', True, 'html', types=frozenset({bool})) |
| 1481 | + app.add_config_value('html_show_sourcelink', True, 'html', types=frozenset({bool})) |
| 1482 | + app.add_config_value( |
| 1483 | + 'html_sourcelink_suffix', '.txt', 'html', types=frozenset({str}) |
1467 | 1484 | ) |
1468 | | - app.add_config_value('html_permalinks', True, 'html') |
1469 | | - app.add_config_value('html_permalinks_icon', '¶', 'html') |
1470 | | - app.add_config_value('html_use_index', True, 'html') |
1471 | | - app.add_config_value('html_split_index', False, 'html') |
1472 | | - app.add_config_value('html_copy_source', True, 'html') |
1473 | | - app.add_config_value('html_show_sourcelink', True, 'html') |
1474 | | - app.add_config_value('html_sourcelink_suffix', '.txt', 'html') |
1475 | | - app.add_config_value('html_use_opensearch', '', 'html') |
| 1485 | + app.add_config_value('html_use_opensearch', '', 'html', types=frozenset({str})) |
1476 | 1486 | app.add_config_value('html_file_suffix', None, 'html', types=frozenset({str})) |
1477 | 1487 | app.add_config_value('html_link_suffix', None, 'html', types=frozenset({str})) |
1478 | | - app.add_config_value('html_show_copyright', True, 'html') |
1479 | | - app.add_config_value('html_show_search_summary', True, 'html') |
1480 | | - app.add_config_value('html_show_sphinx', True, 'html') |
1481 | | - app.add_config_value('html_context', {}, 'html') |
1482 | | - app.add_config_value('html_output_encoding', 'utf-8', 'html') |
1483 | | - app.add_config_value('html_compact_lists', True, 'html') |
1484 | | - app.add_config_value('html_secnumber_suffix', '. ', 'html') |
| 1488 | + app.add_config_value('html_show_copyright', True, 'html', types=frozenset({bool})) |
| 1489 | + app.add_config_value( |
| 1490 | + 'html_show_search_summary', True, 'html', types=frozenset({bool}) |
| 1491 | + ) |
| 1492 | + app.add_config_value('html_show_sphinx', True, 'html', types=frozenset({bool})) |
| 1493 | + app.add_config_value('html_context', {}, 'html', types=frozenset({dict})) |
| 1494 | + app.add_config_value( |
| 1495 | + 'html_output_encoding', 'utf-8', 'html', types=frozenset({str}) |
| 1496 | + ) |
| 1497 | + app.add_config_value('html_compact_lists', True, 'html', types=frozenset({bool})) |
| 1498 | + app.add_config_value('html_secnumber_suffix', '. ', 'html', types=frozenset({str})) |
1485 | 1499 | app.add_config_value('html_search_language', None, 'html', types=frozenset({str})) |
1486 | | - app.add_config_value('html_search_options', {}, 'html') |
1487 | | - app.add_config_value('html_search_scorer', '', '') |
1488 | | - app.add_config_value('html_scaled_image_link', True, 'html') |
1489 | | - app.add_config_value('html_baseurl', '', 'html') |
| 1500 | + app.add_config_value('html_search_options', {}, 'html', types=frozenset({dict})) |
| 1501 | + app.add_config_value('html_search_scorer', '', '', types=frozenset({str})) |
| 1502 | + app.add_config_value( |
| 1503 | + 'html_scaled_image_link', True, 'html', types=frozenset({bool}) |
| 1504 | + ) |
| 1505 | + app.add_config_value('html_baseurl', '', 'html', types=frozenset({str})) |
1490 | 1506 | # removal is indefinitely on hold (ref: https://github.com/sphinx-doc/sphinx/issues/10265) |
1491 | 1507 | app.add_config_value( |
1492 | 1508 | 'html_codeblock_linenos_style', 'inline', 'html', types=ENUM('table', 'inline') |
1493 | 1509 | ) |
1494 | | - app.add_config_value('html_math_renderer', None, 'env') |
1495 | | - app.add_config_value('html4_writer', False, 'html') |
| 1510 | + app.add_config_value( |
| 1511 | + 'html_math_renderer', None, 'env', types=frozenset({str, NoneType}) |
| 1512 | + ) |
| 1513 | + app.add_config_value('html4_writer', False, 'html', types=frozenset({bool})) |
1496 | 1514 |
|
1497 | 1515 | # events |
1498 | 1516 | app.add_event('html-collect-pages') |
|
0 commit comments