avoid loading preprocessors twice

in TemplateExporter

also cleaned up some of the related code.
Merge pull request #5313 from minrk/double-init-preprocessor

avoid loading preprocessors twice