More flexible urlize template filter (passing a function that will execute for each url)
|Reported by:||Stefan_Petrea||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I'd like to have more control over how the links are generated through the urlize built-in filter.
To be more specific , I'd like to be able to pass a lambda or a subroutine(sorry I don't know how you call it in Python)
so that it will be called for each link it detects on that particular text and let me modify it how I want.
Of course, I cannot do that from the template Language , so what I propose is
a urlize Factory that will let the user build his own customized urlize filter.
new_filter = build_urlize_filter(do_when_url_encountered)
and pass to do_when_url_encountered the url each time one is encountered so that
the user can write his own code on what he thinks is right to be done here
(My particular needs would be to get the text from the last '/' to the end of the link and use that as the text
for the link)
Change History (3)
comment:1 Changed 4 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to wontfix
- Status changed from new to closed
comment:2 Changed 4 years ago by Stefan_Petrea
- Resolution wontfix deleted
- Status changed from closed to reopened