From 9f850aa4da6ebcba849cf90d84268ad12986766e Mon Sep 17 00:00:00 2001 From: Jeltz Date: Sat, 7 Jan 2023 08:59:16 +0100 Subject: [PATCH] add format_rev plugin --- filter_plugins/format_rev.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 filter_plugins/format_rev.py diff --git a/filter_plugins/format_rev.py b/filter_plugins/format_rev.py new file mode 100644 index 0000000..16902fb --- /dev/null +++ b/filter_plugins/format_rev.py @@ -0,0 +1,12 @@ +from jinja2.utils import soft_unicode + + +class FilterModule: + def filters(self): + return { + "format_rev": format_rev, + } + + +def format_rev(text, fmt, *args, **kwargs): + return fmt.format(text, *args, **kwargs)