-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Version and OS
v0.50.21/ubuntu (docker)
Is your feature request related to a problem? Please describe.
This is a QoL feature, in that it allows for strong control around notification content. It allows for users to format output using regex to split parts of the diff
Describe the solution you'd like
I'd like a regex_replace
filter to be added to the Jinja registration. It looks like this is pretty highly requested of the Jinja team themselves, but there's hesitance to do so. Other projects have built their own filters to handle this specific situation
Describe the use-case and give concrete real-world examples
My diff is a single line of text (the html is a single line), and I'd like to extract <td>thing</td><td>other</td><td>field</td>
into:
ThingLabel: thing
OtherLabel: other
FieldLabel: field
Additional context
This has been requested before, and is a middle-ground between a full-fledged "output gonkulator" and nothing. Previous requests: #2653 & #2000
I'm more than happy to raise a PR, but I wanted to get alignment before going through the testing. My plan is:
- in safe_jinja.py, I'll add the filter and register it with jinja
- in forms.py#ValidateJinja2Template, add the filter so validation passes
If this looks correct, I'll give it a crack