Jinja filters¶
Note
The documentation in this section is aimed at people wishing to contribute to
versionah, and can be skipped if you are simply using the tool from the
command line.
-
versionah.FILTERS= {'regexp': <function filter_regexp>}¶ Custom filters for Jinja
A
dictmapping custom filter names to their functions. For help with writing your own custom filter functions see Jinja’s excellent custom filter documentation.
-
versionah.filter_regexp(string, pattern, repl, count=0, flags=0)[source]¶ Jinja filter for regexp replacements.
See
re.sub()for documentation.Return type: strReturns: Text with substitutions applied
Examples¶
>>> filter_regexp('valid keyword', '[^A-Z]', '_', flags=re.IGNORECASE)
'valid_keyword'
>>> filter_regexp('De-voweled', '[aeiou]', '')
'D-vwld'