Skip to content

Commit

Permalink
Merge pull request #238 from timvink/master
Browse files Browse the repository at this point in the history
Fix registration system
  • Loading branch information
fralau authored Sep 14, 2024
2 parents 363d904 + 03f5e89 commit 67ccb15
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mkdocs_macros/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,7 @@ def raw_markdown(self, value):
# ----------------------------------
# Hooks for other applications
# ----------------------------------
@property
def register_macro(self, items:dict):
def register_macros(self, items:dict):
"""
Register macros (hook for other plugins).
These will be added last, and raise an exception if already present.
Expand All @@ -337,25 +336,26 @@ def register_macro(self, items:dict):
# after on_config
self._macros
register_items('macro', self.macros, items)
self.variables["macros"].update(self.macros)
self.env.globals.update(self.macros)
except AttributeError:
# before on_config: store for later
self._add_macros += items
self._add_macros.update(items)

@property
def register_filters(self, items:dict):
"""
Register filters (hook for other plugins).
These will be added last, and raise an exception if already present.
"""
try:
# after on_config
self._filters
register_items('filter', self.filters, items)
self.variables["filters"].update(self.filters)
self.env.filters.update(self.filters)
except AttributeError:
# before on_config: store for later
self._add_filters += items
self._add_filters.update(items)

@property
def register_variables(self, items:dict):
"""
Register variables (hook for other plugins).
Expand All @@ -367,7 +367,7 @@ def register_variables(self, items:dict):
register_items('variables', self.variables, items)
except AttributeError:
# before on_config: store for later
self._add_variables += items
self._add_variables.update(items)

# ----------------------------------
# Function lists, for later events
Expand Down

0 comments on commit 67ccb15

Please sign in to comment.