def patch_lookup_functions(self):
"""Monkey-patch directive and role dispatch, so that domain-specific
markup takes precedence.
"""
def directive(name, lang_module, document):
try:
return self.lookup_domain_element('directive', name)
except ElementLookupError:
return orig_directive_function(name, lang_module, document)
def role(name, lang_module, lineno, reporter):
try:
return self.lookup_domain_element('role', name)
except ElementLookupError:
return orig_role_function(name, lang_module, lineno, reporter)
directives.directive = directive
roles.role = role
评论列表
文章目录