mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Close #9683: Revert the removal of `add_stylesheet()
` API
It will be kept until the Sphinx-6.0 release. Note: Now it emits a warning instead of DeprecationWarning to let the users know the deprecation.
This commit is contained in:
parent
9922923d6f
commit
1fbca49970
2
CHANGES
2
CHANGES
@ -22,6 +22,8 @@ Features added
|
||||
* #9691: C, added new info-field ``retval``
|
||||
for :rst:dir:`c:function` and :rst:dir:`c:macro`.
|
||||
* C++, added new info-field ``retval`` for :rst:dir:`cpp:function`.
|
||||
* #9683: Revert the removal of ``add_stylesheet()`` API. It will be kept until
|
||||
the Sphinx-6.0 release
|
||||
|
||||
Bugs fixed
|
||||
----------
|
||||
|
@ -1207,7 +1207,7 @@ The following is a list of deprecated interfaces.
|
||||
|
||||
* - :meth:`~sphinx.application.Sphinx.add_stylesheet()`
|
||||
- 1.8
|
||||
- 4.0
|
||||
- 6.0
|
||||
- :meth:`~sphinx.application.Sphinx.add_css_file()`
|
||||
|
||||
* - :meth:`~sphinx.application.Sphinx.add_javascript()`
|
||||
|
@ -1046,6 +1046,26 @@ class Sphinx:
|
||||
if hasattr(self.builder, 'add_css_file'):
|
||||
self.builder.add_css_file(filename, priority=priority, **kwargs) # type: ignore
|
||||
|
||||
def add_stylesheet(self, filename: str, alternate: bool = False, title: str = None
|
||||
) -> None:
|
||||
"""An alias of :meth:`add_css_file`.
|
||||
|
||||
.. deprecated:: 1.8
|
||||
"""
|
||||
logger.warning('The app.add_stylesheet() is deprecated. '
|
||||
'Please use app.add_css_file() instead.')
|
||||
|
||||
attributes = {} # type: Dict[str, Any]
|
||||
if alternate:
|
||||
attributes['rel'] = 'alternate stylesheet'
|
||||
else:
|
||||
attributes['rel'] = 'stylesheet'
|
||||
|
||||
if title:
|
||||
attributes['title'] = title
|
||||
|
||||
self.add_css_file(filename, **attributes)
|
||||
|
||||
def add_latex_package(self, packagename: str, options: str = None,
|
||||
after_hyperref: bool = False) -> None:
|
||||
r"""Register a package to include in the LaTeX source code.
|
||||
|
Loading…
Reference in New Issue
Block a user