preprocess filename through a template