Change urlize filter behavior to be consistent as jinja

There is a bug (maybe? It was intentional looking from the unit tests) in the urlize filter that the punctuations at the beginning and end of a word are removed after urlizing the word. This PR changes the behavior so it is more consistent with jinja.

Test plan: test case included.
In jinja the trim length only applies to the urlized part, so head and tail don't count in the total length. This change also reflects the same behavior.