Skip to content

Commit

Permalink
Adding deprecation warnings for template functions (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf authored Apr 9, 2021
1 parent 52ac5f1 commit a957651
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def add_header_level_recursive(ul, level):
else:
return soup

# TODO: Deprecate in v0.7.0
def get_nav_object(maxdepth=None, collapse=True, includehidden=True, **kwargs):
"""Return a list of nav links that can be accessed from Jinja.
Expand All @@ -190,6 +191,9 @@ def get_nav_object(maxdepth=None, collapse=True, includehidden=True, **kwargs):
kwargs: key/val pairs
Passed to the `toctree` Sphinx method
"""
if context["master_doc"] == pagename:
logger.warn("`get_nav_object` is deprecated and will be removed in v0.7.0")

toc_sphinx = context["toctree"](
maxdepth=maxdepth, collapse=collapse, includehidden=includehidden, **kwargs
)
Expand All @@ -200,11 +204,18 @@ def get_nav_object(maxdepth=None, collapse=True, includehidden=True, **kwargs):
# return []

nav_object = soup_to_python(soup, only_pages=True)

return nav_object

# TODO: Deprecate in v0.7.0
def get_page_toc_object():
"""Return a list of within-page TOC links that can be accessed from Jinja."""

if context["master_doc"] == pagename:
logger.warn(
("`get_page_toc_object` is deprecated and will be " "removed in v0.7.0")
)

if "toc" not in context:
return ""

Expand Down

0 comments on commit a957651

Please sign in to comment.