base: add new 'trim' filter.

Close #712.