Refactor template names and add tpldoc and tplrepl settings.