Mercurial > public > mercurial-scm > hg
comparison mercurial/templatefilters.py @ 28692:6b3b958daf03
registrar: add templatefilter to mark a function as template filter (API)
This patch also adds loadfilter() to templatefilters, because this
combination helps to figure out how they cooperate with each other.
Listing up loadfilter() in dispatch.extraloaders causes implicit
loading template filter functions at loading (3rd party) extension.
This change requires that "templatefilter" attribute of (3rd party)
extension is registrar.templatefilter or so.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 30 Mar 2016 02:10:44 +0900 |
parents | 93b5c540db69 |
children | 11f623b5668f |
comparison
equal
deleted
inserted
replaced
28691:a04baf9c063b | 28692:6b3b958daf03 |
---|---|
413 if websubtable: | 413 if websubtable: |
414 for regexp, format in websubtable: | 414 for regexp, format in websubtable: |
415 text = regexp.sub(format, text) | 415 text = regexp.sub(format, text) |
416 return text | 416 return text |
417 | 417 |
418 def loadfilter(ui, extname, registrarobj): | |
419 """Load template filter from specified registrarobj | |
420 """ | |
421 for name, func in registrarobj._table.iteritems(): | |
422 filters[name] = func | |
423 | |
418 # tell hggettext to extract docstrings from these functions: | 424 # tell hggettext to extract docstrings from these functions: |
419 i18nfunctions = filters.values() | 425 i18nfunctions = filters.values() |