MCPcopy
hub / github.com/pandas-dev/pandas / navbar_add_info

Method navbar_add_info

web/pandas_web.py:78–91  ·  view source on GitHub ↗

Items in the main navigation bar can be direct links, or dropdowns with subitems. This context preprocessor adds a boolean field ``has_subitems`` that tells which one of them every element is. It also adds a ``slug`` field to be used as a CSS id.

(context)

Source from the content-addressed store, hash-verified

76
77 @staticmethod
78 def navbar_add_info(context):
79 """
80 Items in the main navigation bar can be direct links, or dropdowns with
81 subitems. This context preprocessor adds a boolean field
82 ``has_subitems`` that tells which one of them every element is. It
83 also adds a ``slug`` field to be used as a CSS id.
84 """
85 for i, item in enumerate(context["navbar"]):
86 context["navbar"][i] = dict(
87 item,
88 has_subitems=isinstance(item["target"], list),
89 slug=(item["name"].replace(" ", "-").lower()),
90 )
91 return context
92
93 @staticmethod
94 def blog_add_posts(context):

Callers

nothing calls this directly

Calls 2

lowerMethod · 0.80
replaceMethod · 0.45

Tested by

no test coverage detected